diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-08-12 15:54:06 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-08-17 10:26:53 +0200 |
commit | 80d9e35598d5e6029dc4c90bf3da885682936d2a (patch) | |
tree | 952d270ac713d7b9373d6020976a9dd9c0dbc421 | |
parent | c95eff4a11575a5973fad20619ff7ca3989316db (diff) |
system.h: remove all CURL_SIZEOF_* defines
... as they're not used externally and internally we check for the sizes
already in configure etc.
Closes #1767
-rwxr-xr-x | acinclude.m4 | 285 | ||||
-rwxr-xr-x | configure.ac | 17 | ||||
-rw-r--r-- | include/curl/system.h | 90 | ||||
-rw-r--r-- | lib/curl_setup.h | 9 | ||||
-rw-r--r-- | lib/mprintf.c | 4 | ||||
-rw-r--r-- | lib/strtoofft.c | 2 | ||||
-rw-r--r-- | lib/strtoofft.h | 2 | ||||
-rw-r--r-- | lib/warnless.c | 28 | ||||
-rw-r--r-- | src/tool_paramhlp.c | 2 |
9 files changed, 27 insertions, 412 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index dd5d896bc..957b9202f 100755 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2718,291 +2718,6 @@ AC_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the fi ]) - -dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE) -dnl ------------------------------------------------- -dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T - -AC_DEFUN([DO_CURL_OFF_T_CHECK], [ - AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl - if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$1"; then - tmp_includes="" - tmp_source="" - tmp_fmt="" - case XC_SH_TR_SH([$1]) in - int64_t) - tmp_includes="$curl_includes_inttypes" - tmp_source="char f@<:@@:>@ = PRId64;" - tmp_fmt="PRId64" - ;; - int32_t) - tmp_includes="$curl_includes_inttypes" - tmp_source="char f@<:@@:>@ = PRId32;" - tmp_fmt="PRId32" - ;; - int16_t) - tmp_includes="$curl_includes_inttypes" - tmp_source="char f@<:@@:>@ = PRId16;" - tmp_fmt="PRId16" - ;; - esac - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $tmp_includes - typedef $1 curl_off_t; - typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1]; - ]],[[ - $tmp_source - curl_off_t dummy; - ]]) - ],[ - if test -z "$tmp_fmt"; then - curl_typeof_curl_off_t="$1" - curl_sizeof_curl_off_t="$2" - else - CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent]) - AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl - AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl - if test AS_VAR_GET(tmp_HaveFmtDef) = "yes"; then - curl_format_curl_off_t=AS_VAR_GET(tmp_FmtDef) - curl_typeof_curl_off_t="$1" - curl_sizeof_curl_off_t="$2" - fi - AS_VAR_POPDEF([tmp_FmtDef])dnl - AS_VAR_POPDEF([tmp_HaveFmtDef])dnl - fi - ]) - fi -]) - - -dnl DO_CURL_OFF_T_SUFFIX_CHECK (TYPE) -dnl ------------------------------------------------- -dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T - -AC_DEFUN([DO_CURL_OFF_T_SUFFIX_CHECK], [ - AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl - AC_MSG_CHECKING([constant suffix string for curl_off_t]) - # - curl_suffix_curl_off_t="unknown" - curl_suffix_curl_off_tu="unknown" - # - case XC_SH_TR_SH([$1]) in - long_long | __longlong | __longlong_t) - tst_suffixes="LL::" - ;; - long) - tst_suffixes="L::" - ;; - int) - tst_suffixes="::" - ;; - __int64 | int64_t) - tst_suffixes="LL:i64::" - ;; - __int32 | int32_t) - tst_suffixes="L:i32::" - ;; - __int16 | int16_t) - tst_suffixes="L:i16::" - ;; - *) - AC_MSG_ERROR([unexpected data type $1]) - ;; - esac - # - old_IFS=$IFS; IFS=':' - for tmp_ssuf in $tst_suffixes ; do - IFS=$old_IFS - if test "x$curl_suffix_curl_off_t" = "xunknown"; then - case $tmp_ssuf in - i64 | i32 | i16) - tmp_usuf="u$tmp_ssuf" - ;; - LL | L) - tmp_usuf="U$tmp_ssuf" - ;; - *) - tmp_usuf="" - ;; - esac - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $curl_includes_inttypes - typedef $1 new_t; - ]],[[ - new_t s1; - new_t s2; - s1 = -10$tmp_ssuf ; - s2 = 20$tmp_ssuf ; - if(s1 > s2) - return 1; - ]]) - ],[ - curl_suffix_curl_off_t="$tmp_ssuf" - curl_suffix_curl_off_tu="$tmp_usuf" - ]) - fi - done - IFS=$old_IFS - # - if test "x$curl_suffix_curl_off_t" = "xunknown"; then - AC_MSG_ERROR([cannot find constant suffix string for curl_off_t.]) - else - AC_MSG_RESULT([$curl_suffix_curl_off_t]) - AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t]) - AC_MSG_RESULT([$curl_suffix_curl_off_tu]) - fi - # -]) - - -dnl CURL_CONFIGURE_CURL_OFF_T -dnl ------------------------------------------------- -dnl Find out suitable curl_off_t data type definition and associated -dnl items - -AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [ - AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl - # - AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl - AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl - AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl - # - if test -z "$SED"; then - AC_MSG_ERROR([SED not set. Cannot continue without SED being set.]) - fi - # - AC_CHECK_SIZEOF(long) - AC_CHECK_SIZEOF(void*) - # - 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 - if test -z "$ac_cv_sizeof_voidp" || - test "$ac_cv_sizeof_voidp" -eq "0"; then - AC_MSG_ERROR([cannot find out size of void*.]) - fi - # - x_LP64_long="" - x_LP32_long="" - # - if test "$ac_cv_sizeof_long" -eq "8" && - test "$ac_cv_sizeof_voidp" -ge "8"; then - x_LP64_long="long" - elif test "$ac_cv_sizeof_long" -eq "4" && - test "$ac_cv_sizeof_voidp" -ge "4"; then - x_LP32_long="long" - fi - # - dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars - # - curl_typeof_curl_off_t="unknown" - curl_sizeof_curl_off_t="unknown" - curl_format_curl_off_t="unknown" - curl_format_curl_off_tu="unknown" - # - if test "$curl_typeof_curl_off_t" = "unknown"; then - AC_MSG_CHECKING([for 64-bit curl_off_t data type]) - for t8 in \ - "$x_LP64_long" \ - 'int64_t' \ - '__int64' \ - 'long long' \ - '__longlong' \ - '__longlong_t' ; do - DO_CURL_OFF_T_CHECK([$t8], [8]) - done - AC_MSG_RESULT([$curl_typeof_curl_off_t]) - fi - if test "$curl_typeof_curl_off_t" = "unknown"; then - AC_MSG_CHECKING([for 32-bit curl_off_t data type]) - for t4 in \ - "$x_LP32_long" \ - 'int32_t' \ - '__int32' \ - 'int' ; do - DO_CURL_OFF_T_CHECK([$t4], [4]) - done - AC_MSG_RESULT([$curl_typeof_curl_off_t]) - fi - if test "$curl_typeof_curl_off_t" = "unknown"; then - AC_MSG_ERROR([cannot find data type for curl_off_t.]) - fi - # - AC_MSG_CHECKING([size of curl_off_t]) - AC_MSG_RESULT([$curl_sizeof_curl_off_t]) - # - AC_MSG_CHECKING([formatting string directive for curl_off_t]) - if test "$curl_format_curl_off_t" != "unknown"; then - x_pull_headers="yes" - curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/[["]]//g'` - curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'` - curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'` - curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'` - else - x_pull_headers="no" - case XC_SH_TR_SH([$curl_typeof_curl_off_t]) in - long_long | __longlong | __longlong_t) - curl_format_curl_off_t="lld" - curl_format_curl_off_tu="llu" - ;; - long) - curl_format_curl_off_t="ld" - curl_format_curl_off_tu="lu" - ;; - int) - curl_format_curl_off_t="d" - curl_format_curl_off_tu="u" - ;; - __int64) - curl_format_curl_off_t="I64d" - curl_format_curl_off_tu="I64u" - ;; - __int32) - curl_format_curl_off_t="I32d" - curl_format_curl_off_tu="I32u" - ;; - __int16) - curl_format_curl_off_t="I16d" - curl_format_curl_off_tu="I16u" - ;; - *) - AC_MSG_ERROR([cannot find print format string for curl_off_t.]) - ;; - esac - fi - AC_MSG_RESULT(["$curl_format_curl_off_t"]) - # - AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t]) - AC_MSG_RESULT(["$curl_format_curl_off_tu"]) - # - DO_CURL_OFF_T_SUFFIX_CHECK([$curl_typeof_curl_off_t]) - # - if test "$x_pull_headers" = "yes"; then - if test "x$ac_cv_header_sys_types_h" = "xyes"; then - CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H]) - fi - if test "x$ac_cv_header_stdint_h" = "xyes"; then - CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H]) - fi - if test "x$ac_cv_header_inttypes_h" = "xyes"; then - CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H]) - fi - fi - # - CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_OFF_T], [$curl_typeof_curl_off_t]) - CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_T], ["$curl_format_curl_off_t"]) - CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_TU], ["$curl_format_curl_off_tu"]) - CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$curl_format_curl_off_t"]) - CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$curl_sizeof_curl_off_t]) - CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$curl_suffix_curl_off_t]) - CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$curl_suffix_curl_off_tu]) - # -]) - - dnl CURL_CHECK_WIN32_LARGEFILE dnl ------------------------------------------------- dnl Check if curl's WIN32 large file will be used diff --git a/configure.ac b/configure.ac index 605abc3fd..a4633b69f 100755 --- a/configure.ac +++ b/configure.ac @@ -183,9 +183,6 @@ AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS]) dnl Checks for programs. -dnl Our curl_off_t internal and external configure settings -CURL_CONFIGURE_CURL_OFF_T - dnl This defines _ALL_SOURCE for AIX CURL_CHECK_AIX_ALL_SOURCE @@ -3163,14 +3160,14 @@ CURL_CONFIGURE_LONG AC_CHECK_SIZEOF(time_t) AC_CHECK_SIZEOF(off_t) -soname_bump=no -if test x"$curl_cv_native_windows" != "xyes" && - test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then - AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous]) - AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.]) - soname_bump=yes -fi +o=$CPPFLAGS +CPPFLAGS="$CPPFLAGS -I$srcdir/include" +AC_CHECK_SIZEOF(curl_off_t, unused , [ +#include <curl/system.h> +]) +CPPFLAGS=$o +soname_bump=no AC_CHECK_TYPE(long long, [AC_DEFINE(HAVE_LONGLONG, 1, diff --git a/include/curl/system.h b/include/curl/system.h index eabb6dfa8..043b88bb6 100644 --- a/include/curl/system.h +++ b/include/curl/system.h @@ -52,226 +52,171 @@ #if defined(__DJGPP__) || defined(__GO32__) # if defined(__DJGPP__) && (__DJGPP__ > 1) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # else -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__SALFORDC__) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__BORLANDC__) # if (__BORLANDC__ < 0x520) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # else -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T __int64 # define CURL_FORMAT_CURL_OFF_T "I64d" # define CURL_FORMAT_CURL_OFF_TU "I64u" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T i64 # define CURL_SUFFIX_CURL_OFF_TU ui64 # endif # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__TURBOC__) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__WATCOMC__) # if defined(__386__) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T __int64 # define CURL_FORMAT_CURL_OFF_T "I64d" # define CURL_FORMAT_CURL_OFF_TU "I64u" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T i64 # define CURL_SUFFIX_CURL_OFF_TU ui64 # else -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__POCC__) # if (__POCC__ < 280) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # elif defined(_MSC_VER) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T __int64 # define CURL_FORMAT_CURL_OFF_T "I64d" # define CURL_FORMAT_CURL_OFF_TU "I64u" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T i64 # define CURL_SUFFIX_CURL_OFF_TU ui64 # else -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__LCC__) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__SYMBIAN32__) # if defined(__EABI__) /* Treat all ARM compilers equally */ -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # elif defined(__CW32__) # pragma longlong on -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # elif defined(__VC32__) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T __int64 # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__MWERKS__) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(_WIN32_WCE) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T __int64 # define CURL_FORMAT_CURL_OFF_T "I64d" # define CURL_FORMAT_CURL_OFF_TU "I64u" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T i64 # define CURL_SUFFIX_CURL_OFF_TU ui64 # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__MINGW32__) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "I64d" # define CURL_FORMAT_CURL_OFF_TU "I64u" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 # define CURL_PULL_SYS_TYPES_H 1 # define CURL_PULL_WS2TCPIP_H 1 #elif defined(__VMS) # if defined(__VAX) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # else -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__OS400__) # if defined(__ILEC400__) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 # define CURL_PULL_SYS_TYPES_H 1 # define CURL_PULL_SYS_SOCKET_H 1 # endif @@ -279,34 +224,28 @@ #elif defined(__MVS__) # if defined(__IBMC__) || defined(__IBMCPP__) # if defined(_ILP32) -# define CURL_SIZEOF_LONG 4 # elif defined(_LP64) -# define CURL_SIZEOF_LONG 8 # endif # if defined(_LONG_LONG) # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # elif defined(_LP64) # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # else # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 # define CURL_PULL_SYS_TYPES_H 1 # define CURL_PULL_SYS_SOCKET_H 1 # endif @@ -314,56 +253,45 @@ #elif defined(__370__) # if defined(__IBMC__) || defined(__IBMCPP__) # if defined(_ILP32) -# define CURL_SIZEOF_LONG 4 # elif defined(_LP64) -# define CURL_SIZEOF_LONG 8 # endif # if defined(_LONG_LONG) # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # elif defined(_LP64) # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # else # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 # define CURL_PULL_SYS_TYPES_H 1 # define CURL_PULL_SYS_SOCKET_H 1 # endif #elif defined(TPF) -# define CURL_SIZEOF_LONG 8 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 #elif defined(__TINYC__) /* also known as tcc */ -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t @@ -373,25 +301,20 @@ #elif defined(__SUNPRO_C) /* Oracle Solaris Studio */ # if !defined(__LP64) && (defined(__ILP32) || \ defined(__i386) || defined(__sparcv8)) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # elif defined(__LP64) || \ defined(__amd64) || defined(__sparcv9) -# define CURL_SIZEOF_LONG 8 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 # define CURL_PULL_SYS_TYPES_H 1 # define CURL_PULL_SYS_SOCKET_H 1 @@ -401,24 +324,19 @@ #elif defined(_MSC_VER) # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T __int64 # define CURL_FORMAT_CURL_OFF_T "I64d" # define CURL_FORMAT_CURL_OFF_TU "I64u" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T i64 # define CURL_SUFFIX_CURL_OFF_TU ui64 # else -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T int -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 /* ===================================== */ /* KEEP GENERIC GCC THE LAST ENTRY */ @@ -431,34 +349,26 @@ defined(__sparc__) || defined(__mips__) || defined(__sh__) || \ defined(__XTENSA__) || \ (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4)) -# define CURL_SIZEOF_LONG 4 # define CURL_TYPEOF_CURL_OFF_T long long # define CURL_FORMAT_CURL_OFF_T "lld" # define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T LL # define CURL_SUFFIX_CURL_OFF_TU ULL # elif defined(__LP64__) || \ defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \ (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) -# define CURL_SIZEOF_LONG 8 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" -# define CURL_SIZEOF_CURL_OFF_T 8 # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # endif # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 # define CURL_PULL_SYS_TYPES_H 1 # define CURL_PULL_SYS_SOCKET_H 1 #else /* generic "safe guess" on old 32 bit style */ -# define CURL_SIZEOF_LONG 4 -# define CURL_SIZEOF_CURL_SOCKLEN_T 4 -# define CURL_SIZEOF_CURL_OFF_T 4 # define CURL_TYPEOF_CURL_OFF_T long # define CURL_FORMAT_CURL_OFF_T "ld" # define CURL_FORMAT_CURL_OFF_TU "lu" diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 95500beac..36d1e42bc 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -141,14 +141,7 @@ #include <curl/curl.h> -/* - * Ensure that no one is using the old SIZEOF_CURL_OFF_T macro - */ - -#ifdef SIZEOF_CURL_OFF_T -# error "SIZEOF_CURL_OFF_T shall not be defined!" - Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined -#endif +#define CURL_SIZEOF_CURL_OFF_T SIZEOF_CURL_OFF_T /* * Disable other protocols when http is the only one desired. diff --git a/lib/mprintf.c b/lib/mprintf.c index eb7ee0c6b..4e94b10ad 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -348,14 +348,14 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, case 'z': /* the code below generates a warning if -Wunreachable-code is used */ -#if (SIZEOF_SIZE_T > CURL_SIZEOF_LONG) +#if (SIZEOF_SIZE_T > SIZEOF_LONG) flags |= FLAGS_LONGLONG; #else flags |= FLAGS_LONG; #endif break; case 'O': -#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) +#if (CURL_SIZEOF_CURL_OFF_T > SIZEOF_LONG) flags |= FLAGS_LONGLONG; #else flags |= FLAGS_LONG; diff --git a/lib/strtoofft.c b/lib/strtoofft.c index f057bb1d6..5e800b4e3 100644 --- a/lib/strtoofft.c +++ b/lib/strtoofft.c @@ -33,7 +33,7 @@ * https://www.opengroup.org/onlinepubs/009695399/functions/strtoimax.html */ -#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) +#if (SIZEOF_CURL_OFF_T > SIZEOF_LONG) # ifdef HAVE_STRTOLL # define strtooff strtoll # else diff --git a/lib/strtoofft.h b/lib/strtoofft.h index ac1fa4aa4..244411a87 100644 --- a/lib/strtoofft.h +++ b/lib/strtoofft.h @@ -40,7 +40,7 @@ * of 'long' the conversion function to use is strtol(). */ -#if (CURL_SIZEOF_CURL_OFF_T == 4) +#if (SIZEOF_CURL_OFF_T == 4) # define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF) #else /* assume CURL_SIZEOF_CURL_OFF_T == 8 */ diff --git a/lib/warnless.c b/lib/warnless.c index fb085c86d..1b9fe7e17 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -69,32 +69,32 @@ # error "SIZEOF_INT not defined" #endif -#if (CURL_SIZEOF_LONG == 2) +#if (SIZEOF_LONG == 2) # define CURL_MASK_SLONG 0x7FFFL # define CURL_MASK_ULONG 0xFFFFUL -#elif (CURL_SIZEOF_LONG == 4) +#elif (SIZEOF_LONG == 4) # define CURL_MASK_SLONG 0x7FFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFUL -#elif (CURL_SIZEOF_LONG == 8) +#elif (SIZEOF_LONG == 8) # define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFUL -#elif (CURL_SIZEOF_LONG == 16) +#elif (SIZEOF_LONG == 16) # define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL #else # error "CURL_SIZEOF_LONG not defined" #endif -#if (CURL_SIZEOF_CURL_OFF_T == 2) +#if (SIZEOF_CURL_OFF_T == 2) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFF) -#elif (CURL_SIZEOF_CURL_OFF_T == 4) +#elif (SIZEOF_CURL_OFF_T == 4) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFF) -#elif (CURL_SIZEOF_CURL_OFF_T == 8) +#elif (SIZEOF_CURL_OFF_T == 8) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFF) -#elif (CURL_SIZEOF_CURL_OFF_T == 16) +#elif (SIZEOF_CURL_OFF_T == 16) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) #else @@ -107,10 +107,10 @@ #elif (SIZEOF_SIZE_T == SIZEOF_INT) # define CURL_MASK_SSIZE_T CURL_MASK_SINT # define CURL_MASK_USIZE_T CURL_MASK_UINT -#elif (SIZEOF_SIZE_T == CURL_SIZEOF_LONG) +#elif (SIZEOF_SIZE_T == SIZEOF_LONG) # define CURL_MASK_SSIZE_T CURL_MASK_SLONG # define CURL_MASK_USIZE_T CURL_MASK_ULONG -#elif (SIZEOF_SIZE_T == CURL_SIZEOF_CURL_OFF_T) +#elif (SIZEOF_SIZE_T == SIZEOF_CURL_OFF_T) # define CURL_MASK_SSIZE_T CURL_MASK_SCOFFT # define CURL_MASK_USIZE_T CURL_MASK_UCOFFT #else @@ -226,7 +226,7 @@ unsigned long curlx_uztoul(size_t uznum) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif -#if (CURL_SIZEOF_LONG < SIZEOF_SIZE_T) +#if (SIZEOF_LONG < SIZEOF_SIZE_T) DEBUGASSERT(uznum <= (size_t) CURL_MASK_ULONG); #endif return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG); @@ -269,7 +269,7 @@ int curlx_sltosi(long slnum) #endif DEBUGASSERT(slnum >= 0); -#if (SIZEOF_INT < CURL_SIZEOF_LONG) +#if (SIZEOF_INT < SIZEOF_LONG) DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_SINT); #endif return (int)(slnum & (long) CURL_MASK_SINT); @@ -291,7 +291,7 @@ unsigned int curlx_sltoui(long slnum) #endif DEBUGASSERT(slnum >= 0); -#if (SIZEOF_INT < CURL_SIZEOF_LONG) +#if (SIZEOF_INT < SIZEOF_LONG) DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_UINT); #endif return (unsigned int)(slnum & (long) CURL_MASK_UINT); diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 86a3fe6b0..80d47573f 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -399,7 +399,7 @@ ParameterError str2offset(curl_off_t *val, const char *str) /* offsets aren't negative, this indicates weird input */ return PARAM_NEGATIVE_NUMERIC; -#if(CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) +#if(SIZEOF_CURL_OFF_T > SIZEOF_LONG) { CURLofft offt = curlx_strtoofft(str, &endptr, 0, val); if(CURL_OFFT_FLOW == offt) |