config: rename the OS define to CURL_OS to reduce collision risk

Reported-by: Jon Rumsey
Fixes #15455
Closes #15457
This commit is contained in:
Daniel Stenberg 2024-10-30 14:00:16 +01:00
parent c0d2b9bee7
commit 0cececef0f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
19 changed files with 41 additions and 41 deletions

View File

@ -76,8 +76,8 @@ my %remove = (
'#define HAVE_ZSTD_H 1' => 1, '#define HAVE_ZSTD_H 1' => 1,
'#define LT_OBJDIR ".libs/"' => 1, '#define LT_OBJDIR ".libs/"' => 1,
'#define NEED_LBER_H 1' => 1, '#define NEED_LBER_H 1' => 1,
'#define OS "Linux"' => 1, '#define CURL_OS "Linux"' => 1,
'#define OS "x86_64-pc-linux-gnu"' => 1, '#define CURL_OS "x86_64-pc-linux-gnu"' => 1,
'#define PACKAGE "curl"' => 1, '#define PACKAGE "curl"' => 1,
'#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.se/mail/"' => 1, '#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.se/mail/"' => 1,
'#define PACKAGE_NAME "curl"' => 1, '#define PACKAGE_NAME "curl"' => 1,

View File

@ -135,9 +135,9 @@ if(CMAKE_CROSSCOMPILING)
endif() endif()
if(CMAKE_C_COMPILER_TARGET) if(CMAKE_C_COMPILER_TARGET)
set(OS "\"${CMAKE_C_COMPILER_TARGET}\"") set(CURL_OS "\"${CMAKE_C_COMPILER_TARGET}\"")
else() else()
set(OS "\"${CMAKE_SYSTEM_NAME}\"") set(CURL_OS "\"${CMAKE_SYSTEM_NAME}\"")
endif() endif()
include_directories("${PROJECT_SOURCE_DIR}/include") include_directories("${PROJECT_SOURCE_DIR}/include")

View File

@ -436,7 +436,7 @@ dnl
AC_CANONICAL_HOST AC_CANONICAL_HOST
dnl Get system canonical name 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 # Silence warning: ar: 'u' modifier ignored since 'D' is the default
AC_SUBST(AR_FLAGS, [cr]) AC_SUBST(AR_FLAGS, [cr])

View File

@ -71,8 +71,8 @@
#define USE_MANUAL 1 #define USE_MANUAL 1
#define CURL_DISABLE_LDAP 1 #define CURL_DISABLE_LDAP 1
#ifndef OS #ifndef CURL_OS
#define OS "AmigaOS" #define CURL_OS "AmigaOS"
#endif #endif
#define PACKAGE "curl" #define PACKAGE "curl"

View File

@ -29,13 +29,13 @@
/* lib/config-dos.h - Hand crafted config file for DOS */ /* lib/config-dos.h - Hand crafted config file for DOS */
/* ================================================================ */ /* ================================================================ */
#ifndef OS #ifndef CURL_OS
#if defined(DJGPP) #if defined(DJGPP)
#define OS "MSDOS/djgpp" #define CURL_OS "MSDOS/djgpp"
#elif defined(__HIGHC__) #elif defined(__HIGHC__)
#define OS "MSDOS/HighC" #define CURL_OS "MSDOS/HighC"
#else #else
#define OS "MSDOS/?" #define CURL_OS "MSDOS/?"
#endif #endif
#endif #endif

View File

@ -30,8 +30,8 @@
/* On macOS you must run configure to generate curl_config.h file */ /* On macOS you must run configure to generate curl_config.h file */
/* =================================================================== */ /* =================================================================== */
#ifndef OS #ifndef CURL_OS
#define OS "mac" #define CURL_OS "mac"
#endif #endif
#include <ConditionalMacros.h> #include <ConditionalMacros.h>

View File

@ -36,8 +36,8 @@
#undef VERSION #undef VERSION
/* Define cpu-machine-OS */ /* Define cpu-machine-OS */
#ifndef OS #ifndef CURL_OS
#define OS "OS/400" #define CURL_OS "OS/400"
#endif #endif
/* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its /* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its

View File

@ -32,8 +32,8 @@
#define CURL_DISABLE_LDAP 1 #define CURL_DISABLE_LDAP 1
#define NEED_REENTRANT 1 #define NEED_REENTRANT 1
#ifndef OS #ifndef CURL_OS
#define OS "plan9" #define CURL_OS "plan9"
#endif #endif
#define PACKAGE "curl" #define PACKAGE "curl"
#define PACKAGE_NAME "curl" #define PACKAGE_NAME "curl"

View File

@ -35,8 +35,8 @@
#undef VERSION #undef VERSION
/* Define cpu-machine-OS */ /* Define cpu-machine-OS */
#ifndef OS #ifndef CURL_OS
#define OS "ARM-RISC OS" #define CURL_OS "ARM-RISC OS"
#endif #endif
/* Define if you want the built-in manual */ /* Define if you want the built-in manual */

View File

@ -490,19 +490,19 @@ Vista
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define cpu-machine-OS */ /* Define cpu-machine-OS */
#ifndef OS #ifndef CURL_OS
#if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */ #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) */ #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 */ #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) */ #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) */ #elif defined(_M_ARM64) || defined(__aarch64__) /* ARM64 (Windows 10) */
#define OS "aarch64-pc-win32" #define CURL_OS "aarch64-pc-win32"
#else #else
#define OS "unknown-pc-win32" #define CURL_OS "unknown-pc-win32"
#endif #endif
#endif #endif

View File

@ -271,8 +271,8 @@
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Define cpu-machine-OS */ /* Define cpu-machine-OS */
#ifndef OS #ifndef CURL_OS
#define OS "i386-pc-win32ce" #define CURL_OS "i386-pc-win32ce"
#endif #endif
/* Name of package */ /* Name of package */

View File

@ -635,7 +635,7 @@
#cmakedefine NEED_REENTRANT 1 #cmakedefine NEED_REENTRANT 1
/* cpu-machine-OS */ /* cpu-machine-OS */
#cmakedefine OS ${OS} #cmakedefine CURL_OS ${CURL_OS}
/* Name of package */ /* Name of package */
#cmakedefine PACKAGE ${PACKAGE} #cmakedefine PACKAGE ${PACKAGE}

View File

@ -633,7 +633,7 @@ static CURLcode smb_send_setup(struct Curl_easy *data)
const size_t byte_count = sizeof(lm) + sizeof(nt) + const size_t byte_count = sizeof(lm) + sizeof(nt) +
strlen(smbc->user) + strlen(smbc->domain) + 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)) if(byte_count > sizeof(msg.bytes))
return CURLE_FILESIZE_EXCEEDED; return CURLE_FILESIZE_EXCEEDED;
@ -661,7 +661,7 @@ static CURLcode smb_send_setup(struct Curl_easy *data)
"%s%c" /* domain */ "%s%c" /* domain */
"%s%c" /* OS */ "%s%c" /* OS */
"%s", /* client name */ "%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 */ p++; /* count the final null termination */
DEBUGASSERT(byte_count == (size_t)(p - msg.bytes)); DEBUGASSERT(byte_count == (size_t)(p - msg.bytes));
msg.byte_count = smb_swap16((unsigned short)byte_count); msg.byte_count = smb_swap16((unsigned short)byte_count);

