From 17e205070745e4712d40eed32d92d02edb47009f Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Sat, 1 Feb 2014 15:20:08 -0500 Subject: Assume and fixed-width types Make unconditional use of and fixed-width types such as uint32_t. k5-plugin.h doesn't use any special integer types, so remove the conditional include block there. Nothing uses INT64_FMT/UINT64_FMT, so leave those out of k5-platform.h for now. --- src/configure.in | 57 ----------------------------- src/include/gssrpc/types.hin | 44 +--------------------- src/include/k5-platform.h | 39 ++------------------ src/include/k5-plugin.h | 6 --- src/include/krb5/krb5.hin | 30 +++------------ src/lib/gssapi/generic/Makefile.in | 6 --- src/lib/gssapi/krb5/Makefile.in | 16 +------- src/lib/gssapi/krb5/gssapi_krb5.hin | 10 +---- src/plugins/kdb/db2/libdb2/include/db-int.h | 6 --- src/util/profile/prof_init.c | 6 --- src/util/t_array.pm | 4 +- 11 files changed, 15 insertions(+), 209 deletions(-) (limited to 'src') diff --git a/src/configure.in b/src/configure.in index 7dded28f22..9bc4663d1a 100644 --- a/src/configure.in +++ b/src/configure.in @@ -755,16 +755,6 @@ AH_BOTTOM([ #endif /* KRB5_AUTOCONF_H */ ]) -# Not used yet, but let's find out what we've got on the platforms -# we're working with.... -AC_CHECK_HEADERS(inttypes.h stdint.h) -AC_CHECK_TYPES([uint32_t, int32_t, uint64_t, int64_t, uint_least32_t, uintptr_t, uintmax_t, long long], , , [ -#ifdef HAVE_STDINT_H -# include -#elif defined(HAVE_INTTYPES_H) -# include -#endif -]) AC_CHECK_TYPES([struct cmsghdr, struct in_pktinfo, struct in6_pktinfo, struct sockaddr_storage], , , [ #include #include @@ -872,14 +862,6 @@ AC_CHECK_PROG(RUNTEST,runtest,runtest) AC_CHECK_PROG(PERL,perl,perl) # lib/gssapi -AC_CHECK_HEADER(stdint.h,[ - include_stdint='awk '\''END{printf("%cinclude \n", 35);}'\'' < /dev/null'], - include_stdint='echo "/* no stdint.h */"') -AC_SUBST(include_stdint) -AC_CHECK_HEADER(inttypes.h,[ - include_inttypes='awk '\''END{printf("%cinclude \n", 35);}'\'' < /dev/null'], - include_inttypes='echo "/* no inttypes.h */"') -AC_SUBST(include_inttypes) AC_CHECK_HEADER(xom.h,[ include_xom='awk '\''END{printf("%cinclude \n", 35);}'\'' < /dev/null'], [ include_xom='echo "/* no xom.h */"']) @@ -965,45 +947,6 @@ fi AC_SUBST(GSSRPC__SYS_PARAM_H) AC_SUBST(GSSRPC__NETDB_H) -AC_CACHE_CHECK([for uint32_t in sys/types.h], - [krb5_cv_header_sys_types_h_uint32_t], - [AC_TRY_COMPILE([#include ], - [uint32_t i = 0;], - [krb5_cv_header_sys_types_h_uint32_t=yes], - [krb5_cv_header_sys_types_h_uint32_t=no])]) -AC_CACHE_CHECK([for uint32_t in stdint.h], - [krb5_cv_header_stdint_h_uint32_t], - [AC_TRY_COMPILE([#include ], - [uint32_t i = 0;], - [krb5_cv_header_stdint_h_uint32_t=yes], - [krb5_cv_header_stdint_h_uint32_t=no])]) -AC_CACHE_CHECK([for uint32_t in inttypes.h], - [krb5_cv_header_inttypes_h_uint32_t], - [AC_TRY_COMPILE([#include ], - [uint32_t i = 0;], - [krb5_cv_header_inttypes_h_uint32_t=yes], - [krb5_cv_header_inttypes_h_uint32_t=no])]) -GSSRPC__STDINT_H='/* #include */' -GSSRPC__INTTYPES_H='/* #include */' -GSSRPC__FAKE_UINT32='/* #undef GSSRPC__FAKE_INT32 */' -if test $krb5_cv_header_sys_types_h_uint32_t = yes; then - : # already included sys/types.h -else - if test $krb5_cv_header_stdint_h_uint32_t = yes; then - GSSRPC__STDINT_H='#include ' - else - if test $krb5_cv_header_inttypes_h_uint32_t = yes; then - GSSRPC__INTTYPES_H='#include ' - else - AC_MSG_WARN([can't find a fixed-width 32-bit type anywhere; faking it]) - GSSRPC__FAKE_UINT32='#define GSSRPC__FAKE_UINT32 1' - fi - fi -fi -AC_SUBST(GSSRPC__STDINT_H) -AC_SUBST(GSSRPC__INTTYPES_H) -AC_SUBST(GSSRPC__FAKE_UINT32) - AC_CACHE_CHECK([for BSD type aliases], [krb5_cv_type_bsdaliases], [AC_TRY_COMPILE( [#include diff --git a/src/include/gssrpc/types.hin b/src/include/gssrpc/types.hin index 9d3301217d..022ab4fa90 100644 --- a/src/include/gssrpc/types.hin +++ b/src/include/gssrpc/types.hin @@ -55,16 +55,7 @@ #include #include - -/* - * Pull in typedefs for fixed-width integers somehow, if they weren't - * in sys/types.h. - */ -@GSSRPC__STDINT_H@ -@GSSRPC__INTTYPES_H@ -/* Define if there is no uint32_t in system headers. */ -@GSSRPC__FAKE_UINT32@ - +#include #include #ifndef GSSRPC__BEGIN_DECLS @@ -83,39 +74,6 @@ GSSRPC__BEGIN_DECLS #error "Bytes must be exactly 8 bits." #endif -/* - * If no uint32_t in system headers, fake it by looking for a 32-bit - * two's-complement type. Yes, this stomps on POSIX namespace, but if - * we get here, we're on a system that's far from being - * POSIX-compliant anyway. - */ -#if GSSRPC__FAKE_UINT32 -#if (UINT_MAX == 0xffffffffUL) && (INT_MAX == 0x7fffffffL) \ - && (INT_MIN == -INT_MAX-1) -typedef int int32_t; -typedef unsigned int uint32_t; -#else -#if (ULONG_MAX == 0xffffffffUL) && (LONG_MAX == 0x7fffffffL) \ - && (LONG_MIN == -LONG_MAX-1) -typedef long int32_t; -typedef unsigned long uint32_t; -#else -#if (USHRT_MAX == 0xffffffffUL) && (SHRT_MAX == 0x7fffffffL) \ - && (SHRT_MIN == -SHRT_MAX-1) -typedef short int32_t; -typedef unsigned short uint32_t; -#else -#error "Can't fake up uint32_t." -#endif -#endif -#endif -#endif /* GSSRPC__FAKE_UINT32 */ - -#if (LONG_MIN != -LONG_MAX-1) || (INT_MIN != -INT_MAX-1) \ - || (SHRT_MIN != -SHRT_MAX-1) -#error "Integer types must be two's-complement." -#endif - /* Define if we need to fake up some BSD type aliases. */ #ifndef GSSRPC__BSD_TYPEALIASES /* Allow application to override. */ @GSSRPC__BSD_TYPEALIASES@ diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h index 8f0ca9f312..537c8add5b 100644 --- a/src/include/k5-platform.h +++ b/src/include/k5-platform.h @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -410,42 +411,13 @@ typedef struct { int error; unsigned char did_run; } k5_init_t; #endif - -/* 64-bit support: krb5_ui_8 and krb5_int64. - - This should move to krb5.h eventually, but without the namespace - pollution from the autoconf macros. */ -#if defined(HAVE_STDINT_H) || defined(HAVE_INTTYPES_H) -# ifdef HAVE_STDINT_H -# include -# endif -# ifdef HAVE_INTTYPES_H -# include -# endif -# define INT64_TYPE int64_t -# define UINT64_TYPE uint64_t -# define INT64_FMT PRId64 -# define UINT64_FMT PRIu64 -#elif defined(_WIN32) -# define INT64_TYPE signed __int64 -# define UINT64_TYPE unsigned __int64 -# define INT64_FMT "I64d" -# define UINT64_FMT "I64u" -#else /* not Windows, and neither stdint.h nor inttypes.h */ -# define INT64_TYPE signed long long -# define UINT64_TYPE unsigned long long -# define INT64_FMT "lld" -# define UINT64_FMT "llu" -#endif +#define INT64_TYPE int64_t +#define UINT64_TYPE uint64_t #ifndef SIZE_MAX # define SIZE_MAX ((size_t)((size_t)0 - 1)) #endif -#ifndef UINT64_MAX -# define UINT64_MAX ((UINT64_TYPE)((UINT64_TYPE)0 - 1)) -#endif - #ifdef _WIN32 # define SSIZE_MAX ((ssize_t)(SIZE_MAX/2)) #endif @@ -743,13 +715,8 @@ load_64_le (const void *cvp) #endif } -#ifdef _WIN32 -#define UINT16_TYPE unsigned __int16 -#define UINT32_TYPE unsigned __int32 -#else #define UINT16_TYPE uint16_t #define UINT32_TYPE uint32_t -#endif static inline void store_16_n (unsigned int val, void *vp) diff --git a/src/include/k5-plugin.h b/src/include/k5-plugin.h index 6ffbdbb716..90809e168e 100644 --- a/src/include/k5-plugin.h +++ b/src/include/k5-plugin.h @@ -58,12 +58,6 @@ #define KRB5_CALLCONV_C #endif -#ifdef HAVE_STDINT_H -# include -#elif defined(HAVE_INTTYPES_H) -# include -#endif - #include "k5-err.h" /* diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin index 8d7a650a2f..43b1f08c00 100644 --- a/src/include/krb5/krb5.hin +++ b/src/include/krb5/krb5.hin @@ -92,6 +92,7 @@ #include #include /* for *_MAX */ #include +#include #ifndef KRB5INT_BEGIN_DECLS #if defined(__cplusplus) @@ -129,30 +130,11 @@ struct _profile_t; * Word-size related definition. */ -typedef unsigned char krb5_octet; - -#if INT_MAX == 0x7fff -typedef int krb5_int16; -typedef unsigned int krb5_ui_2; -#elif SHRT_MAX == 0x7fff -typedef short krb5_int16; -typedef unsigned short krb5_ui_2; -#else -#error undefined 16 bit type -#endif - -#if INT_MAX == 0x7fffffffL -typedef int krb5_int32; -typedef unsigned int krb5_ui_4; -#elif LONG_MAX == 0x7fffffffL -typedef long krb5_int32; -typedef unsigned long krb5_ui_4; -#elif SHRT_MAX == 0x7fffffffL -typedef short krb5_int32; -typedef unsigned short krb5_ui_4; -#else -#error: undefined 32 bit type -#endif +typedef uint8_t krb5_octet; +typedef int16_t krb5_int16; +typedef uint16_t krb5_ui_2; +typedef int32_t krb5_int32; +typedef uint32_t krb5_ui_4; #define VALID_INT_BITS INT_MAX #define VALID_UINT_BITS UINT_MAX diff --git a/src/lib/gssapi/generic/Makefile.in b/src/lib/gssapi/generic/Makefile.in index 40c6772856..c34cba4593 100644 --- a/src/lib/gssapi/generic/Makefile.in +++ b/src/lib/gssapi/generic/Makefile.in @@ -42,18 +42,12 @@ gssapi_err_generic.h: gssapi_err_generic.et gssapi_err_generic.c: gssapi_err_generic.et ##DOS##!if 0 -include_stdint=@include_stdint@ -include_inttypes=@include_inttypes@ include_xom=@include_xom@ -##DOS##include_stdint=rem -##DOS##include_inttypes=rem ##DOS##include_xom=rem gssapi.h: gssapi.hin @echo "Creating gssapi.h" ; \ h=gss$$$$; $(RM) $$h; \ (echo "/* This is the gssapi.h prologue. */"; \ - $(include_stdint) && \ - $(include_inttypes) && \ $(include_xom) && \ echo "/* End of gssapi.h prologue. */"&& \ cat $(srcdir)/gssapi.hin )> $$h && \ diff --git a/src/lib/gssapi/krb5/Makefile.in b/src/lib/gssapi/krb5/Makefile.in index 1e77ea85c6..342747868c 100644 --- a/src/lib/gssapi/krb5/Makefile.in +++ b/src/lib/gssapi/krb5/Makefile.in @@ -247,20 +247,8 @@ clean-windows:: generate-files-mac: gssapi_krb5.h error_map.h -##DOS##!if 0 -gssapi_krb5.h: gssapi_krb5.hin - @echo "Creating gssapi.h" ; \ - h=gss$$$$; $(RM) $$h; \ - (echo "/* This is the gssapi_krb5.h prologue. */"; \ - $(include_stdint) ; \ - echo "/* End of gssapi_krb5.h prologue. */"; \ - cat $(srcdir)/gssapi_krb5.hin )> $$h && \ - (set -x; $(MV) $$h $@) ; e=$$?; $(RM) $$h; exit $$e -##DOS##!endif -##DOS### No prologue needed for Windows, the support is -##DOS### in gssapi_krb5.hin already. -##DOS##gssapi_krb5.h: gssapi_krb5.hin -##DOS## $(CP) gssapi_krb5.hin gssapi_krb5.h +gssapi_krb5.h: $(srcdir)/gssapi_krb5.hin + $(CP) $(srcdir)/gssapi_krb5.hin $@ install-headers-unix install:: @set -x; for f in $(EXPORTED_HEADERS) ; \ diff --git a/src/lib/gssapi/krb5/gssapi_krb5.hin b/src/lib/gssapi/krb5/gssapi_krb5.hin index 9d124fa091..1271f27bb4 100644 --- a/src/lib/gssapi/krb5/gssapi_krb5.hin +++ b/src/lib/gssapi/krb5/gssapi_krb5.hin @@ -27,6 +27,7 @@ #include #include #include +#include /* C++ friendlyness */ #ifdef __cplusplus @@ -92,14 +93,7 @@ GSS_DLLIMP extern const gss_OID_desc krb5_gss_oid_array[]; #define gss_krb5_nt_machine_uid_name gss_nt_machine_uid_name #define gss_krb5_nt_string_uid_name gss_nt_string_uid_name - -#if defined(_WIN32) -typedef unsigned __int64 gss_uint64; -#else /*windows*/ -#include -typedef uint64_t gss_uint64; -#endif - +typedef uint64_t gss_uint64; typedef struct gss_krb5_lucid_key { OM_uint32 type; /* key encryption type */ diff --git a/src/plugins/kdb/db2/libdb2/include/db-int.h b/src/plugins/kdb/db2/libdb2/include/db-int.h index 8329ee3d05..0dcbf40b65 100644 --- a/src/plugins/kdb/db2/libdb2/include/db-int.h +++ b/src/plugins/kdb/db2/libdb2/include/db-int.h @@ -132,13 +132,7 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif -#ifdef HAVE_INTTYPES_H -/* Tru64 5.1: int8_t is defined here, and stdint.h doesn't exist. */ -#include -#endif #include #include #include diff --git a/src/util/profile/prof_init.c b/src/util/profile/prof_init.c index 4e3d84ee67..9845a18b54 100644 --- a/src/util/profile/prof_init.c +++ b/src/util/profile/prof_init.c @@ -13,12 +13,6 @@ #endif #include -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif typedef int32_t prof_int32; /* Create a vtable profile, possibly with a library handle. The new profile diff --git a/src/util/t_array.pm b/src/util/t_array.pm index 4a05ab866b..4f1f82b294 100644 --- a/src/util/t_array.pm +++ b/src/util/t_array.pm @@ -41,9 +41,7 @@ __DATA__ #include #include #include -#ifdef HAVE_STDINT_H -# include -#endif +#include struct __header { size_t allocated; -- cgit