]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Assume <stdint.h> and fixed-width types
authorGreg Hudson <ghudson@mit.edu>
Sat, 1 Feb 2014 20:20:08 +0000 (15:20 -0500)
committerGreg Hudson <ghudson@mit.edu>
Wed, 26 Feb 2014 21:15:19 +0000 (16:15 -0500)
Make unconditional use of <stdint.h> 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
src/include/gssrpc/types.hin
src/include/k5-platform.h
src/include/k5-plugin.h
src/include/krb5/krb5.hin
src/lib/gssapi/generic/Makefile.in
src/lib/gssapi/krb5/Makefile.in
src/lib/gssapi/krb5/gssapi_krb5.hin
src/plugins/kdb/db2/libdb2/include/db-int.h
src/util/profile/prof_init.c
src/util/t_array.pm

index 7dded28f22d106ba4dd03473e9fd000ac731c524..9bc4663d1a6f0fa5f9c83c2c8c2430b483193276 100644 (file)
@@ -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 <stdint.h>
-#elif defined(HAVE_INTTYPES_H)
-# include <inttypes.h>
-#endif
-])
 AC_CHECK_TYPES([struct cmsghdr, struct in_pktinfo, struct in6_pktinfo, struct sockaddr_storage], , , [
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -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 <stdint.h>\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 <inttypes.h>\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 <xom.h>\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 <sys/types.h>],
-      [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 <stdint.h>],
-      [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 <inttypes.h>],
-      [uint32_t i = 0;],
-      [krb5_cv_header_inttypes_h_uint32_t=yes],
-      [krb5_cv_header_inttypes_h_uint32_t=no])])
-GSSRPC__STDINT_H='/* #include <stdint.h> */'
-GSSRPC__INTTYPES_H='/* #include <inttypes.h> */'
-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 <stdint.h>'
-  else
-    if test $krb5_cv_header_inttypes_h_uint32_t = yes; then
-      GSSRPC__INTTYPES_H='#include <inttypes.h>'
-    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 <sys/types.h>
index 9d3301217dafbe93413556d4014dfeb2b5a8b313..022ab4fa90a77600f1e242c7bc1ea04f2e059da6 100644 (file)
 #include <netinet/in.h>
 
 #include <stdlib.h>
-
-/*
- * 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 <stdint.h>
 #include <limits.h>
 
 #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@
index 8f0ca9f31288599a72a68e838b5255bcaddc7936..537c8add5bed1a596a2dbb4efa2b27cd929b4bc0 100644 (file)
@@ -52,6 +52,7 @@
 #include <assert.h>
 #include <string.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -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 <stdint.h>
-# endif
-# ifdef HAVE_INTTYPES_H
-#  include <inttypes.h>
-# 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)
index 6ffbdbb716521e164e84cc22b8f5f61dd978d242..90809e168e9f452349ed173ab59607dc892f132d 100644 (file)
 #define KRB5_CALLCONV_C
 #endif
 
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#elif defined(HAVE_INTTYPES_H)
-# include <inttypes.h>
-#endif
-
 #include "k5-err.h"
 
 /*
index 8d7a650a2f7730ec9bb53a8333714dfb7c41a2fc..43b1f08c0006dc95e2a919221661efac62ef57ed 100644 (file)
@@ -92,6 +92,7 @@
 #include <stdlib.h>
 #include <limits.h>             /* for *_MAX */
 #include <stdarg.h>
+#include <stdint.h>
 
 #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
index 40c6772856842c9ae459d26114355324dff2e8c2..c34cba4593c5fe05a3e42ad143ac1fde3a989e8e 100644 (file)
@@ -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 && \
index 1e77ea85c6d5e1b8379783c5524945d1a333b257..342747868c99ee9ed0bbd33c07ad37ea23ce0db1 100644 (file)
@@ -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) ; \
index 9d124fa0917dc16532dc6f877c38f00cc40e15a4..1271f27bb41cbbb3a1d72912d513cf036cd0c2a9 100644 (file)
@@ -27,6 +27,7 @@
 #include <gssapi/gssapi.h>
 #include <gssapi/gssapi_ext.h>
 #include <krb5.h>
+#include <stdint.h>
 
 /* 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 <inttypes.h>
-typedef  uint64_t gss_uint64;
-#endif
-
+typedef uint64_t gss_uint64;
 
 typedef struct gss_krb5_lucid_key {
     OM_uint32       type;           /* key encryption type */
index 8329ee3d05d18f5cf7ca76d9e23cc8a7b221b7a5..0dcbf40b65dc750a20e5f7b031bfba271c7e51d7 100644 (file)
 #include <fcntl.h>
 #include <stdio.h>
 #include <errno.h>
-#ifdef HAVE_STDINT_H
 #include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-/* Tru64 5.1: int8_t is defined here, and stdint.h doesn't exist.  */
-#include <inttypes.h>
-#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
index 4e3d84ee67edc3589af2a497569eee1b759e61c0..9845a18b5438a8fbd01dd6d0d7459319686060bc 100644 (file)
 #endif
 #include <errno.h>
 
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
 typedef int32_t prof_int32;
 
 /* Create a vtable profile, possibly with a library handle.  The new profile
index 4a05ab866b0bb3a9d40d84c6825d583e0a750f0b..4f1f82b294ad7bf0155fa5981f678a6f759d0180 100644 (file)
@@ -41,9 +41,7 @@ __DATA__
 #include <errno.h>
 #include <limits.h>
 #include <string.h>
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
+#include <stdint.h>
 
 struct <NAME>__header {
     size_t allocated;