View File

@ -562,7 +562,7 @@ static curl_version_info_data version_info = {
CURLVERSION_NOW, CURLVERSION_NOW,
LIBCURL_VERSION, LIBCURL_VERSION,
LIBCURL_VERSION_NUM, 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 */ 0, /* features bitmask is built at runtime */
NULL, /* ssl_version */ NULL, /* ssl_version */
0, /* ssl_version_num, this is kept at zero */ 0, /* ssl_version_num, this is kept at zero */

View File

@ -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. $! may put DEC or COMPAQ or HP for the middle part.
$! $!
$write cvh "#if defined(__alpha)" $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 "#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 "#elif defined(__ia64)"
$write cvh "#define OS ""IA64-HP-VMS"" $write cvh "#define CURL_OS ""IA64-HP-VMS""
$write cvh "#else" $write cvh "#else"
$write cvh "#define OS ""UNKNOWN-HP-VMS"" $write cvh "#define CURL_OS ""UNKNOWN-HP-VMS""
$write cvh "#endif" $write cvh "#endif"
$write cvh "" $write cvh ""
$! $!

View File

@ -53,8 +53,8 @@ extern FILE *tool_stderr;
# define main(x,y) curl_main(x,y) # define main(x,y) curl_main(x,y)
#endif #endif
#ifndef OS #ifndef CURL_OS
# define OS "unknown" # define CURL_OS "unknown"
#endif #endif
#ifndef UNPRINTABLE_CHAR #ifndef UNPRINTABLE_CHAR

View File

@ -31,6 +31,6 @@
#define CURL_VERSION_MAJOR LIBCURL_VERSION_MAJOR #define CURL_VERSION_MAJOR LIBCURL_VERSION_MAJOR
#define CURL_VERSION_MINOR LIBCURL_VERSION_MINOR #define CURL_VERSION_MINOR LIBCURL_VERSION_MINOR
#define CURL_VERSION_PATCH LIBCURL_VERSION_PATCH #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 */ #endif /* HEADER_CURL_TOOL_VERSION_H */

View File

@ -245,7 +245,7 @@ sub get_host_triplet {
if(-f $configfile && -s $configfile && open(my $libconfigh, "<", "$configfile")) { if(-f $configfile && -s $configfile && open(my $libconfigh, "<", "$configfile")) {
while(<$libconfigh>) { while(<$libconfigh>) {
if($_ =~ /^\#define\s+OS\s+"*([^"][^"]*)"*\s*/) { if($_ =~ /^\#define\s+CURL_OS\s+"*([^"][^"]*)"*\s*/) {
$triplet = $1; $triplet = $1;
last; last;
} }

View File

@ -280,7 +280,7 @@ UNITTEST_START
enum system machine; enum system machine;
#ifdef HAVE_FNMATCH #ifdef HAVE_FNMATCH
if(strstr(OS, "apple") || strstr(OS, "darwin")) { if(strstr(CURL_OS, "apple") || strstr(CURL_OS, "darwin")) {
machine = SYSTEM_MACOS; machine = SYSTEM_MACOS;
} }
else else