diff --git a/configure.ac b/configure.ac index a58e266cf6..4edc33e231 100644 --- a/configure.ac +++ b/configure.ac @@ -3472,17 +3472,8 @@ AC_CHECK_TYPE(long long, longlong="yes" ) - if test ${ac_cv_sizeof_curl_off_t} -lt 8; then - AC_ARG_WITH(n64-deprecated,dnl -AS_HELP_STRING([--with-n64-deprecated],[confirm you realize support for systems without 64 bit data types is going away]), - if test X"$withval" != Xno; then - OPT_N64_AWARE=$withval - fi -) - if test -z "$OPT_N64_AWARE"; then - AC_MSG_ERROR([support for systems without 64 bit curl_off_t is deprecated, use --with-n64-deprecated until then]) - fi + AC_MSG_ERROR([64 bit curl_off_t is required]) fi # check for ssize_t diff --git a/docs/DEPRECATE.md b/docs/DEPRECATE.md index ac7c4d340f..5c9dd32d87 100644 --- a/docs/DEPRECATE.md +++ b/docs/DEPRECATE.md @@ -6,27 +6,6 @@ email the as soon as possible and explain to us why this is a problem for you and how your use case cannot be satisfied properly using a workaround. -## Support for systems without 64 bit data types - -curl will *require* support for a 64 bit data type (like `long long` or an -alternative) to build. These days, few systems are used where no such type is -around, so it is increasingly unnecessary to spend effort and time on -maintaining this support. Also, supporting 32 bit values for some of those -fields is complicated and hard to test. - -Adding this requirement will make the code simpler, easier to maintain and the -test coverage better. It is a low price too, since virtually no users are -still building curl on such systems. - -`long long` was not a standard type until C99, but has been supported by C89 -compilers since the 1990s. - -Starting in 8.0.0 (March 2023), the plan is to drop support. - -Starting in 7.86.0, building curl with configure requires the additional flag -`--with-n64-deprecated` if the `curl_off_t` type on your system is smaller -than 8 bytes, in an attempt to highlight these plans to affected users. - ## NSS We remove support for building curl with the NSS TLS library in August 2023. @@ -77,3 +56,4 @@ curl will remove the support for space-separated names in July 2024. - axTLS - PolarSSL - NPN + - Support for systems without 64 bit data types diff --git a/lib/curl_setup.h b/lib/curl_setup.h index a8cc71503e..76fccb81d6 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -441,8 +441,8 @@ # endif #endif -#if (SIZEOF_CURL_OFF_T == 4) -# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF) +#if (SIZEOF_CURL_OFF_T < 8) +#error "too small curl_off_t" #else /* assume SIZEOF_CURL_OFF_T == 8 */ # define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) diff --git a/lib/progress.c b/lib/progress.c index a2228888e6..6092b782c7 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -87,8 +87,6 @@ static char *max5data(curl_off_t bytes, char *max5) CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE, (bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) ); -#if (SIZEOF_CURL_OFF_T > 4) - else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE) /* 'XXXXM' is good until we're at 10000MB or above */ msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE); @@ -111,15 +109,8 @@ static char *max5data(curl_off_t bytes, char *max5) /* up to 10000PB, display without decimal: XXXXP */ msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "P", bytes/ONE_PETABYTE); - /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number - can hold, but our data type is signed so 8192PB will be the maximum. */ - -#else - - else - msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE); - -#endif + /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number can + hold, but our data type is signed so 8192PB will be the maximum. */ return max5; } diff --git a/lib/smb.c b/lib/smb.c index dc0abe784b..076200472e 100644 --- a/lib/smb.c +++ b/lib/smb.c @@ -25,8 +25,7 @@ #include "curl_setup.h" -#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \ - (SIZEOF_CURL_OFF_T > 4) +#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) #define BUILDING_CURL_SMB_C diff --git a/lib/version.c b/lib/version.c index a69e2ca571..eaf9e46842 100644 --- a/lib/version.c +++ b/lib/version.c @@ -357,8 +357,7 @@ static const char * const protocols[] = { #ifdef USE_SSH "sftp", #endif -#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \ - (SIZEOF_CURL_OFF_T > 4) +#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) "smb", # ifdef USE_SSL "smbs", diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c index 78528eb871..9b856f4cc2 100644 --- a/src/tool_cb_prg.c +++ b/src/tool_cb_prg.c @@ -116,8 +116,8 @@ static void fly(struct ProgressData *bar, bool moved) #define MAX_BARLENGTH 256 -#if (SIZEOF_CURL_OFF_T == 4) -# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF) +#if (SIZEOF_CURL_OFF_T < 8) +#error "too small curl_off_t" #else /* assume SIZEOF_CURL_OFF_T == 8 */ # define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) diff --git a/src/tool_filetime.c b/src/tool_filetime.c index 374599907d..937775cb8a 100644 --- a/src/tool_filetime.c +++ b/src/tool_filetime.c @@ -39,7 +39,7 @@ curl_off_t getfiletime(const char *filename, struct GlobalConfig *global) /* Windows stat() may attempt to adjust the unix GMT file time by a daylight saving time offset and since it's GMT that is bad behavior. When we have access to a 64-bit type we can bypass stat and get the times directly. */ -#if defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8) +#if defined(WIN32) HANDLE hfile; TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar((char *)filename); @@ -85,8 +85,7 @@ curl_off_t getfiletime(const char *filename, struct GlobalConfig *global) return result; } -#if defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \ - (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)) +#if defined(HAVE_UTIME) || defined(HAVE_UTIMES) || defined(WIN32) void setfiletime(curl_off_t filetime, const char *filename, struct GlobalConfig *global) { @@ -94,7 +93,7 @@ void setfiletime(curl_off_t filetime, const char *filename, /* Windows utime() may attempt to adjust the unix GMT file time by a daylight saving time offset and since it's GMT that is bad behavior. When we have access to a 64-bit type we can bypass utime and set the times directly. */ -#if defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8) +#if defined(WIN32) HANDLE hfile; TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar((char *)filename); @@ -151,5 +150,5 @@ void setfiletime(curl_off_t filetime, const char *filename, #endif } } -#endif /* defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \ - (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)) */ +#endif /* defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \ + defined(WIN32) */ diff --git a/src/tool_progress.c b/src/tool_progress.c index f0dd481a12..28edafe1e1 100644 --- a/src/tool_progress.c +++ b/src/tool_progress.c @@ -53,8 +53,6 @@ static char *max5data(curl_off_t bytes, char *max5) CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE, (bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) ); -#if (SIZEOF_CURL_OFF_T > 4) - else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE) /* 'XXXXM' is good until we're at 10000MB or above */ msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE); @@ -77,16 +75,8 @@ static char *max5data(curl_off_t bytes, char *max5) /* up to 10000PB, display without decimal: XXXXP */ msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "P", bytes/ONE_PETABYTE); - /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number - can hold, but our data type is signed so 8192PB will be the maximum. */ - -#else - - else - msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE); - -#endif - + /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number can + hold, but our data type is signed so 8192PB will be the maximum. */ return max5; } diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c index e1354f9411..409550aba1 100644 --- a/tests/libtest/lib557.c +++ b/tests/libtest/lib557.c @@ -1008,118 +1008,6 @@ static int test_curl_off_t_formatting(void) int num_cofft_tests = 0; int failed = 0; -#if (SIZEOF_CURL_OFF_T == 2) - - i = 1; co_test[i].num = MPRNT_OFF_T_C(0x7FFF); co_test[i].expected = "32767"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFE); co_test[i].expected = "32766"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFD); co_test[i].expected = "32765"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x7F00); co_test[i].expected = "32512"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x07F0); co_test[i].expected = "2032"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x007F); co_test[i].expected = "127"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x7000); co_test[i].expected = "28672"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x0700); co_test[i].expected = "1792"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x0070); co_test[i].expected = "112"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x0007); co_test[i].expected = "7"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x5000); co_test[i].expected = "20480"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x0500); co_test[i].expected = "1280"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x0050); co_test[i].expected = "80"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x0005); co_test[i].expected = "5"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x0001); co_test[i].expected = "1"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x0000); co_test[i].expected = "0"; - - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32768"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFE) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32767"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFD) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32766"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7F00) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32513"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x07F0) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2033"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x007F) -MPRNT_OFF_T_C(1); co_test[i].expected = "-128"; - - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-28673"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x0700) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1793"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x0070) -MPRNT_OFF_T_C(1); co_test[i].expected = "-113"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x0007) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8"; - - i++; co_test[i].num = -MPRNT_OFF_T_C(0x5000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-20481"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x0500) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1281"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x0050) -MPRNT_OFF_T_C(1); co_test[i].expected = "-81"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x0005) -MPRNT_OFF_T_C(1); co_test[i].expected = "-6"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x0000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1"; - - num_cofft_tests = i; - -#elif (SIZEOF_CURL_OFF_T == 4) - - i = 1; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFF); co_test[i].expected = "2147483647"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFE); co_test[i].expected = "2147483646"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFD); co_test[i].expected = "2147483645"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFF0000); co_test[i].expected = "2147418112"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00007FFF); co_test[i].expected = "32767"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x7F000000); co_test[i].expected = "2130706432"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x007F0000); co_test[i].expected = "8323072"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00007F00); co_test[i].expected = "32512"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x0000007F); co_test[i].expected = "127"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x70000000); co_test[i].expected = "1879048192"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x07000000); co_test[i].expected = "117440512"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00700000); co_test[i].expected = "7340032"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00070000); co_test[i].expected = "458752"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00007000); co_test[i].expected = "28672"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000700); co_test[i].expected = "1792"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000070); co_test[i].expected = "112"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000007); co_test[i].expected = "7"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x50000000); co_test[i].expected = "1342177280"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x05000000); co_test[i].expected = "83886080"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00500000); co_test[i].expected = "5242880"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00050000); co_test[i].expected = "327680"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00005000); co_test[i].expected = "20480"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000500); co_test[i].expected = "1280"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000050); co_test[i].expected = "80"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000005); co_test[i].expected = "5"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000001); co_test[i].expected = "1"; - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000000); co_test[i].expected = "0"; - - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147483648"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFE) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147483647"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFFFFFD) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147483646"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7FFF0000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2147418113"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00007FFF) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32768"; - - i++; co_test[i].num = -MPRNT_OFF_T_C(0x7F000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-2130706433"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x007F0000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8323073"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00007F00) -MPRNT_OFF_T_C(1); co_test[i].expected = "-32513"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x0000007F) -MPRNT_OFF_T_C(1); co_test[i].expected = "-128"; - - i++; co_test[i].num = -MPRNT_OFF_T_C(0x70000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1879048193"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x07000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-117440513"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00700000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-7340033"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00070000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-458753"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00007000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-28673"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000700) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1793"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000070) -MPRNT_OFF_T_C(1); co_test[i].expected = "-113"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000007) -MPRNT_OFF_T_C(1); co_test[i].expected = "-8"; - - i++; co_test[i].num = -MPRNT_OFF_T_C(0x50000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1342177281"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x05000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-83886081"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00500000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-5242881"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00050000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-327681"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00005000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-20481"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000500) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1281"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000050) -MPRNT_OFF_T_C(1); co_test[i].expected = "-81"; - i++; co_test[i].num = -MPRNT_OFF_T_C(0x00000005) -MPRNT_OFF_T_C(1); co_test[i].expected = "-6"; - - i++; co_test[i].num = MPRNT_OFF_T_C(0x00000000) -MPRNT_OFF_T_C(1); co_test[i].expected = "-1"; - - num_cofft_tests = i; - -#elif (SIZEOF_CURL_OFF_T == 8) - i = 1; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFF); co_test[i].expected = "9223372036854775807"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFE); co_test[i].expected = "9223372036854775806"; i++; co_test[i].num = MPRNT_OFF_T_C(0x7FFFFFFFFFFFFFFD); co_test[i].expected = "9223372036854775805"; @@ -1201,8 +1089,6 @@ static int test_curl_off_t_formatting(void) num_cofft_tests = i; -#endif - for(i = 1; i <= num_cofft_tests; i++) { for(j = 0; j