[AIX] [test-suite] Enable standard compatable mode on AIX

Summary: Since the current default `_ALL_SOURCE` causes numerous issues on AIX (e.g., typedef redefinition, unintended macro expansion), this patch changes the configuration to use standard-compatable mode by appending `XOPEN_SOURCE=700`. This flag is added to cflags for all the C test cases because a considerable number of C tests are affected by the `_ALL_SOURCE` problem. For one particular C++ test case that was also affected by `_ALL_SOURCE`, the flag is appended to the cxxflags in its sub-level CMakeLists.

Reviewers: hubert.reinterpretcast, daltenty

Reviewed By: daltenty

Subscribers: mgorny

Differential Revision: https://reviews.llvm.org/D82321
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90d4416..94ae042 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -170,6 +170,12 @@
 set(CMAKE_EXE_LINKER_FLAGS
     "${CMAKE_EXE_LINKER_FLAGS} ${TEST_SUITE_EXTRA_EXE_LINKER_FLAGS}")
 
+# Use X/OPEN compatibility flag on AIX for C tests to avoid problems
+# with some versions of the system headers.
+if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=700")
+endif()
+
 # This is either directly the C++ ABI library or the full C++ library
 # which pulls in the ABI transitively.
 set(TEST_SUITE_CXX_ABI "default" CACHE STRING "Specify C++ ABI library to use.")
diff --git a/MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/CMakeLists.txt b/MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/CMakeLists.txt
index e6afd61..6a55a7f 100644
--- a/MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/CMakeLists.txt
+++ b/MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/CMakeLists.txt
@@ -1,4 +1,4 @@
-list(APPEND CXXFLAGS -I. -DMINIFE_SCALAR=double  -DMINIFE_LOCAL_ORDINAL=int -DMINIFE_GLOBAL_ORDINAL=int -DMINIFE_CSR_MATRIX -DREDSTORM) # -DREDSTORM for mkdir
+list(APPEND CXXFLAGS -I. -DMINIFE_SCALAR=double  -DMINIFE_LOCAL_ORDINAL=int -DMINIFE_GLOBAL_ORDINAL=int -DMINIFE_CSR_MATRIX -DREDSTORM -D_XOPEN_SOURCE=700) # -DREDSTORM for mkdir
 list(APPEND LDFLAGS -lm)
 set(RUN_OPTIONS -nx 64 -ny 64 -nz 64)
 llvm_multisource(miniFE)