Skip to content

Commit aede22c

Browse files
authored
fixed #14158 - Disable the use of getloadavg(), my_fpe(), feenableexcept() and -rdynamic in AIX (#7856)
In AIX, getloadavg, feenableexcept and my_fpe are not available. In addition, -rdynamic flag is not supported. This results in compilation errors in AIX and this patch fixes it. For more information please refer the discussion : https://sourceforge.net/p/cppcheck/discussion/development/thread/f7bad36f1f/
1 parent 257b24a commit aede22c

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ Ramzan Bekbulatov
327327
Raphael Geissert
328328
Razvan Ioan Alexe
329329
Reijo Tomperi
330+
Reshma V Kumar
330331
Rainer Wiesenfarth
331332
Riccardo Ghetta
332333
Richard A. Smith

cli/processexecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ bool ProcessExecutor::handleRead(int rpipe, unsigned int &result, const std::str
276276

277277
bool ProcessExecutor::checkLoadAverage(size_t nchildren)
278278
{
279-
#if defined(__QNX__) || defined(__HAIKU__) // getloadavg() is unsupported on Qnx, Haiku.
279+
#if defined(__QNX__) || defined(__HAIKU__) || defined(_AIX) // getloadavg() is unsupported on Qnx, Haiku, AIX.
280280
(void)nchildren;
281281
return true;
282282
#else

test/signal/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
88
target_compile_options_safe(test-signalhandler -Wno-missing-declarations)
99
target_compile_options_safe(test-signalhandler -Wno-missing-prototypes)
1010
# required for backtrace() to produce function names
11-
target_link_options(test-signalhandler PRIVATE -rdynamic)
11+
if(NOT CMAKE_SYSTEM_NAME MATCHES AIX)
12+
target_link_options(test-signalhandler PRIVATE -rdynamic)
13+
endif()
1214
endif()
1315

1416
add_executable(test-stacktrace
@@ -20,5 +22,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
2022
target_compile_options_safe(test-stacktrace -Wno-missing-declarations)
2123
target_compile_options_safe(test-stacktrace -Wno-missing-prototypes)
2224
# required for backtrace() to produce function names
23-
target_link_options(test-stacktrace PRIVATE -rdynamic)
25+
if(NOT CMAKE_SYSTEM_NAME MATCHES AIX)
26+
target_link_options(test-stacktrace PRIVATE -rdynamic)
27+
endif()
2428
endif()

test/signal/test-signalhandler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
++*static_cast<int*>(nullptr); // NOLINT(clang-analyzer-core.NullDereference)
5555
}
5656

57-
#if !defined(__APPLE__)
57+
#if !defined(__APPLE__) && !defined(_AIX)
5858
/*static*/ int my_fpe() // NOLINT(misc-use-internal-linkage)
5959
{
6060
if (feenableexcept(FE_ALL_EXCEPT) == -1)
@@ -80,7 +80,7 @@ int main(int argc, const char * const argv[])
8080
my_abort();
8181
else if (strcmp(argv[1], "segv") == 0)
8282
my_segv();
83-
#if !defined(__APPLE__)
83+
#if !defined(__APPLE__) && !defined(_AIX)
8484
else if (strcmp(argv[1], "fpe") == 0)
8585
return my_fpe();
8686
#endif

0 commit comments

Comments
 (0)