[PATCH 03/13] use fixed width integers types from <stdint.h>

Ruben Kerkhof ruben at rubenkerkhof.com
Sat Mar 18 17:25:33 CET 2017


---
 aclocal.m4      | 33 ---------------------------------
 configure.ac    |  1 -
 sysdep/config.h | 22 ++++++++++++----------
 3 files changed, 12 insertions(+), 44 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 36749c58..29049d18 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,39 +1,6 @@
 dnl ** Additional Autoconf tests for BIRD configure script
 dnl ** (c) 1999 Martin Mares <mj at ucw.cz>
 
-AC_DEFUN([BIRD_CHECK_INTEGERS],
-[AC_CHECK_SIZEOF(char, 0)
-AC_CHECK_SIZEOF(short int, 0)
-AC_CHECK_SIZEOF(int, 0)
-AC_CHECK_SIZEOF(long int, 0)
-AC_CHECK_SIZEOF(long long int, 0)
-AH_TEMPLATE([INTEGER_8],  [8-bit integer type])
-AH_TEMPLATE([INTEGER_16], [16-bit integer type])
-AH_TEMPLATE([INTEGER_32], [32-bit integer type])
-AH_TEMPLATE([INTEGER_64], [64-bit integer type])
-
-for size in 1 2 4 8; do
-	bits=`expr $size "*" 8`
-	AC_MSG_CHECKING([for $bits-bit type])
-	if test $ac_cv_sizeof_int = $size ; then
-		res=int
-	elif test $ac_cv_sizeof_char = $size ; then
-		res=char
-	elif test $ac_cv_sizeof_short_int = $size ; then
-		res="short int"
-	elif test $ac_cv_sizeof_long_int = $size ; then
-		res="long int"
-	elif test $ac_cv_sizeof_long_long_int = $size ; then
-		res="long long int"
-	else
-		AC_MSG_RESULT([not found])
-		AC_MSG_ERROR([Cannot find $bits-bit integer type.])
-	fi
-	AC_MSG_RESULT($res)
-	AC_DEFINE_UNQUOTED(INTEGER_$bits, $res)
-	done
-])
-
 AC_DEFUN([BIRD_CHECK_STRUCT_ALIGN],
 [AC_CACHE_CHECK([usual alignment of structures],bird_cv_c_struct_align,[
 AC_TRY_RUN([
diff --git a/configure.ac b/configure.ac
index c06677c5..840cc0ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,7 +275,6 @@ AC_C_BIGENDIAN(
   [AC_MSG_ERROR([Cannot determine CPU endianity.])]
 )
 
-BIRD_CHECK_INTEGERS
 BIRD_CHECK_STRUCT_ALIGN
 BIRD_CHECK_TIME_T
 BIRD_CHECK_STRUCT_IP_MREQN
diff --git a/sysdep/config.h b/sysdep/config.h
index 84085f9c..e529cd86 100644
--- a/sysdep/config.h
+++ b/sysdep/config.h
@@ -24,16 +24,18 @@
 #include "sysdep/paths.h"
 
 /* Types */
-typedef signed INTEGER_8 s8;
-typedef unsigned INTEGER_8 u8;
-typedef INTEGER_16 s16;
-typedef unsigned INTEGER_16 u16;
-typedef INTEGER_32 s32;
-typedef unsigned INTEGER_32 u32;
-typedef INTEGER_64 s64;
-typedef unsigned INTEGER_64 u64;
-typedef u8 byte;
-typedef u16 word;
+
+#include <stdint.h>
+typedef int8_t s8;
+typedef uint8_t u8;
+typedef int16_t s16;
+typedef uint16_t u16;
+typedef int32_t s32;
+typedef uint32_t u32;
+typedef int64_t s64;
+typedef uint64_t u64;
+typedef uint8_t byte;
+typedef uint16_t word;
 typedef unsigned int uint;
 
 #endif
-- 
2.12.0



More information about the Bird-users mailing list