Merge pull request #1112 in HDFFV/hdf5 from ~JSOUMAGNE/hdf5_fork:gcc_sanitize to develop

* commit '5afeefe1bae62fa5faf06c0c6f240e10863a2693':
  Fix H5detect to use no_sanitize_address attribute and support GCC sanitizers
This commit is contained in:
Jerome Soumagne 2018-07-16 10:39:13 -05:00
commit 643593dfda

View File

@ -54,12 +54,8 @@ static const char *FileHeader = "\n\
#include "H5Tpublic.h" #include "H5Tpublic.h"
#include "H5Rpublic.h" #include "H5Rpublic.h"
#if defined(__has_attribute) #if defined(__has_attribute) && __has_attribute(no_sanitize_address)
#if __has_attribute(no_sanitize) #define HDF_NO_UBSAN __attribute__((no_sanitize_address))
#define HDF_NO_UBSAN __attribute__((no_sanitize("undefined")))
#else
#define HDF_NO_UBSAN
#endif
#else #else
#define HDF_NO_UBSAN #define HDF_NO_UBSAN
#endif #endif
@ -1675,11 +1671,13 @@ detect_alignments(void)
*/ */
static int verify_signal_handlers(int signum, void (*handler)(int)) static int verify_signal_handlers(int signum, void (*handler)(int))
{ {
#if defined(__has_feature) #if defined(__has_feature) /* Clang */
#if __has_feature(address_sanitizer) || __has_feature(thread_sanitizer) #if __has_feature(address_sanitizer) || __has_feature(thread_sanitizer)
/* Under the address and thread sanitizers, don't raise any signals. */ /* Under the address and thread sanitizers, don't raise any signals. */
return 0; return 0;
#endif #endif
#elif defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_THREAD__) /* GCC */
return 0;
#endif #endif
void (*save_handler)(int) = HDsignal(signum, handler); void (*save_handler)(int) = HDsignal(signum, handler);
volatile int i, val; volatile int i, val;