summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2020-04-23 16:50:45 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2020-04-23 16:50:45 +0000
commit2d7c5dccc470536bc6bd2186e41b0bf9b240ec5e (patch)
tree46f4d3ba96edaeab33e4c3ce2d4759699dbec3a1 /CMakeLists.txt
parentb941dacb37e5b7e18cf1e99ec10f5117a135a05e (diff)
downloadpcre2-2d7c5dccc470536bc6bd2186e41b0bf9b240ec5e.tar.gz
Added tests for __attribute__((uninitialized)) to both the configure and
CMake build files. Used to disable initialization of the match stack frames vector (clang has an automatic initialization feature). git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1246 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 11 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 301a713..baa8890 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,6 +87,7 @@
# 2020-03-16 PH renamed dftables as pcre2_dftables (as elsewhere)
# 2020-03-24 PH changed CMAKE_MODULE_PATH definition to add, not replace
# 2020-04-08 Carlo added function check for secure_getenv, fixed strerror
+# 2020-04-16 enh added check for __attribute__((uninitialized))
PROJECT(PCRE2 C)
@@ -113,8 +114,9 @@ FIND_PACKAGE( Editline )
# Configuration checks
-INCLUDE(CheckIncludeFile)
+INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckFunctionExists)
+INCLUDE(CheckIncludeFile)
INCLUDE(CheckTypeSize)
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
@@ -130,6 +132,14 @@ CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
CHECK_FUNCTION_EXISTS(secure_getenv HAVE_SECURE_GETENV)
+set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
+CHECK_C_SOURCE_COMPILES(
+ "int main() { char buf[128] __attribute__((uninitialized)); (void)buf; return 0; }"
+ HAVE_ATTRIBUTE_UNINITIALIZED
+)
+set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
+
# User-configurable options
#
# Note: CMakeSetup displays these in alphabetical order, regardless of