Disable tests requiring sunrpc when the relevant headers are missing.
In order to accommodate that, move the header check
from sanitizer_common to base-config-ix, and define the check result
as a global variable there. Use it afterwards both for definition
needed by sanitizer_common, and to control 'sunrpc' test feature.
While at it, remove the append_have_file_definition macro that was used
only once, and no longer fits the split check-definition.
Bug report: https://github.com/google/sanitizers/issues/974
Differential Revision: https://reviews.llvm.org/D47819
llvm-svn: 351109
endif()
endmacro()
-macro(append_have_file_definition filename varname list)
- check_include_file("${filename}" "${varname}")
- if (NOT ${varname})
- set("${varname}" 0)
- endif()
- list(APPEND ${list} "${varname}=${${varname}}")
-endmacro()
-
macro(list_intersect output input1 input2)
set(${output})
foreach(it ${${input1}})
check_include_file(unwind.h HAVE_UNWIND_H)
+# Used by sanitizer_common and tests.
+check_include_file(rpc/xdr.h HAVE_RPC_XDR_H)
+if (NOT HAVE_RPC_XDR_H)
+ set(HAVE_RPC_XDR_H 0)
+endif()
+
# Top level target used to build all compiler-rt libraries.
add_custom_target(compiler-rt ALL)
add_custom_target(install-compiler-rt)
include_directories(..)
-set(SANITIZER_COMMON_DEFINITIONS)
-
-include(CheckIncludeFile)
-append_have_file_definition(rpc/xdr.h HAVE_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
+set(SANITIZER_COMMON_DEFINITIONS
+ HAVE_RPC_XDR_H=${HAVE_RPC_XDR_H})
set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_rtti_flag(OFF SANITIZER_CFLAGS)
if config.use_newpm:
config.lto_flags += ["-fexperimental-new-pass-manager"]
+if config.have_rpc_xdr_h:
+ config.available_features.add('sunrpc')
+
# Ask llvm-config about assertion mode.
try:
llvm_config_cmd = subprocess.Popen(
set_default("use_lto", config.use_thinlto)
set_default("use_newpm", False)
set_default("android", @ANDROID_PYBOOL@)
+set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)
config.available_features.add('target-is-%s' % config.target_arch)
if config.enable_per_target_runtime_dir:
+// REQUIRES: sunrpc
+
// RUN: %clangxx_msan -g -O0 -DTYPE=int -DFN=xdr_int %s -o %t && \
// RUN: %run %t 2>&1
// RUN: %clangxx_msan -g -O0 -DTYPE=int -DFN=xdr_int -DUNINIT=1 %s -o %t && \
+// REQUIRES: sunrpc
+
// RUN: %clangxx_msan -g -O0 %s -o %t && \
// RUN: %run %t 2>&1
// RUN: %clangxx_msan -g -O0 -DUNINIT=1 %s -o %t && \
+// REQUIRES: sunrpc
+
// RUN: %clangxx_msan -g -O0 %s -o %t && \
// RUN: %run %t 2>&1
// RUN: %clangxx_msan -g -O0 -DUNINIT=1 %s -o %t && \
+// REQUIRES: sunrpc
+
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include <pthread.h>