From: Daniel Stenberg Date: Wed, 30 Oct 2024 13:00:16 +0000 (+0100) Subject: config: rename the OS define to CURL_OS to reduce collision risk X-Git-Tag: curl-8_11_0~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0cececef0f70f9f349b185952bba6d387602bdd4;p=thirdparty%2Fcurl.git config: rename the OS define to CURL_OS to reduce collision risk Reported-by: Jon Rumsey Fixes #15455 Closes #15457 --- diff --git a/.github/scripts/cmp-config.pl b/.github/scripts/cmp-config.pl index cdc4f62778..c58e3a6dfd 100755 --- a/.github/scripts/cmp-config.pl +++ b/.github/scripts/cmp-config.pl @@ -76,8 +76,8 @@ my %remove = ( '#define HAVE_ZSTD_H 1' => 1, '#define LT_OBJDIR ".libs/"' => 1, '#define NEED_LBER_H 1' => 1, - '#define OS "Linux"' => 1, - '#define OS "x86_64-pc-linux-gnu"' => 1, + '#define CURL_OS "Linux"' => 1, + '#define CURL_OS "x86_64-pc-linux-gnu"' => 1, '#define PACKAGE "curl"' => 1, '#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.se/mail/"' => 1, '#define PACKAGE_NAME "curl"' => 1, diff --git a/CMakeLists.txt b/CMakeLists.txt index dc700046d5..796ce8ad62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,9 +135,9 @@ if(CMAKE_CROSSCOMPILING) endif() if(CMAKE_C_COMPILER_TARGET) - set(OS "\"${CMAKE_C_COMPILER_TARGET}\"") + set(CURL_OS "\"${CMAKE_C_COMPILER_TARGET}\"") else() - set(OS "\"${CMAKE_SYSTEM_NAME}\"") + set(CURL_OS "\"${CMAKE_SYSTEM_NAME}\"") endif() include_directories("${PROJECT_SOURCE_DIR}/include") diff --git a/configure.ac b/configure.ac index 1632470744..58ce834eda 100644 --- a/configure.ac +++ b/configure.ac @@ -436,7 +436,7 @@ dnl AC_CANONICAL_HOST dnl Get system canonical name -AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS]) +AC_DEFINE_UNQUOTED(CURL_OS, "${host}", [cpu-machine-OS]) # Silence warning: ar: 'u' modifier ignored since 'D' is the default AC_SUBST(AR_FLAGS, [cr]) diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h index d168b446b6..11e5999493 100644 --- a/lib/config-amigaos.h +++ b/lib/config-amigaos.h @@ -71,8 +71,8 @@ #define USE_MANUAL 1 #define CURL_DISABLE_LDAP 1 -#ifndef OS -#define OS "AmigaOS" +#ifndef CURL_OS +#define CURL_OS "AmigaOS" #endif #define PACKAGE "curl" diff --git a/lib/config-dos.h b/lib/config-dos.h index c6fbba796a..4e9724726e 100644 --- a/lib/config-dos.h +++ b/lib/config-dos.h @@ -29,13 +29,13 @@ /* lib/config-dos.h - Hand crafted config file for DOS */ /* ================================================================ */ -#ifndef OS +#ifndef CURL_OS #if defined(DJGPP) - #define OS "MSDOS/djgpp" + #define CURL_OS "MSDOS/djgpp" #elif defined(__HIGHC__) - #define OS "MSDOS/HighC" + #define CURL_OS "MSDOS/HighC" #else - #define OS "MSDOS/?" + #define CURL_OS "MSDOS/?" #endif #endif diff --git a/lib/config-mac.h b/lib/config-mac.h index 53df87cbbc..8d6210c77e 100644 --- a/lib/config-mac.h +++ b/lib/config-mac.h @@ -30,8 +30,8 @@ /* On macOS you must run configure to generate curl_config.h file */ /* =================================================================== */ -#ifndef OS -#define OS "mac" +#ifndef CURL_OS +#define CURL_OS "mac" #endif #include diff --git a/lib/config-os400.h b/lib/config-os400.h index 29aa818fbc..88259d95f4 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -36,8 +36,8 @@ #undef VERSION /* Define cpu-machine-OS */ -#ifndef OS -#define OS "OS/400" +#ifndef CURL_OS +#define CURL_OS "OS/400" #endif /* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its diff --git a/lib/config-plan9.h b/lib/config-plan9.h index 1270e108dd..699291a1ed 100644 --- a/lib/config-plan9.h +++ b/lib/config-plan9.h @@ -32,8 +32,8 @@ #define CURL_DISABLE_LDAP 1 #define NEED_REENTRANT 1 -#ifndef OS -#define OS "plan9" +#ifndef CURL_OS +#define CURL_OS "plan9" #endif #define PACKAGE "curl" #define PACKAGE_NAME "curl" diff --git a/lib/config-riscos.h b/lib/config-riscos.h index 580e822e51..35b28cc534 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -35,8 +35,8 @@ #undef VERSION /* Define cpu-machine-OS */ -#ifndef OS -#define OS "ARM-RISC OS" +#ifndef CURL_OS +#define CURL_OS "ARM-RISC OS" #endif /* Define if you want the built-in manual */ diff --git a/lib/config-win32.h b/lib/config-win32.h index c8fdf6df09..e6abf06215 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -490,19 +490,19 @@ Vista /* ---------------------------------------------------------------- */ /* Define cpu-machine-OS */ -#ifndef OS +#ifndef CURL_OS #if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */ -#define OS "i386-pc-win32" +#define CURL_OS "i386-pc-win32" #elif defined(_M_X64) || defined(__x86_64__) /* x86_64 (MSVC >=2005 or gcc) */ -#define OS "x86_64-pc-win32" +#define CURL_OS "x86_64-pc-win32" #elif defined(_M_IA64) || defined(__ia64__) /* Itanium */ -#define OS "ia64-pc-win32" +#define CURL_OS "ia64-pc-win32" #elif defined(_M_ARM_NT) || defined(__arm__) /* ARMv7-Thumb2 (Windows RT) */ -#define OS "thumbv7a-pc-win32" +#define CURL_OS "thumbv7a-pc-win32" #elif defined(_M_ARM64) || defined(__aarch64__) /* ARM64 (Windows 10) */ -#define OS "aarch64-pc-win32" +#define CURL_OS "aarch64-pc-win32" #else -#define OS "unknown-pc-win32" +#define CURL_OS "unknown-pc-win32" #endif #endif diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h index 800fc61cf1..80765f1f65 100644 --- a/lib/config-win32ce.h +++ b/lib/config-win32ce.h @@ -271,8 +271,8 @@ /* ---------------------------------------------------------------- */ /* Define cpu-machine-OS */ -#ifndef OS -#define OS "i386-pc-win32ce" +#ifndef CURL_OS +#define CURL_OS "i386-pc-win32ce" #endif /* Name of package */ diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index 1e4b9813af..32a8208b68 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -635,7 +635,7 @@ #cmakedefine NEED_REENTRANT 1 /* cpu-machine-OS */ -#cmakedefine OS ${OS} +#cmakedefine CURL_OS ${CURL_OS} /* Name of package */ #cmakedefine PACKAGE ${PACKAGE} diff --git a/lib/smb.c b/lib/smb.c index 2cd2deff64..a242fc5c2a 100644 --- a/lib/smb.c +++ b/lib/smb.c @@ -633,7 +633,7 @@ static CURLcode smb_send_setup(struct Curl_easy *data) const size_t byte_count = sizeof(lm) + sizeof(nt) + strlen(smbc->user) + strlen(smbc->domain) + - strlen(OS) + strlen(CLIENTNAME) + 4; /* 4 null chars */ + strlen(CURL_OS) + strlen(CLIENTNAME) + 4; /* 4 null chars */ if(byte_count > sizeof(msg.bytes)) return CURLE_FILESIZE_EXCEEDED; @@ -661,7 +661,7 @@ static CURLcode smb_send_setup(struct Curl_easy *data) "%s%c" /* domain */ "%s%c" /* OS */ "%s", /* client name */ - smbc->user, 0, smbc->domain, 0, OS, 0, CLIENTNAME); + smbc->user, 0, smbc->domain, 0, CURL_OS, 0, CLIENTNAME); p++; /* count the final null termination */ DEBUGASSERT(byte_count == (size_t)(p - msg.bytes)); msg.byte_count = smb_swap16((unsigned short)byte_count); diff --git a/lib/version.c b/lib/version.c index 96bcaf29a4..8e1226ed70 100644 --- a/lib/version.c +++ b/lib/version.c @@ -562,7 +562,7 @@ static curl_version_info_data version_info = { CURLVERSION_NOW, LIBCURL_VERSION, LIBCURL_VERSION_NUM, - OS, /* as found by configure or set by hand at build-time */ + CURL_OS, /* as found by configure or set by hand at build-time */ 0, /* features bitmask is built at runtime */ NULL, /* ssl_version */ 0, /* ssl_version_num, this is kept at zero */ diff --git a/packages/vms/generate_config_vms_h_curl.com b/packages/vms/generate_config_vms_h_curl.com index 623cd5fe73..81ede597ea 100644 --- a/packages/vms/generate_config_vms_h_curl.com +++ b/packages/vms/generate_config_vms_h_curl.com @@ -203,13 +203,13 @@ $! Now the DCL builds usually say xxx-HP-VMS and configure scripts $! may put DEC or COMPAQ or HP for the middle part. $! $write cvh "#if defined(__alpha)" -$write cvh "#define OS ""ALPHA-HP-VMS""" +$write cvh "#define CURL_OS ""ALPHA-HP-VMS""" $write cvh "#elif defined(__vax)" -$write cvh "#define OS ""VAX-HP-VMS""" +$write cvh "#define CURL_OS ""VAX-HP-VMS""" $write cvh "#elif defined(__ia64)" -$write cvh "#define OS ""IA64-HP-VMS"" +$write cvh "#define CURL_OS ""IA64-HP-VMS"" $write cvh "#else" -$write cvh "#define OS ""UNKNOWN-HP-VMS"" +$write cvh "#define CURL_OS ""UNKNOWN-HP-VMS"" $write cvh "#endif" $write cvh "" $! diff --git a/src/tool_setup.h b/src/tool_setup.h index 07cba7da2e..82eb6e5a0b 100644 --- a/src/tool_setup.h +++ b/src/tool_setup.h @@ -53,8 +53,8 @@ extern FILE *tool_stderr; # define main(x,y) curl_main(x,y) #endif -#ifndef OS -# define OS "unknown" +#ifndef CURL_OS +# define CURL_OS "unknown" #endif #ifndef UNPRINTABLE_CHAR diff --git a/src/tool_version.h b/src/tool_version.h index 7ca5061814..00be7799ea 100644 --- a/src/tool_version.h +++ b/src/tool_version.h @@ -31,6 +31,6 @@ #define CURL_VERSION_MAJOR LIBCURL_VERSION_MAJOR #define CURL_VERSION_MINOR LIBCURL_VERSION_MINOR #define CURL_VERSION_PATCH LIBCURL_VERSION_PATCH -#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") " +#define CURL_ID CURL_NAME " " CURL_VERSION " (" CURL_OS ") " #endif /* HEADER_CURL_TOOL_VERSION_H */ diff --git a/tests/testcurl.pl b/tests/testcurl.pl index dfb0c19769..29dd813c2f 100755 --- a/tests/testcurl.pl +++ b/tests/testcurl.pl @@ -245,7 +245,7 @@ sub get_host_triplet { if(-f $configfile && -s $configfile && open(my $libconfigh, "<", "$configfile")) { while(<$libconfigh>) { - if($_ =~ /^\#define\s+OS\s+"*([^"][^"]*)"*\s*/) { + if($_ =~ /^\#define\s+CURL_OS\s+"*([^"][^"]*)"*\s*/) { $triplet = $1; last; } diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c index 440b390602..203cdd2ee3 100644 --- a/tests/unit/unit1307.c +++ b/tests/unit/unit1307.c @@ -280,7 +280,7 @@ UNITTEST_START enum system machine; #ifdef HAVE_FNMATCH - if(strstr(OS, "apple") || strstr(OS, "darwin")) { + if(strstr(CURL_OS, "apple") || strstr(CURL_OS, "darwin")) { machine = SYSTEM_MACOS; } else