From 06a068d5ac936eb9bd8abe94a68486520ee0c3cc Mon Sep 17 00:00:00 2001 From: Aleksandar Fabijanic Date: Tue, 2 Apr 2024 16:36:06 -0500 Subject: [PATCH] 3857 os tid (#4519) * fix(Thread_POSIX): Thread_POSIX.cpp shouldn't convert thread IDs to long #3857; FreeBSD build errors fixes * chore(StreamTokenizerTest): fix warnings * fix(build): FreeBSD config * fix(ThreadTest): some tests checking nothing; temporatily comment FreeBSD threadStackSize test (segfaults on pthread_join) * fix(Thread_POSIX): handle emscripten in currentOsTidImpl * chore: fix emscripten define * chore: fix some clang warnings; add sanitizer flag to FreeBSD linux compat build config --- .gitignore | 4 + Foundation/include/Poco/Thread.h | 5 +- Foundation/src/Latin9Encoding.cpp | 23 +- Foundation/src/Thread_POSIX.cpp | 39 +-- Foundation/src/Windows1250Encoding.cpp | 153 ++++++------ Foundation/src/Windows1251Encoding.cpp | 233 +++++++++--------- Foundation/src/Windows1252Encoding.cpp | 61 ++--- .../testsuite/src/StreamTokenizerTest.cpp | 8 +- Foundation/testsuite/src/ThreadTest.cpp | 39 +-- build/config/FreeBSD | 15 +- build/config/FreeBSD-Linux-compat | 15 +- 11 files changed, 317 insertions(+), 278 deletions(-) diff --git a/.gitignore b/.gitignore index bfccd1eb5..d5b8c13fe 100644 --- a/.gitignore +++ b/.gitignore @@ -163,3 +163,7 @@ node_modules *_vs1[45]0.sln *_vs1[45]0.vcxproj *_vs1[45]0.vcxproj.filters + +# Debug files # +############## +*.core diff --git a/Foundation/include/Poco/Thread.h b/Foundation/include/Poco/Thread.h index 56f45e561..00d3da09e 100644 --- a/Foundation/include/Poco/Thread.h +++ b/Foundation/include/Poco/Thread.h @@ -72,7 +72,7 @@ public: Thread(uint32_t sigMask = 0); /// Creates a thread. Call start() to start it. - /// + /// /// The optional sigMask parameter specifies which signals should be blocked. /// To block a specific signal, set the corresponding bit in the sigMask. /// Multiple bits can be set in the mask to block multiple signals if needed. @@ -81,7 +81,7 @@ public: Thread(const std::string& name, uint32_t sigMask = 0); /// Creates a named thread. Call start() to start it. - /// + /// /// The optional sigMask parameter specifies which signals should be blocked. /// To block a specific signal, set the corresponding bit in the sigMask. /// Multiple bits can be set in the mask to block multiple signals if needed. @@ -243,6 +243,7 @@ public: static long currentOsTid(); /// Returns the operating system specific thread ID for the current thread. + /// On error, or if the platform does not support this functionality, it returns zero. bool setAffinity(int coreId); /// Sets the thread affinity to the coreID. diff --git a/Foundation/src/Latin9Encoding.cpp b/Foundation/src/Latin9Encoding.cpp index 3f403540a..bb33b48db 100644 --- a/Foundation/src/Latin9Encoding.cpp +++ b/Foundation/src/Latin9Encoding.cpp @@ -97,17 +97,20 @@ int Latin9Encoding::convert(int ch, unsigned char* bytes, int length) const *bytes = ch; return 1; } - else switch (ch) + else { - case 0x0152: if (bytes && length >= 1) *bytes = 0xbc; return 1; - case 0x0153: if (bytes && length >= 1) *bytes = 0xbd; return 1; - case 0x0160: if (bytes && length >= 1) *bytes = 0xa6; return 1; - case 0x0161: if (bytes && length >= 1) *bytes = 0xa8; return 1; - case 0x017d: if (bytes && length >= 1) *bytes = 0xb4; return 1; - case 0x017e: if (bytes && length >= 1) *bytes = 0xb8; return 1; - case 0x0178: if (bytes && length >= 1) *bytes = 0xbe; return 1; - case 0x20ac: if (bytes && length >= 1) *bytes = 0xa4; return 1; - default: return 0; + switch (ch) + { + case 0x0152: if (bytes && length >= 1) *bytes = 0xbc; return 1; + case 0x0153: if (bytes && length >= 1) *bytes = 0xbd; return 1; + case 0x0160: if (bytes && length >= 1) *bytes = 0xa6; return 1; + case 0x0161: if (bytes && length >= 1) *bytes = 0xa8; return 1; + case 0x017d: if (bytes && length >= 1) *bytes = 0xb4; return 1; + case 0x017e: if (bytes && length >= 1) *bytes = 0xb8; return 1; + case 0x0178: if (bytes && length >= 1) *bytes = 0xbe; return 1; + case 0x20ac: if (bytes && length >= 1) *bytes = 0xa4; return 1; + default: return 0; + } } } diff --git a/Foundation/src/Thread_POSIX.cpp b/Foundation/src/Thread_POSIX.cpp index 0cc89cb18..6b06ca98e 100644 --- a/Foundation/src/Thread_POSIX.cpp +++ b/Foundation/src/Thread_POSIX.cpp @@ -21,6 +21,7 @@ #include "Poco/Timestamp.h" #include "Poco/Format.h" #include +#include #if POCO_OS == POCO_OS_FREE_BSD # include @@ -37,7 +38,7 @@ # include #endif -#if POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_ANDROID || POCO_OS == POCO_OS_FREE_BSD +#if POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_ANDROID # include #endif @@ -88,7 +89,7 @@ namespace /// Sets thread name. Support for this feature varies /// on platforms. Any errors are ignored. { -#if ((POCO_OS == POCO_OS_FREE_BSD) && (__FreeBSD_version < 1300000)) +#if (POCO_OS == POCO_OS_FREE_BSD) pthread_setname_np(pthread_self(), truncName(threadName).c_str()); #elif (POCO_OS == POCO_OS_MAC_OS_X) #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED @@ -106,7 +107,7 @@ namespace std::string getThreadName() { char name[POCO_MAX_THREAD_NAME_LEN + 1]{'\0'}; -#if ((POCO_OS == POCO_OS_FREE_BSD) && (__FreeBSD_version < 1300000)) +#if (POCO_OS == POCO_OS_FREE_BSD) pthread_getname_np(pthread_self(), name, POCO_MAX_THREAD_NAME_LEN + 1); #elif (POCO_OS == POCO_OS_MAC_OS_X) #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED @@ -335,10 +336,16 @@ void ThreadImpl::joinImpl() { if (!_pData->started) return; _pData->done.wait(); - void* result; - if (pthread_join(_pData->thread, &result)) - throw SystemException("cannot join thread"); - _pData->joined = true; + if (!_pData->joined) + { + int errorCode; + if ((errorCode = pthread_join(_pData->thread, nullptr))) + { + throw SystemException(Poco::format("cannot join thread (%s)", + Error::getMessage(errorCode))); + } + _pData->joined = true; + } } @@ -370,21 +377,15 @@ ThreadImpl::TIDImpl ThreadImpl::currentTidImpl() long ThreadImpl::currentOsTidImpl() { -#if defined(POCO_EMSCRIPTEN) - return ::pthread_self(); -#elif POCO_OS == POCO_OS_LINUX - return ::syscall(SYS_gettid); + long id = 0; +#if (POCO_OS == POCO_OS_LINUX) && !defined(POCO_EMSCRIPTEN) + id = ::syscall(SYS_gettid); #elif POCO_OS == POCO_OS_MAC_OS_X - return ::pthread_mach_thread_np(::pthread_self()); + id = ::pthread_mach_thread_np(::pthread_self()); #elif POCO_OS == POCO_OS_FREE_BSD - long id; - if(thr_self(&id) < 0) { - return 0; - } - return id; -#else - return ::pthread_self(); + if (0 != thr_self(&id)) id = 0; #endif + return id; } diff --git a/Foundation/src/Windows1250Encoding.cpp b/Foundation/src/Windows1250Encoding.cpp index 764d9e897..03c8d8ed6 100644 --- a/Foundation/src/Windows1250Encoding.cpp +++ b/Foundation/src/Windows1250Encoding.cpp @@ -98,82 +98,85 @@ int Windows1250Encoding::convert(int ch, unsigned char* bytes, int length) const *bytes = (unsigned char) ch; return 1; } - else switch(ch) + else { - case 0x20ac: if (bytes && length >= 1) *bytes = 0x80; return 1; - case 0x201a: if (bytes && length >= 1) *bytes = 0x82; return 1; - case 0x201e: if (bytes && length >= 1) *bytes = 0x84; return 1; - case 0x2026: if (bytes && length >= 1) *bytes = 0x85; return 1; - case 0x2020: if (bytes && length >= 1) *bytes = 0x86; return 1; - case 0x2021: if (bytes && length >= 1) *bytes = 0x87; return 1; - case 0x2030: if (bytes && length >= 1) *bytes = 0x89; return 1; - case 0x0160: if (bytes && length >= 1) *bytes = 0x8a; return 1; - case 0x2039: if (bytes && length >= 1) *bytes = 0x8b; return 1; - case 0x015a: if (bytes && length >= 1) *bytes = 0x8c; return 1; - case 0x0164: if (bytes && length >= 1) *bytes = 0x8d; return 1; - case 0x017d: if (bytes && length >= 1) *bytes = 0x8e; return 1; - case 0x0179: if (bytes && length >= 1) *bytes = 0x8f; return 1; - case 0x2018: if (bytes && length >= 1) *bytes = 0x91; return 1; - case 0x2019: if (bytes && length >= 1) *bytes = 0x92; return 1; - case 0x201c: if (bytes && length >= 1) *bytes = 0x93; return 1; - case 0x201d: if (bytes && length >= 1) *bytes = 0x94; return 1; - case 0x2022: if (bytes && length >= 1) *bytes = 0x95; return 1; - case 0x2013: if (bytes && length >= 1) *bytes = 0x96; return 1; - case 0x2014: if (bytes && length >= 1) *bytes = 0x97; return 1; - case 0x2122: if (bytes && length >= 1) *bytes = 0x99; return 1; - case 0x0161: if (bytes && length >= 1) *bytes = 0x9a; return 1; - case 0x203a: if (bytes && length >= 1) *bytes = 0x9b; return 1; - case 0x015b: if (bytes && length >= 1) *bytes = 0x9c; return 1; - case 0x0165: if (bytes && length >= 1) *bytes = 0x9d; return 1; - case 0x017e: if (bytes && length >= 1) *bytes = 0x9e; return 1; - case 0x017a: if (bytes && length >= 1) *bytes = 0x9f; return 1; - case 0x02c7: if (bytes && length >= 1) *bytes = 0xa1; return 1; - case 0x02d8: if (bytes && length >= 1) *bytes = 0xa2; return 1; - case 0x0141: if (bytes && length >= 1) *bytes = 0xa3; return 1; - case 0x0104: if (bytes && length >= 1) *bytes = 0xa5; return 1; - case 0x015e: if (bytes && length >= 1) *bytes = 0xaa; return 1; - case 0x017b: if (bytes && length >= 1) *bytes = 0xaf; return 1; - case 0x02db: if (bytes && length >= 1) *bytes = 0xb2; return 1; - case 0x0142: if (bytes && length >= 1) *bytes = 0xb3; return 1; - case 0x0105: if (bytes && length >= 1) *bytes = 0xb9; return 1; - case 0x015f: if (bytes && length >= 1) *bytes = 0xba; return 1; - case 0x013d: if (bytes && length >= 1) *bytes = 0xbc; return 1; - case 0x02dd: if (bytes && length >= 1) *bytes = 0xbd; return 1; - case 0x013e: if (bytes && length >= 1) *bytes = 0xbe; return 1; - case 0x017c: if (bytes && length >= 1) *bytes = 0xbf; return 1; - case 0x0154: if (bytes && length >= 1) *bytes = 0xc0; return 1; - case 0x0102: if (bytes && length >= 1) *bytes = 0xc3; return 1; - case 0x0139: if (bytes && length >= 1) *bytes = 0xc5; return 1; - case 0x0106: if (bytes && length >= 1) *bytes = 0xc6; return 1; - case 0x010c: if (bytes && length >= 1) *bytes = 0xc8; return 1; - case 0x0118: if (bytes && length >= 1) *bytes = 0xca; return 1; - case 0x011a: if (bytes && length >= 1) *bytes = 0xcc; return 1; - case 0x010e: if (bytes && length >= 1) *bytes = 0xcf; return 1; - case 0x0110: if (bytes && length >= 1) *bytes = 0xd0; return 1; - case 0x0143: if (bytes && length >= 1) *bytes = 0xd1; return 1; - case 0x0147: if (bytes && length >= 1) *bytes = 0xd2; return 1; - case 0x0150: if (bytes && length >= 1) *bytes = 0xd5; return 1; - case 0x0158: if (bytes && length >= 1) *bytes = 0xd8; return 1; - case 0x016e: if (bytes && length >= 1) *bytes = 0xd9; return 1; - case 0x0170: if (bytes && length >= 1) *bytes = 0xdb; return 1; - case 0x0162: if (bytes && length >= 1) *bytes = 0xde; return 1; - case 0x0155: if (bytes && length >= 1) *bytes = 0xe0; return 1; - case 0x0103: if (bytes && length >= 1) *bytes = 0xe3; return 1; - case 0x013a: if (bytes && length >= 1) *bytes = 0xe5; return 1; - case 0x0107: if (bytes && length >= 1) *bytes = 0xe6; return 1; - case 0x010d: if (bytes && length >= 1) *bytes = 0xe8; return 1; - case 0x0119: if (bytes && length >= 1) *bytes = 0xea; return 1; - case 0x011b: if (bytes && length >= 1) *bytes = 0xec; return 1; - case 0x010f: if (bytes && length >= 1) *bytes = 0xef; return 1; - case 0x0111: if (bytes && length >= 1) *bytes = 0xf0; return 1; - case 0x0144: if (bytes && length >= 1) *bytes = 0xf1; return 1; - case 0x0148: if (bytes && length >= 1) *bytes = 0xf2; return 1; - case 0x0151: if (bytes && length >= 1) *bytes = 0xf5; return 1; - case 0x0159: if (bytes && length >= 1) *bytes = 0xf8; return 1; - case 0x016f: if (bytes && length >= 1) *bytes = 0xf9; return 1; - case 0x0171: if (bytes && length >= 1) *bytes = 0xfb; return 1; - case 0x0163: if (bytes && length >= 1) *bytes = 0xfe; return 1; - default: return 0; + switch(ch) + { + case 0x20ac: if (bytes && length >= 1) *bytes = 0x80; return 1; + case 0x201a: if (bytes && length >= 1) *bytes = 0x82; return 1; + case 0x201e: if (bytes && length >= 1) *bytes = 0x84; return 1; + case 0x2026: if (bytes && length >= 1) *bytes = 0x85; return 1; + case 0x2020: if (bytes && length >= 1) *bytes = 0x86; return 1; + case 0x2021: if (bytes && length >= 1) *bytes = 0x87; return 1; + case 0x2030: if (bytes && length >= 1) *bytes = 0x89; return 1; + case 0x0160: if (bytes && length >= 1) *bytes = 0x8a; return 1; + case 0x2039: if (bytes && length >= 1) *bytes = 0x8b; return 1; + case 0x015a: if (bytes && length >= 1) *bytes = 0x8c; return 1; + case 0x0164: if (bytes && length >= 1) *bytes = 0x8d; return 1; + case 0x017d: if (bytes && length >= 1) *bytes = 0x8e; return 1; + case 0x0179: if (bytes && length >= 1) *bytes = 0x8f; return 1; + case 0x2018: if (bytes && length >= 1) *bytes = 0x91; return 1; + case 0x2019: if (bytes && length >= 1) *bytes = 0x92; return 1; + case 0x201c: if (bytes && length >= 1) *bytes = 0x93; return 1; + case 0x201d: if (bytes && length >= 1) *bytes = 0x94; return 1; + case 0x2022: if (bytes && length >= 1) *bytes = 0x95; return 1; + case 0x2013: if (bytes && length >= 1) *bytes = 0x96; return 1; + case 0x2014: if (bytes && length >= 1) *bytes = 0x97; return 1; + case 0x2122: if (bytes && length >= 1) *bytes = 0x99; return 1; + case 0x0161: if (bytes && length >= 1) *bytes = 0x9a; return 1; + case 0x203a: if (bytes && length >= 1) *bytes = 0x9b; return 1; + case 0x015b: if (bytes && length >= 1) *bytes = 0x9c; return 1; + case 0x0165: if (bytes && length >= 1) *bytes = 0x9d; return 1; + case 0x017e: if (bytes && length >= 1) *bytes = 0x9e; return 1; + case 0x017a: if (bytes && length >= 1) *bytes = 0x9f; return 1; + case 0x02c7: if (bytes && length >= 1) *bytes = 0xa1; return 1; + case 0x02d8: if (bytes && length >= 1) *bytes = 0xa2; return 1; + case 0x0141: if (bytes && length >= 1) *bytes = 0xa3; return 1; + case 0x0104: if (bytes && length >= 1) *bytes = 0xa5; return 1; + case 0x015e: if (bytes && length >= 1) *bytes = 0xaa; return 1; + case 0x017b: if (bytes && length >= 1) *bytes = 0xaf; return 1; + case 0x02db: if (bytes && length >= 1) *bytes = 0xb2; return 1; + case 0x0142: if (bytes && length >= 1) *bytes = 0xb3; return 1; + case 0x0105: if (bytes && length >= 1) *bytes = 0xb9; return 1; + case 0x015f: if (bytes && length >= 1) *bytes = 0xba; return 1; + case 0x013d: if (bytes && length >= 1) *bytes = 0xbc; return 1; + case 0x02dd: if (bytes && length >= 1) *bytes = 0xbd; return 1; + case 0x013e: if (bytes && length >= 1) *bytes = 0xbe; return 1; + case 0x017c: if (bytes && length >= 1) *bytes = 0xbf; return 1; + case 0x0154: if (bytes && length >= 1) *bytes = 0xc0; return 1; + case 0x0102: if (bytes && length >= 1) *bytes = 0xc3; return 1; + case 0x0139: if (bytes && length >= 1) *bytes = 0xc5; return 1; + case 0x0106: if (bytes && length >= 1) *bytes = 0xc6; return 1; + case 0x010c: if (bytes && length >= 1) *bytes = 0xc8; return 1; + case 0x0118: if (bytes && length >= 1) *bytes = 0xca; return 1; + case 0x011a: if (bytes && length >= 1) *bytes = 0xcc; return 1; + case 0x010e: if (bytes && length >= 1) *bytes = 0xcf; return 1; + case 0x0110: if (bytes && length >= 1) *bytes = 0xd0; return 1; + case 0x0143: if (bytes && length >= 1) *bytes = 0xd1; return 1; + case 0x0147: if (bytes && length >= 1) *bytes = 0xd2; return 1; + case 0x0150: if (bytes && length >= 1) *bytes = 0xd5; return 1; + case 0x0158: if (bytes && length >= 1) *bytes = 0xd8; return 1; + case 0x016e: if (bytes && length >= 1) *bytes = 0xd9; return 1; + case 0x0170: if (bytes && length >= 1) *bytes = 0xdb; return 1; + case 0x0162: if (bytes && length >= 1) *bytes = 0xde; return 1; + case 0x0155: if (bytes && length >= 1) *bytes = 0xe0; return 1; + case 0x0103: if (bytes && length >= 1) *bytes = 0xe3; return 1; + case 0x013a: if (bytes && length >= 1) *bytes = 0xe5; return 1; + case 0x0107: if (bytes && length >= 1) *bytes = 0xe6; return 1; + case 0x010d: if (bytes && length >= 1) *bytes = 0xe8; return 1; + case 0x0119: if (bytes && length >= 1) *bytes = 0xea; return 1; + case 0x011b: if (bytes && length >= 1) *bytes = 0xec; return 1; + case 0x010f: if (bytes && length >= 1) *bytes = 0xef; return 1; + case 0x0111: if (bytes && length >= 1) *bytes = 0xf0; return 1; + case 0x0144: if (bytes && length >= 1) *bytes = 0xf1; return 1; + case 0x0148: if (bytes && length >= 1) *bytes = 0xf2; return 1; + case 0x0151: if (bytes && length >= 1) *bytes = 0xf5; return 1; + case 0x0159: if (bytes && length >= 1) *bytes = 0xf8; return 1; + case 0x016f: if (bytes && length >= 1) *bytes = 0xf9; return 1; + case 0x0171: if (bytes && length >= 1) *bytes = 0xfb; return 1; + case 0x0163: if (bytes && length >= 1) *bytes = 0xfe; return 1; + default: return 0; + } } } diff --git a/Foundation/src/Windows1251Encoding.cpp b/Foundation/src/Windows1251Encoding.cpp index 0da8ce065..f0bfd5260 100644 --- a/Foundation/src/Windows1251Encoding.cpp +++ b/Foundation/src/Windows1251Encoding.cpp @@ -98,122 +98,125 @@ int Windows1251Encoding::convert(int ch, unsigned char* bytes, int length) const *bytes = (unsigned char) ch; return 1; } - else switch(ch) + else { - case 0x0402: if (bytes && length >= 1) *bytes = 0x80; return 1; - case 0x0403: if (bytes && length >= 1) *bytes = 0x81; return 1; - case 0x201a: if (bytes && length >= 1) *bytes = 0x82; return 1; - case 0x0453: if (bytes && length >= 1) *bytes = 0x83; return 1; - case 0x201e: if (bytes && length >= 1) *bytes = 0x84; return 1; - case 0x2026: if (bytes && length >= 1) *bytes = 0x85; return 1; - case 0x2020: if (bytes && length >= 1) *bytes = 0x86; return 1; - case 0x2021: if (bytes && length >= 1) *bytes = 0x87; return 1; - case 0x20ac: if (bytes && length >= 1) *bytes = 0x88; return 1; - case 0x2030: if (bytes && length >= 1) *bytes = 0x89; return 1; - case 0x0409: if (bytes && length >= 1) *bytes = 0x8a; return 1; - case 0x2039: if (bytes && length >= 1) *bytes = 0x8b; return 1; - case 0x040a: if (bytes && length >= 1) *bytes = 0x8c; return 1; - case 0x040c: if (bytes && length >= 1) *bytes = 0x8d; return 1; - case 0x040b: if (bytes && length >= 1) *bytes = 0x8e; return 1; - case 0x040f: if (bytes && length >= 1) *bytes = 0x8f; return 1; - case 0x0452: if (bytes && length >= 1) *bytes = 0x90; return 1; - case 0x2018: if (bytes && length >= 1) *bytes = 0x91; return 1; - case 0x2019: if (bytes && length >= 1) *bytes = 0x92; return 1; - case 0x201c: if (bytes && length >= 1) *bytes = 0x93; return 1; - case 0x201d: if (bytes && length >= 1) *bytes = 0x94; return 1; - case 0x2022: if (bytes && length >= 1) *bytes = 0x95; return 1; - case 0x2013: if (bytes && length >= 1) *bytes = 0x96; return 1; - case 0x2014: if (bytes && length >= 1) *bytes = 0x97; return 1; - case 0xfffe: if (bytes && length >= 1) *bytes = 0x98; return 1; - case 0x2122: if (bytes && length >= 1) *bytes = 0x99; return 1; - case 0x0459: if (bytes && length >= 1) *bytes = 0x9a; return 1; - case 0x203a: if (bytes && length >= 1) *bytes = 0x9b; return 1; - case 0x045a: if (bytes && length >= 1) *bytes = 0x9c; return 1; - case 0x045c: if (bytes && length >= 1) *bytes = 0x9d; return 1; - case 0x045b: if (bytes && length >= 1) *bytes = 0x9e; return 1; - case 0x045f: if (bytes && length >= 1) *bytes = 0x9f; return 1; - case 0x040e: if (bytes && length >= 1) *bytes = 0xa1; return 1; - case 0x045e: if (bytes && length >= 1) *bytes = 0xa2; return 1; - case 0x0408: if (bytes && length >= 1) *bytes = 0xa3; return 1; - case 0x0490: if (bytes && length >= 1) *bytes = 0xa5; return 1; - case 0x0401: if (bytes && length >= 1) *bytes = 0xa8; return 1; - case 0x0404: if (bytes && length >= 1) *bytes = 0xaa; return 1; - case 0x0407: if (bytes && length >= 1) *bytes = 0xaf; return 1; - case 0x0406: if (bytes && length >= 1) *bytes = 0xb2; return 1; - case 0x0456: if (bytes && length >= 1) *bytes = 0xb3; return 1; - case 0x0491: if (bytes && length >= 1) *bytes = 0xb4; return 1; - case 0x0451: if (bytes && length >= 1) *bytes = 0xb8; return 1; - case 0x2116: if (bytes && length >= 1) *bytes = 0xb9; return 1; - case 0x0454: if (bytes && length >= 1) *bytes = 0xba; return 1; - case 0x0458: if (bytes && length >= 1) *bytes = 0xbc; return 1; - case 0x0405: if (bytes && length >= 1) *bytes = 0xbd; return 1; - case 0x0455: if (bytes && length >= 1) *bytes = 0xbe; return 1; - case 0x0457: if (bytes && length >= 1) *bytes = 0xbf; return 1; - case 0x0410: if (bytes && length >= 1) *bytes = 0xc0; return 1; - case 0x0411: if (bytes && length >= 1) *bytes = 0xc1; return 1; - case 0x0412: if (bytes && length >= 1) *bytes = 0xc2; return 1; - case 0x0413: if (bytes && length >= 1) *bytes = 0xc3; return 1; - case 0x0414: if (bytes && length >= 1) *bytes = 0xc4; return 1; - case 0x0415: if (bytes && length >= 1) *bytes = 0xc5; return 1; - case 0x0416: if (bytes && length >= 1) *bytes = 0xc6; return 1; - case 0x0417: if (bytes && length >= 1) *bytes = 0xc7; return 1; - case 0x0418: if (bytes && length >= 1) *bytes = 0xc8; return 1; - case 0x0419: if (bytes && length >= 1) *bytes = 0xc9; return 1; - case 0x041a: if (bytes && length >= 1) *bytes = 0xca; return 1; - case 0x041b: if (bytes && length >= 1) *bytes = 0xcb; return 1; - case 0x041c: if (bytes && length >= 1) *bytes = 0xcc; return 1; - case 0x041d: if (bytes && length >= 1) *bytes = 0xcd; return 1; - case 0x041e: if (bytes && length >= 1) *bytes = 0xce; return 1; - case 0x041f: if (bytes && length >= 1) *bytes = 0xcf; return 1; - case 0x0420: if (bytes && length >= 1) *bytes = 0xd0; return 1; - case 0x0421: if (bytes && length >= 1) *bytes = 0xd1; return 1; - case 0x0422: if (bytes && length >= 1) *bytes = 0xd2; return 1; - case 0x0423: if (bytes && length >= 1) *bytes = 0xd3; return 1; - case 0x0424: if (bytes && length >= 1) *bytes = 0xd4; return 1; - case 0x0425: if (bytes && length >= 1) *bytes = 0xd5; return 1; - case 0x0426: if (bytes && length >= 1) *bytes = 0xd6; return 1; - case 0x0427: if (bytes && length >= 1) *bytes = 0xd7; return 1; - case 0x0428: if (bytes && length >= 1) *bytes = 0xd8; return 1; - case 0x0429: if (bytes && length >= 1) *bytes = 0xd9; return 1; - case 0x042a: if (bytes && length >= 1) *bytes = 0xda; return 1; - case 0x042b: if (bytes && length >= 1) *bytes = 0xdb; return 1; - case 0x042c: if (bytes && length >= 1) *bytes = 0xdc; return 1; - case 0x042d: if (bytes && length >= 1) *bytes = 0xdd; return 1; - case 0x042e: if (bytes && length >= 1) *bytes = 0xde; return 1; - case 0x042f: if (bytes && length >= 1) *bytes = 0xdf; return 1; - case 0x0430: if (bytes && length >= 1) *bytes = 0xe0; return 1; - case 0x0431: if (bytes && length >= 1) *bytes = 0xe1; return 1; - case 0x0432: if (bytes && length >= 1) *bytes = 0xe2; return 1; - case 0x0433: if (bytes && length >= 1) *bytes = 0xe3; return 1; - case 0x0434: if (bytes && length >= 1) *bytes = 0xe4; return 1; - case 0x0435: if (bytes && length >= 1) *bytes = 0xe5; return 1; - case 0x0436: if (bytes && length >= 1) *bytes = 0xe6; return 1; - case 0x0437: if (bytes && length >= 1) *bytes = 0xe7; return 1; - case 0x0438: if (bytes && length >= 1) *bytes = 0xe8; return 1; - case 0x0439: if (bytes && length >= 1) *bytes = 0xe9; return 1; - case 0x043a: if (bytes && length >= 1) *bytes = 0xea; return 1; - case 0x043b: if (bytes && length >= 1) *bytes = 0xeb; return 1; - case 0x043c: if (bytes && length >= 1) *bytes = 0xec; return 1; - case 0x043d: if (bytes && length >= 1) *bytes = 0xed; return 1; - case 0x043e: if (bytes && length >= 1) *bytes = 0xee; return 1; - case 0x043f: if (bytes && length >= 1) *bytes = 0xef; return 1; - case 0x0440: if (bytes && length >= 1) *bytes = 0xf0; return 1; - case 0x0441: if (bytes && length >= 1) *bytes = 0xf1; return 1; - case 0x0442: if (bytes && length >= 1) *bytes = 0xf2; return 1; - case 0x0443: if (bytes && length >= 1) *bytes = 0xf3; return 1; - case 0x0444: if (bytes && length >= 1) *bytes = 0xf4; return 1; - case 0x0445: if (bytes && length >= 1) *bytes = 0xf5; return 1; - case 0x0446: if (bytes && length >= 1) *bytes = 0xf6; return 1; - case 0x0447: if (bytes && length >= 1) *bytes = 0xf7; return 1; - case 0x0448: if (bytes && length >= 1) *bytes = 0xf8; return 1; - case 0x0449: if (bytes && length >= 1) *bytes = 0xf9; return 1; - case 0x044a: if (bytes && length >= 1) *bytes = 0xfa; return 1; - case 0x044b: if (bytes && length >= 1) *bytes = 0xfb; return 1; - case 0x044c: if (bytes && length >= 1) *bytes = 0xfc; return 1; - case 0x044d: if (bytes && length >= 1) *bytes = 0xfd; return 1; - case 0x044e: if (bytes && length >= 1) *bytes = 0xfe; return 1; - case 0x044f: if (bytes && length >= 1) *bytes = 0xff; return 1; - default: return 0; + switch(ch) + { + case 0x0402: if (bytes && length >= 1) *bytes = 0x80; return 1; + case 0x0403: if (bytes && length >= 1) *bytes = 0x81; return 1; + case 0x201a: if (bytes && length >= 1) *bytes = 0x82; return 1; + case 0x0453: if (bytes && length >= 1) *bytes = 0x83; return 1; + case 0x201e: if (bytes && length >= 1) *bytes = 0x84; return 1; + case 0x2026: if (bytes && length >= 1) *bytes = 0x85; return 1; + case 0x2020: if (bytes && length >= 1) *bytes = 0x86; return 1; + case 0x2021: if (bytes && length >= 1) *bytes = 0x87; return 1; + case 0x20ac: if (bytes && length >= 1) *bytes = 0x88; return 1; + case 0x2030: if (bytes && length >= 1) *bytes = 0x89; return 1; + case 0x0409: if (bytes && length >= 1) *bytes = 0x8a; return 1; + case 0x2039: if (bytes && length >= 1) *bytes = 0x8b; return 1; + case 0x040a: if (bytes && length >= 1) *bytes = 0x8c; return 1; + case 0x040c: if (bytes && length >= 1) *bytes = 0x8d; return 1; + case 0x040b: if (bytes && length >= 1) *bytes = 0x8e; return 1; + case 0x040f: if (bytes && length >= 1) *bytes = 0x8f; return 1; + case 0x0452: if (bytes && length >= 1) *bytes = 0x90; return 1; + case 0x2018: if (bytes && length >= 1) *bytes = 0x91; return 1; + case 0x2019: if (bytes && length >= 1) *bytes = 0x92; return 1; + case 0x201c: if (bytes && length >= 1) *bytes = 0x93; return 1; + case 0x201d: if (bytes && length >= 1) *bytes = 0x94; return 1; + case 0x2022: if (bytes && length >= 1) *bytes = 0x95; return 1; + case 0x2013: if (bytes && length >= 1) *bytes = 0x96; return 1; + case 0x2014: if (bytes && length >= 1) *bytes = 0x97; return 1; + case 0xfffe: if (bytes && length >= 1) *bytes = 0x98; return 1; + case 0x2122: if (bytes && length >= 1) *bytes = 0x99; return 1; + case 0x0459: if (bytes && length >= 1) *bytes = 0x9a; return 1; + case 0x203a: if (bytes && length >= 1) *bytes = 0x9b; return 1; + case 0x045a: if (bytes && length >= 1) *bytes = 0x9c; return 1; + case 0x045c: if (bytes && length >= 1) *bytes = 0x9d; return 1; + case 0x045b: if (bytes && length >= 1) *bytes = 0x9e; return 1; + case 0x045f: if (bytes && length >= 1) *bytes = 0x9f; return 1; + case 0x040e: if (bytes && length >= 1) *bytes = 0xa1; return 1; + case 0x045e: if (bytes && length >= 1) *bytes = 0xa2; return 1; + case 0x0408: if (bytes && length >= 1) *bytes = 0xa3; return 1; + case 0x0490: if (bytes && length >= 1) *bytes = 0xa5; return 1; + case 0x0401: if (bytes && length >= 1) *bytes = 0xa8; return 1; + case 0x0404: if (bytes && length >= 1) *bytes = 0xaa; return 1; + case 0x0407: if (bytes && length >= 1) *bytes = 0xaf; return 1; + case 0x0406: if (bytes && length >= 1) *bytes = 0xb2; return 1; + case 0x0456: if (bytes && length >= 1) *bytes = 0xb3; return 1; + case 0x0491: if (bytes && length >= 1) *bytes = 0xb4; return 1; + case 0x0451: if (bytes && length >= 1) *bytes = 0xb8; return 1; + case 0x2116: if (bytes && length >= 1) *bytes = 0xb9; return 1; + case 0x0454: if (bytes && length >= 1) *bytes = 0xba; return 1; + case 0x0458: if (bytes && length >= 1) *bytes = 0xbc; return 1; + case 0x0405: if (bytes && length >= 1) *bytes = 0xbd; return 1; + case 0x0455: if (bytes && length >= 1) *bytes = 0xbe; return 1; + case 0x0457: if (bytes && length >= 1) *bytes = 0xbf; return 1; + case 0x0410: if (bytes && length >= 1) *bytes = 0xc0; return 1; + case 0x0411: if (bytes && length >= 1) *bytes = 0xc1; return 1; + case 0x0412: if (bytes && length >= 1) *bytes = 0xc2; return 1; + case 0x0413: if (bytes && length >= 1) *bytes = 0xc3; return 1; + case 0x0414: if (bytes && length >= 1) *bytes = 0xc4; return 1; + case 0x0415: if (bytes && length >= 1) *bytes = 0xc5; return 1; + case 0x0416: if (bytes && length >= 1) *bytes = 0xc6; return 1; + case 0x0417: if (bytes && length >= 1) *bytes = 0xc7; return 1; + case 0x0418: if (bytes && length >= 1) *bytes = 0xc8; return 1; + case 0x0419: if (bytes && length >= 1) *bytes = 0xc9; return 1; + case 0x041a: if (bytes && length >= 1) *bytes = 0xca; return 1; + case 0x041b: if (bytes && length >= 1) *bytes = 0xcb; return 1; + case 0x041c: if (bytes && length >= 1) *bytes = 0xcc; return 1; + case 0x041d: if (bytes && length >= 1) *bytes = 0xcd; return 1; + case 0x041e: if (bytes && length >= 1) *bytes = 0xce; return 1; + case 0x041f: if (bytes && length >= 1) *bytes = 0xcf; return 1; + case 0x0420: if (bytes && length >= 1) *bytes = 0xd0; return 1; + case 0x0421: if (bytes && length >= 1) *bytes = 0xd1; return 1; + case 0x0422: if (bytes && length >= 1) *bytes = 0xd2; return 1; + case 0x0423: if (bytes && length >= 1) *bytes = 0xd3; return 1; + case 0x0424: if (bytes && length >= 1) *bytes = 0xd4; return 1; + case 0x0425: if (bytes && length >= 1) *bytes = 0xd5; return 1; + case 0x0426: if (bytes && length >= 1) *bytes = 0xd6; return 1; + case 0x0427: if (bytes && length >= 1) *bytes = 0xd7; return 1; + case 0x0428: if (bytes && length >= 1) *bytes = 0xd8; return 1; + case 0x0429: if (bytes && length >= 1) *bytes = 0xd9; return 1; + case 0x042a: if (bytes && length >= 1) *bytes = 0xda; return 1; + case 0x042b: if (bytes && length >= 1) *bytes = 0xdb; return 1; + case 0x042c: if (bytes && length >= 1) *bytes = 0xdc; return 1; + case 0x042d: if (bytes && length >= 1) *bytes = 0xdd; return 1; + case 0x042e: if (bytes && length >= 1) *bytes = 0xde; return 1; + case 0x042f: if (bytes && length >= 1) *bytes = 0xdf; return 1; + case 0x0430: if (bytes && length >= 1) *bytes = 0xe0; return 1; + case 0x0431: if (bytes && length >= 1) *bytes = 0xe1; return 1; + case 0x0432: if (bytes && length >= 1) *bytes = 0xe2; return 1; + case 0x0433: if (bytes && length >= 1) *bytes = 0xe3; return 1; + case 0x0434: if (bytes && length >= 1) *bytes = 0xe4; return 1; + case 0x0435: if (bytes && length >= 1) *bytes = 0xe5; return 1; + case 0x0436: if (bytes && length >= 1) *bytes = 0xe6; return 1; + case 0x0437: if (bytes && length >= 1) *bytes = 0xe7; return 1; + case 0x0438: if (bytes && length >= 1) *bytes = 0xe8; return 1; + case 0x0439: if (bytes && length >= 1) *bytes = 0xe9; return 1; + case 0x043a: if (bytes && length >= 1) *bytes = 0xea; return 1; + case 0x043b: if (bytes && length >= 1) *bytes = 0xeb; return 1; + case 0x043c: if (bytes && length >= 1) *bytes = 0xec; return 1; + case 0x043d: if (bytes && length >= 1) *bytes = 0xed; return 1; + case 0x043e: if (bytes && length >= 1) *bytes = 0xee; return 1; + case 0x043f: if (bytes && length >= 1) *bytes = 0xef; return 1; + case 0x0440: if (bytes && length >= 1) *bytes = 0xf0; return 1; + case 0x0441: if (bytes && length >= 1) *bytes = 0xf1; return 1; + case 0x0442: if (bytes && length >= 1) *bytes = 0xf2; return 1; + case 0x0443: if (bytes && length >= 1) *bytes = 0xf3; return 1; + case 0x0444: if (bytes && length >= 1) *bytes = 0xf4; return 1; + case 0x0445: if (bytes && length >= 1) *bytes = 0xf5; return 1; + case 0x0446: if (bytes && length >= 1) *bytes = 0xf6; return 1; + case 0x0447: if (bytes && length >= 1) *bytes = 0xf7; return 1; + case 0x0448: if (bytes && length >= 1) *bytes = 0xf8; return 1; + case 0x0449: if (bytes && length >= 1) *bytes = 0xf9; return 1; + case 0x044a: if (bytes && length >= 1) *bytes = 0xfa; return 1; + case 0x044b: if (bytes && length >= 1) *bytes = 0xfb; return 1; + case 0x044c: if (bytes && length >= 1) *bytes = 0xfc; return 1; + case 0x044d: if (bytes && length >= 1) *bytes = 0xfd; return 1; + case 0x044e: if (bytes && length >= 1) *bytes = 0xfe; return 1; + case 0x044f: if (bytes && length >= 1) *bytes = 0xff; return 1; + default: return 0; + } } } diff --git a/Foundation/src/Windows1252Encoding.cpp b/Foundation/src/Windows1252Encoding.cpp index 1c51cf074..206a1836a 100644 --- a/Foundation/src/Windows1252Encoding.cpp +++ b/Foundation/src/Windows1252Encoding.cpp @@ -99,36 +99,39 @@ int Windows1252Encoding::convert(int ch, unsigned char* bytes, int length) const *bytes = ch; return 1; } - else switch (ch) + else { - case 0x20ac: if (bytes && length >= 1) *bytes = 0x80; return 1; - case 0x201a: if (bytes && length >= 1) *bytes = 0x82; return 1; - case 0x0192: if (bytes && length >= 1) *bytes = 0x83; return 1; - case 0x201e: if (bytes && length >= 1) *bytes = 0x84; return 1; - case 0x2026: if (bytes && length >= 1) *bytes = 0x85; return 1; - case 0x2020: if (bytes && length >= 1) *bytes = 0x86; return 1; - case 0x2021: if (bytes && length >= 1) *bytes = 0x87; return 1; - case 0x02c6: if (bytes && length >= 1) *bytes = 0x88; return 1; - case 0x2030: if (bytes && length >= 1) *bytes = 0x89; return 1; - case 0x0160: if (bytes && length >= 1) *bytes = 0x8a; return 1; - case 0x2039: if (bytes && length >= 1) *bytes = 0x8b; return 1; - case 0x0152: if (bytes && length >= 1) *bytes = 0x8c; return 1; - case 0x017d: if (bytes && length >= 1) *bytes = 0x8e; return 1; - case 0x2018: if (bytes && length >= 1) *bytes = 0x91; return 1; - case 0x2019: if (bytes && length >= 1) *bytes = 0x92; return 1; - case 0x201c: if (bytes && length >= 1) *bytes = 0x93; return 1; - case 0x201d: if (bytes && length >= 1) *bytes = 0x94; return 1; - case 0x2022: if (bytes && length >= 1) *bytes = 0x95; return 1; - case 0x2013: if (bytes && length >= 1) *bytes = 0x96; return 1; - case 0x2014: if (bytes && length >= 1) *bytes = 0x97; return 1; - case 0x02dc: if (bytes && length >= 1) *bytes = 0x98; return 1; - case 0x2122: if (bytes && length >= 1) *bytes = 0x99; return 1; - case 0x0161: if (bytes && length >= 1) *bytes = 0x9a; return 1; - case 0x203a: if (bytes && length >= 1) *bytes = 0x9b; return 1; - case 0x0153: if (bytes && length >= 1) *bytes = 0x9c; return 1; - case 0x017e: if (bytes && length >= 1) *bytes = 0x9e; return 1; - case 0x0178: if (bytes && length >= 1) *bytes = 0x9f; return 1; - default: return 0; + switch (ch) + { + case 0x20ac: if (bytes && length >= 1) *bytes = 0x80; return 1; + case 0x201a: if (bytes && length >= 1) *bytes = 0x82; return 1; + case 0x0192: if (bytes && length >= 1) *bytes = 0x83; return 1; + case 0x201e: if (bytes && length >= 1) *bytes = 0x84; return 1; + case 0x2026: if (bytes && length >= 1) *bytes = 0x85; return 1; + case 0x2020: if (bytes && length >= 1) *bytes = 0x86; return 1; + case 0x2021: if (bytes && length >= 1) *bytes = 0x87; return 1; + case 0x02c6: if (bytes && length >= 1) *bytes = 0x88; return 1; + case 0x2030: if (bytes && length >= 1) *bytes = 0x89; return 1; + case 0x0160: if (bytes && length >= 1) *bytes = 0x8a; return 1; + case 0x2039: if (bytes && length >= 1) *bytes = 0x8b; return 1; + case 0x0152: if (bytes && length >= 1) *bytes = 0x8c; return 1; + case 0x017d: if (bytes && length >= 1) *bytes = 0x8e; return 1; + case 0x2018: if (bytes && length >= 1) *bytes = 0x91; return 1; + case 0x2019: if (bytes && length >= 1) *bytes = 0x92; return 1; + case 0x201c: if (bytes && length >= 1) *bytes = 0x93; return 1; + case 0x201d: if (bytes && length >= 1) *bytes = 0x94; return 1; + case 0x2022: if (bytes && length >= 1) *bytes = 0x95; return 1; + case 0x2013: if (bytes && length >= 1) *bytes = 0x96; return 1; + case 0x2014: if (bytes && length >= 1) *bytes = 0x97; return 1; + case 0x02dc: if (bytes && length >= 1) *bytes = 0x98; return 1; + case 0x2122: if (bytes && length >= 1) *bytes = 0x99; return 1; + case 0x0161: if (bytes && length >= 1) *bytes = 0x9a; return 1; + case 0x203a: if (bytes && length >= 1) *bytes = 0x9b; return 1; + case 0x0153: if (bytes && length >= 1) *bytes = 0x9c; return 1; + case 0x017e: if (bytes && length >= 1) *bytes = 0x9e; return 1; + case 0x0178: if (bytes && length >= 1) *bytes = 0x9f; return 1; + default: return 0; + } } } diff --git a/Foundation/testsuite/src/StreamTokenizerTest.cpp b/Foundation/testsuite/src/StreamTokenizerTest.cpp index d794da58e..00d90bff1 100644 --- a/Foundation/testsuite/src/StreamTokenizerTest.cpp +++ b/Foundation/testsuite/src/StreamTokenizerTest.cpp @@ -43,7 +43,7 @@ public: bool start(char c, std::istream& istr) { - if (c != -1 && Ascii::isAlpha(c)) + if ((int)c != -1 && Ascii::isAlpha(c)) { _value = c; return true; @@ -54,7 +54,7 @@ public: void finish(std::istream& istr) { int c = istr.peek(); - while (c != -1 && Ascii::isAlphaNumeric(c)) + while ((int)c != -1 && Ascii::isAlphaNumeric(c)) { istr.get(); _value += c; @@ -82,7 +82,7 @@ public: bool start(char c, std::istream& istr) { - if (c != -1 && Ascii::isDigit(c)) + if ((int)c != -1 && Ascii::isDigit(c)) { _value = c; return true; @@ -93,7 +93,7 @@ public: void finish(std::istream& istr) { int c = istr.peek(); - while (c != -1 && Ascii::isDigit(c)) + while ((int)c != -1 && Ascii::isDigit(c)) { istr.get(); _value += c; diff --git a/Foundation/testsuite/src/ThreadTest.cpp b/Foundation/testsuite/src/ThreadTest.cpp index eefdf0c9e..6975a29bc 100644 --- a/Foundation/testsuite/src/ThreadTest.cpp +++ b/Foundation/testsuite/src/ThreadTest.cpp @@ -372,10 +372,11 @@ void ThreadTest::testThreadFunction() assertTrue (!thread.isRunning()); - int tmp = MyRunnable::_staticVar; + MyRunnable::_staticVar = 0; + int tmp = 1; thread.start(freeFunc, &tmp); thread.join(); - assertTrue (tmp * 2 == MyRunnable::_staticVar); + assertTrue (tmp == MyRunnable::_staticVar); assertTrue (!thread.isRunning()); @@ -433,15 +434,16 @@ void ThreadTest::testThreadStackSize() assertTrue (0 == thread.getStackSize()); thread.setStackSize(stackSize); assertTrue (stackSize <= thread.getStackSize()); - int tmp = MyRunnable::_staticVar; + MyRunnable::_staticVar = 0; + int tmp = 1; thread.start(freeFunc, &tmp); thread.join(); - assertTrue (tmp * 2 == MyRunnable::_staticVar); + assertTrue (1 == MyRunnable::_staticVar); stackSize = 1; thread.setStackSize(stackSize); -#if !defined(POCO_OS_FAMILY_BSD) // on BSD family, stack size is rounded +#if defined(POCO_OS_FAMILY_BSD) // on BSD family, stack size is rounded #ifdef PTHREAD_STACK_MIN assertTrue (PTHREAD_STACK_MIN == thread.getStackSize()); #else @@ -449,17 +451,22 @@ void ThreadTest::testThreadStackSize() #endif #endif - tmp = MyRunnable::_staticVar; - thread.start(freeFunc, &tmp); - thread.join(); - assertTrue (tmp * 2 == MyRunnable::_staticVar); - - thread.setStackSize(0); - assertTrue (0 == thread.getStackSize()); - tmp = MyRunnable::_staticVar; - thread.start(freeFunc, &tmp); - thread.join(); - assertTrue (tmp * 2 == MyRunnable::_staticVar); +// disabled on FreeBSD; segfaults due to stack overflow, +// possibly happens on other BSD OSes) +#if (POCO_OS == POCO_OS_FREE_BSD) + { + int tmp = MyRunnable::_staticVar; + thread.start(freeFunc, &tmp); + thread.join(); + assertTrue (tmp * 2 == MyRunnable::_staticVar); + thread.setStackSize(0); + assertTrue (0 == thread.getStackSize()); + tmp = MyRunnable::_staticVar; + thread.start(freeFunc, &tmp); + thread.join(); + assertTrue (tmp * 2 == MyRunnable::_staticVar); + } +#endif } diff --git a/build/config/FreeBSD b/build/config/FreeBSD index c851bf3a6..8777783f6 100644 --- a/build/config/FreeBSD +++ b/build/config/FreeBSD @@ -1,7 +1,7 @@ # # FreeBSD # -# Make settings for FreeBSD 12.x/clang +# Make settings for FreeBSD/clang # # @@ -9,6 +9,13 @@ # LINKMODE ?= SHARED +# arm sanitizers available in >=13.3 and >=14.1 +SANITIZEFLAGS ?= +# sanitize flags: +# -fsanitize=address +# -fsanitize=undefined +# -fsanitize=thread + # # Define Tools # @@ -35,13 +42,13 @@ SHAREDLIBLINKEXT = .so # # Compiler and Linker Flags # -CFLAGS = +CFLAGS = $(SANITIZEFLAGS) -std=c11 CFLAGS32 = CFLAGS64 = -CXXFLAGS = +CXXFLAGS = $(SANITIZEFLAGS) -std=c++17 -Wall CXXFLAGS32 = CXXFLAGS64 = -LINKFLAGS = +LINKFLAGS = $(SANITIZEFLAGS) LINKFLAGS32 = LINKFLAGS64 = STATICOPT_CC = diff --git a/build/config/FreeBSD-Linux-compat b/build/config/FreeBSD-Linux-compat index 6c09650da..52f919029 100644 --- a/build/config/FreeBSD-Linux-compat +++ b/build/config/FreeBSD-Linux-compat @@ -1,5 +1,5 @@ # -# FreeBSD-Linux-Compat +# FreeBSD-Linux-compat # # Make settings for FreeBSD Linux Compatibility Mode (linux_base_fc10) # @@ -10,6 +10,13 @@ # LINKMODE ?= SHARED +# arm sanitizers available in >=13.3 and >=14.1 +SANITIZEFLAGS ?= +# sanitize flags: +# -fsanitize=address +# -fsanitize=undefined +# -fsanitize=thread + # # Define Tools # @@ -36,13 +43,13 @@ SHAREDLIBLINKEXT = .so # # Compiler and Linker Flags # -CFLAGS = +CFLAGS = $(SANITIZEFLAGS) -std=c11 CFLAGS32 = CFLAGS64 = -CXXFLAGS = -Wall -Wno-sign-compare +CXXFLAGS = $(SANITIZEFLAGS) -std=c++17 -Wall -Wno-sign-compare CXXFLAGS32 = CXXFLAGS64 = -LINKFLAGS = +LINKFLAGS = $(SANITIZEFLAGS) LINKFLAGS32 = LINKFLAGS64 = STATICOPT_CC =