mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Do not undefine __has_feature (may break c++ headers)
If the order of <common/defines.h> and c++ header will be wrong the compilation will be broken. v2: rename __ch_has_feature to ch_has_feature to fix -Wreserved-id-macro v3: do not fallback to 0
This commit is contained in:
parent
8ab578065a
commit
810023a65c
@ -2,10 +2,17 @@
|
|||||||
|
|
||||||
/// __has_feature supported only by clang.
|
/// __has_feature supported only by clang.
|
||||||
///
|
///
|
||||||
/// But libcxx/libcxxabi overrides it to 0, thus the checks for __has_feature will be wrong,
|
/// But libcxx/libcxxabi overrides it to 0,
|
||||||
/// undefine it again to avoid such issues.
|
/// thus the checks for __has_feature will be wrong.
|
||||||
#if defined(__has_feature) && !defined(__clang__)
|
///
|
||||||
# undef __has_feature
|
/// NOTE:
|
||||||
|
/// - __has_feature cannot be simply undefined,
|
||||||
|
/// since this will be broken if some C++ header will be included after
|
||||||
|
/// including <common/defines.h>
|
||||||
|
/// - it should not have fallback to 0,
|
||||||
|
/// since this may create false-positive detection (common problem)
|
||||||
|
#if defined(__clang__) && defined(__has_feature)
|
||||||
|
# define ch_has_feature __has_feature
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
@ -40,8 +47,8 @@
|
|||||||
|
|
||||||
/// Check for presence of address sanitizer
|
/// Check for presence of address sanitizer
|
||||||
#if !defined(ADDRESS_SANITIZER)
|
#if !defined(ADDRESS_SANITIZER)
|
||||||
# if defined(__has_feature)
|
# if defined(ch_has_feature)
|
||||||
# if __has_feature(address_sanitizer)
|
# if ch_has_feature(address_sanitizer)
|
||||||
# define ADDRESS_SANITIZER 1
|
# define ADDRESS_SANITIZER 1
|
||||||
# endif
|
# endif
|
||||||
# elif defined(__SANITIZE_ADDRESS__)
|
# elif defined(__SANITIZE_ADDRESS__)
|
||||||
@ -50,8 +57,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(THREAD_SANITIZER)
|
#if !defined(THREAD_SANITIZER)
|
||||||
# if defined(__has_feature)
|
# if defined(ch_has_feature)
|
||||||
# if __has_feature(thread_sanitizer)
|
# if ch_has_feature(thread_sanitizer)
|
||||||
# define THREAD_SANITIZER 1
|
# define THREAD_SANITIZER 1
|
||||||
# endif
|
# endif
|
||||||
# elif defined(__SANITIZE_THREAD__)
|
# elif defined(__SANITIZE_THREAD__)
|
||||||
@ -60,8 +67,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MEMORY_SANITIZER)
|
#if !defined(MEMORY_SANITIZER)
|
||||||
# if defined(__has_feature)
|
# if defined(ch_has_feature)
|
||||||
# if __has_feature(memory_sanitizer)
|
# if ch_has_feature(memory_sanitizer)
|
||||||
# define MEMORY_SANITIZER 1
|
# define MEMORY_SANITIZER 1
|
||||||
# endif
|
# endif
|
||||||
# elif defined(__MEMORY_SANITIZER__)
|
# elif defined(__MEMORY_SANITIZER__)
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __msan_unpoison(X, Y) // NOLINT
|
#define __msan_unpoison(X, Y) // NOLINT
|
||||||
#if defined(__has_feature)
|
#if defined(ch_has_feature)
|
||||||
# if __has_feature(memory_sanitizer)
|
# if ch_has_feature(memory_sanitizer)
|
||||||
# undef __msan_unpoison
|
# undef __msan_unpoison
|
||||||
# include <sanitizer/msan_interface.h>
|
# include <sanitizer/msan_interface.h>
|
||||||
# endif
|
# endif
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <common/defines.h>
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
||||||
@ -9,8 +11,9 @@
|
|||||||
#define __msan_test_shadow(X, Y) (false)
|
#define __msan_test_shadow(X, Y) (false)
|
||||||
#define __msan_print_shadow(X, Y)
|
#define __msan_print_shadow(X, Y)
|
||||||
#define __msan_unpoison_string(X)
|
#define __msan_unpoison_string(X)
|
||||||
#if defined(__has_feature)
|
|
||||||
# if __has_feature(memory_sanitizer)
|
#if defined(ch_has_feature)
|
||||||
|
# if ch_has_feature(memory_sanitizer)
|
||||||
# undef __msan_unpoison
|
# undef __msan_unpoison
|
||||||
# undef __msan_test_shadow
|
# undef __msan_test_shadow
|
||||||
# undef __msan_print_shadow
|
# undef __msan_print_shadow
|
||||||
|
@ -60,8 +60,8 @@ Otherwise you will get only exported symbols from program headers.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __msan_unpoison_string(X) // NOLINT
|
#define __msan_unpoison_string(X) // NOLINT
|
||||||
#if defined(__has_feature)
|
#if defined(ch_has_feature)
|
||||||
# if __has_feature(memory_sanitizer)
|
# if ch_has_feature(memory_sanitizer)
|
||||||
# undef __msan_unpoison_string
|
# undef __msan_unpoison_string
|
||||||
# include <sanitizer/msan_interface.h>
|
# include <sanitizer/msan_interface.h>
|
||||||
# endif
|
# endif
|
||||||
|
Loading…
Reference in New Issue
Block a user