Do not use sized constants in public headers
authorJakub Hrozek <jhrozek@redhat.com>
Wed, 16 Jun 2010 09:28:49 +0000 (11:28 +0200)
committerJakub Hrozek <jhrozek@redhat.com>
Tue, 14 Jun 2011 14:41:29 +0000 (16:41 +0200)
acinclude.m4
ares_build.h.in
ares_rules.h
configure.ac

index 9606131..fbee3c3 100644 (file)
@@ -1749,23 +1749,6 @@ _EOF
 ])
 
 
-dnl CARES_CONFIGURE_LONG
-dnl -------------------------------------------------
-dnl Find out the size of long as reported by sizeof() and define
-dnl CARES_SIZEOF_LONG as appropriate to be used in template file
-dnl ares_build.h.in to properly configure the library.
-dnl The size of long is a build time characteristic and as such
-dnl must be recorded in ares_build.h
-
-AC_DEFUN([CARES_CONFIGURE_LONG], [
-  if test -z "$ac_cv_sizeof_long" ||
-    test "$ac_cv_sizeof_long" -eq "0"; then
-    AC_MSG_ERROR([cannot find out size of long.])
-  fi
-  CARES_DEFINE_UNQUOTED([CARES_SIZEOF_LONG], [$ac_cv_sizeof_long])
-])
-
-
 dnl CARES_CONFIGURE_ARES_SOCKLEN_T
 dnl -------------------------------------------------
 dnl Find out suitable ares_socklen_t data type definition and size, making
@@ -1887,7 +1870,6 @@ AC_DEFUN([CARES_CONFIGURE_ARES_SOCKLEN_T], [
       ;;
   esac
   CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [$cares_typeof_ares_socklen_t])
-  CARES_DEFINE_UNQUOTED([CARES_SIZEOF_ARES_SOCKLEN_T], [$cares_sizeof_ares_socklen_t])
 ])
 
 
index 227782c..e582523 100644 (file)
 /*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */
 /* ================================================================ */
 
-#ifdef CARES_SIZEOF_LONG
-#  error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
-   Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
-#endif
-
 #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
 #  error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
    Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
 #endif
 
-#ifdef CARES_SIZEOF_ARES_SOCKLEN_T
-#  error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
-   Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
-#endif
-
 /* ================================================================ */
 /*  EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY  */
 /* ================================================================ */
 #  include <sys/socket.h>
 #endif
 
-/* The size of `long', as computed by sizeof. */
-#undef CARES_SIZEOF_LONG
-
 /* Integral data type used for ares_socklen_t. */
 #undef CARES_TYPEOF_ARES_SOCKLEN_T
 
-/* The size of `ares_socklen_t', as computed by sizeof. */
-#undef CARES_SIZEOF_ARES_SOCKLEN_T
-
 /* Data type definition of ares_socklen_t. */
 typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
 
index f94c5b5..334af51 100644 (file)
  * Verify that some macros are actually defined.
  */
 
-#ifndef CARES_SIZEOF_LONG
-#  error "CARES_SIZEOF_LONG definition is missing!"
-   Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing
-#endif
-
 #ifndef CARES_TYPEOF_ARES_SOCKLEN_T
 #  error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
    Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
 #endif
 
-#ifndef CARES_SIZEOF_ARES_SOCKLEN_T
-#  error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!"
-   Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing
-#endif
-
 /*
  * Macros private to this header file.
  */
 #define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
 
 /*
- * Verify that the size previously defined and expected for long
- * is the same as the one reported by sizeof() at compile time.
- */
-
-typedef char
-  __cares_rule_01__
-    [CareschkszEQ(long, CARES_SIZEOF_LONG)];
-
-/*
- * Verify that the size previously defined and expected for
- * ares_socklen_t is actually the the same as the one reported
- * by sizeof() at compile time.
- */
-
-typedef char
-  __cares_rule_02__
-    [CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)];
-
-/*
  * Verify at compile time that the size of ares_socklen_t as reported
  * by sizeof() is greater or equal than the one reported for int for
  * the current compilation.
index 730f8ff..f8a02af 100644 (file)
@@ -462,7 +462,6 @@ CURL_CHECK_STRUCT_TIMEVAL
 AC_CHECK_SIZEOF(size_t)
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
-CARES_CONFIGURE_LONG
 AC_CHECK_SIZEOF(time_t)
 
 AC_CHECK_TYPE(long long,