From 2d7c5dccc470536bc6bd2186e41b0bf9b240ec5e Mon Sep 17 00:00:00 2001 From: ph10 Date: Thu, 23 Apr 2020 16:50:45 +0000 Subject: 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 --- CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') 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 -- cgit v1.2.1