Skip to content

Commit cbf5443

Browse files
Remove old code
1 parent 356e8ca commit cbf5443

38 files changed

+80
-304
lines changed

base/base/Decimal.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
#pragma once
2+
23
#include <base/extended_types.h>
34
#include <base/Decimal_fwd.h>
5+
#include <base/defines.h>
46

5-
#if !defined(NO_SANITIZE_UNDEFINED)
6-
#if defined(__clang__)
7-
#define NO_SANITIZE_UNDEFINED __attribute__((__no_sanitize__("undefined")))
8-
#else
9-
#define NO_SANITIZE_UNDEFINED
10-
#endif
11-
#endif
127

138
namespace DB
149
{

base/base/JSON.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@
1010
#define JSON_MAX_DEPTH 100
1111

1212

13-
#ifdef __clang__
14-
# pragma clang diagnostic push
15-
# pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
16-
#endif
13+
#pragma clang diagnostic push
14+
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
1715
POCO_IMPLEMENT_EXCEPTION(JSONException, Poco::Exception, "JSONException") // NOLINT(cert-err60-cpp, modernize-use-noexcept, hicpp-use-noexcept)
18-
#ifdef __clang__
19-
# pragma clang diagnostic pop
20-
#endif
16+
#pragma clang diagnostic pop
2117

2218

2319
/// Read unsigned integer in a simple form from a non-0-terminated string.

base/base/JSON.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@
3939

4040

4141
// NOLINTBEGIN(google-explicit-constructor)
42-
#ifdef __clang__
43-
# pragma clang diagnostic push
44-
# pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
45-
#endif
42+
#pragma clang diagnostic push
43+
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
4644
POCO_DECLARE_EXCEPTION(Foundation_API, JSONException, Poco::Exception)
47-
#ifdef __clang__
48-
# pragma clang diagnostic pop
49-
#endif
45+
#pragma clang diagnostic pop
5046
// NOLINTEND(google-explicit-constructor)
5147

5248
class JSON

base/base/coverage.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313
#include <unistd.h>
1414

1515

16-
# if defined(__clang__)
1716
extern "C" void __llvm_profile_dump(); // NOLINT
18-
# elif defined(__GNUC__) || defined(__GNUG__)
19-
extern "C" void __gcov_exit();
20-
# endif
2117

2218
#endif
2319

@@ -28,12 +24,7 @@ void dumpCoverageReportIfPossible()
2824
static std::mutex mutex;
2925
std::lock_guard lock(mutex);
3026

31-
# if defined(__clang__)
3227
__llvm_profile_dump(); // NOLINT
33-
# elif defined(__GNUC__) || defined(__GNUG__)
34-
__gcov_exit();
35-
# endif
36-
3728
#endif
3829
}
3930

base/base/defines.h

Lines changed: 23 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/// including <base/defines.h>
1212
/// - it should not have fallback to 0,
1313
/// since this may create false-positive detection (common problem)
14-
#if defined(__clang__) && defined(__has_feature)
14+
#if defined(__has_feature)
1515
# define ch_has_feature __has_feature
1616
#endif
1717

@@ -76,24 +76,11 @@
7676
/// Explicitly allow undefined behaviour for certain functions. Use it as a function attribute.
7777
/// It is useful in case when compiler cannot see (and exploit) it, but UBSan can.
7878
/// Example: multiplication of signed integers with possibility of overflow when both sides are from user input.
79-
#if defined(__clang__)
80-
# define NO_SANITIZE_UNDEFINED __attribute__((__no_sanitize__("undefined")))
81-
# define NO_SANITIZE_ADDRESS __attribute__((__no_sanitize__("address")))
82-
# define NO_SANITIZE_THREAD __attribute__((__no_sanitize__("thread")))
83-
# define ALWAYS_INLINE_NO_SANITIZE_UNDEFINED __attribute__((__always_inline__, __no_sanitize__("undefined")))
84-
#else /// It does not work in GCC. GCC 7 cannot recognize this attribute and GCC 8 simply ignores it.
85-
# define NO_SANITIZE_UNDEFINED
86-
# define NO_SANITIZE_ADDRESS
87-
# define NO_SANITIZE_THREAD
88-
# define ALWAYS_INLINE_NO_SANITIZE_UNDEFINED ALWAYS_INLINE
89-
#endif
90-
91-
#if defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 14
92-
# define DISABLE_SANITIZER_INSTRUMENTATION __attribute__((disable_sanitizer_instrumentation))
93-
#else
94-
# define DISABLE_SANITIZER_INSTRUMENTATION
95-
#endif
96-
79+
#define NO_SANITIZE_UNDEFINED __attribute__((__no_sanitize__("undefined")))
80+
#define NO_SANITIZE_ADDRESS __attribute__((__no_sanitize__("address")))
81+
#define NO_SANITIZE_THREAD __attribute__((__no_sanitize__("thread")))
82+
#define ALWAYS_INLINE_NO_SANITIZE_UNDEFINED __attribute__((__always_inline__, __no_sanitize__("undefined")))
83+
#define DISABLE_SANITIZER_INSTRUMENTATION __attribute__((disable_sanitizer_instrumentation))
9784

9885
#if !__has_include(<sanitizer/asan_interface.h>) || !defined(ADDRESS_SANITIZER)
9986
# define ASAN_UNPOISON_MEMORY_REGION(a, b)
@@ -135,54 +122,33 @@
135122

136123
/// Macros for Clang Thread Safety Analysis (TSA). They can be safely ignored by other compilers.
137124
/// Feel free to extend, but please stay close to https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutexheader
138-
#if defined(__clang__)
139-
# define TSA_GUARDED_BY(...) __attribute__((guarded_by(__VA_ARGS__))) /// data is protected by given capability
140-
# define TSA_PT_GUARDED_BY(...) __attribute__((pt_guarded_by(__VA_ARGS__))) /// pointed-to data is protected by the given capability
141-
# define TSA_REQUIRES(...) __attribute__((requires_capability(__VA_ARGS__))) /// thread needs exclusive possession of given capability
142-
# define TSA_REQUIRES_SHARED(...) __attribute__((requires_shared_capability(__VA_ARGS__))) /// thread needs shared possession of given capability
143-
# define TSA_ACQUIRED_AFTER(...) __attribute__((acquired_after(__VA_ARGS__))) /// annotated lock must be locked after given lock
144-
# define TSA_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis)) /// disable TSA for a function
145-
# define TSA_CAPABILITY(...) __attribute__((capability(__VA_ARGS__))) /// object of a class can be used as capability
146-
# define TSA_ACQUIRE(...) __attribute__((acquire_capability(__VA_ARGS__))) /// function acquires a capability, but does not release it
147-
# define TSA_TRY_ACQUIRE(...) __attribute__((try_acquire_capability(__VA_ARGS__))) /// function tries to acquire a capability and returns a boolean value indicating success or failure
148-
# define TSA_RELEASE(...) __attribute__((release_capability(__VA_ARGS__))) /// function releases the given capability
149-
# define TSA_ACQUIRE_SHARED(...) __attribute__((acquire_shared_capability(__VA_ARGS__))) /// function acquires a shared capability, but does not release it
150-
# define TSA_TRY_ACQUIRE_SHARED(...) __attribute__((try_acquire_shared_capability(__VA_ARGS__))) /// function tries to acquire a shared capability and returns a boolean value indicating success or failure
151-
# define TSA_RELEASE_SHARED(...) __attribute__((release_shared_capability(__VA_ARGS__))) /// function releases the given shared capability
152-
# define TSA_SCOPED_LOCKABLE __attribute__((scoped_lockable)) /// object of a class has scoped lockable capability
125+
#define TSA_GUARDED_BY(...) __attribute__((guarded_by(__VA_ARGS__))) /// data is protected by given capability
126+
#define TSA_PT_GUARDED_BY(...) __attribute__((pt_guarded_by(__VA_ARGS__))) /// pointed-to data is protected by the given capability
127+
#define TSA_REQUIRES(...) __attribute__((requires_capability(__VA_ARGS__))) /// thread needs exclusive possession of given capability
128+
#define TSA_REQUIRES_SHARED(...) __attribute__((requires_shared_capability(__VA_ARGS__))) /// thread needs shared possession of given capability
129+
#define TSA_ACQUIRED_AFTER(...) __attribute__((acquired_after(__VA_ARGS__))) /// annotated lock must be locked after given lock
130+
#define TSA_NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis)) /// disable TSA for a function
131+
#define TSA_CAPABILITY(...) __attribute__((capability(__VA_ARGS__))) /// object of a class can be used as capability
132+
#define TSA_ACQUIRE(...) __attribute__((acquire_capability(__VA_ARGS__))) /// function acquires a capability, but does not release it
133+
#define TSA_TRY_ACQUIRE(...) __attribute__((try_acquire_capability(__VA_ARGS__))) /// function tries to acquire a capability and returns a boolean value indicating success or failure
134+
#define TSA_RELEASE(...) __attribute__((release_capability(__VA_ARGS__))) /// function releases the given capability
135+
#define TSA_ACQUIRE_SHARED(...) __attribute__((acquire_shared_capability(__VA_ARGS__))) /// function acquires a shared capability, but does not release it
136+
#define TSA_TRY_ACQUIRE_SHARED(...) __attribute__((try_acquire_shared_capability(__VA_ARGS__))) /// function tries to acquire a shared capability and returns a boolean value indicating success or failure
137+
#define TSA_RELEASE_SHARED(...) __attribute__((release_shared_capability(__VA_ARGS__))) /// function releases the given shared capability
138+
#define TSA_SCOPED_LOCKABLE __attribute__((scoped_lockable)) /// object of a class has scoped lockable capability
153139

154140
/// Macros for suppressing TSA warnings for specific reads/writes (instead of suppressing it for the whole function)
155141
/// They use a lambda function to apply function attribute to a single statement. This enable us to suppress warnings locally instead of
156142
/// suppressing them in the whole function
157143
/// Consider adding a comment when using these macros.
158-
# define TSA_SUPPRESS_WARNING_FOR_READ(x) ([&]() TSA_NO_THREAD_SAFETY_ANALYSIS -> const auto & { return (x); }())
159-
# define TSA_SUPPRESS_WARNING_FOR_WRITE(x) ([&]() TSA_NO_THREAD_SAFETY_ANALYSIS -> auto & { return (x); }())
144+
#define TSA_SUPPRESS_WARNING_FOR_READ(x) ([&]() TSA_NO_THREAD_SAFETY_ANALYSIS -> const auto & { return (x); }())
145+
#define TSA_SUPPRESS_WARNING_FOR_WRITE(x) ([&]() TSA_NO_THREAD_SAFETY_ANALYSIS -> auto & { return (x); }())
160146

161147
/// This macro is useful when only one thread writes to a member
162148
/// and you want to read this member from the same thread without locking a mutex.
163149
/// It's safe (because no concurrent writes are possible), but TSA generates a warning.
164150
/// (Seems like there's no way to verify it, but it makes sense to distinguish it from TSA_SUPPRESS_WARNING_FOR_READ for readability)
165-
# define TSA_READ_ONE_THREAD(x) TSA_SUPPRESS_WARNING_FOR_READ(x)
166-
167-
#else
168-
# define TSA_GUARDED_BY(...)
169-
# define TSA_PT_GUARDED_BY(...)
170-
# define TSA_REQUIRES(...)
171-
# define TSA_REQUIRES_SHARED(...)
172-
# define TSA_NO_THREAD_SAFETY_ANALYSIS
173-
# define TSA_CAPABILITY(...)
174-
# define TSA_ACQUIRE(...)
175-
# define TSA_TRY_ACQUIRE(...)
176-
# define TSA_RELEASE(...)
177-
# define TSA_ACQUIRE_SHARED(...)
178-
# define TSA_TRY_ACQUIRE_SHARED(...)
179-
# define TSA_RELEASE_SHARED(...)
180-
# define TSA_SCOPED_LOCKABLE
181-
182-
# define TSA_SUPPRESS_WARNING_FOR_READ(x) (x)
183-
# define TSA_SUPPRESS_WARNING_FOR_WRITE(x) (x)
184-
# define TSA_READ_ONE_THREAD(x) TSA_SUPPRESS_WARNING_FOR_READ(x)
185-
#endif
151+
#define TSA_READ_ONE_THREAD(x) TSA_SUPPRESS_WARNING_FOR_READ(x)
186152

187153
/// A template function for suppressing warnings about unused variables or function results.
188154
template <typename... Args>

base/base/iostream_debug_helpers.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ Out & dump(Out & out, const char * name, T && x) // NOLINT(cppcoreguidelines-mis
155155
return dumpValue(out, x) << "; ";
156156
}
157157

158-
#ifdef __clang__
159158
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
160-
#endif
161159

162160
#define DUMPVAR(VAR) ::dump(std::cerr, #VAR, (VAR));
163161
#define DUMPHEAD std::cerr << __FILE__ << ':' << __LINE__ << " [ " << getThreadId() << " ] ";

base/base/phdr_cache.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
/// Thread Sanitizer uses dl_iterate_phdr function on initialization and fails if we provide our own.
1212
#ifdef USE_PHDR_CACHE
1313

14-
#if defined(__clang__)
15-
# pragma clang diagnostic ignored "-Wreserved-id-macro"
16-
# pragma clang diagnostic ignored "-Wunused-macros"
17-
#endif
14+
#pragma clang diagnostic ignored "-Wreserved-id-macro"
15+
#pragma clang diagnostic ignored "-Wunused-macros"
1816

1917
#define __msan_unpoison(X, Y) // NOLINT
2018
#if defined(ch_has_feature)
@@ -57,10 +55,6 @@ std::atomic<PHDRCache *> phdr_cache {};
5755

5856

5957
extern "C"
60-
#ifndef __clang__
61-
[[gnu::visibility("default")]]
62-
[[gnu::externally_visible]]
63-
#endif
6458
int dl_iterate_phdr(int (*callback) (dl_phdr_info * info, size_t size, void * data), void * data)
6559
{
6660
auto * current_phdr_cache = phdr_cache.load();

base/glibc-compatibility/musl/getauxval.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@
2020

2121
/// Suppress TSan since it is possible for this code to be called from multiple threads,
2222
/// and initialization is safe to be done multiple times from multiple threads.
23-
#if defined(__clang__)
24-
# define NO_SANITIZE_THREAD __attribute__((__no_sanitize__("thread")))
25-
#else
26-
# define NO_SANITIZE_THREAD
27-
#endif
23+
#define NO_SANITIZE_THREAD __attribute__((__no_sanitize__("thread")))
2824

2925
// We don't have libc struct available here.
3026
// Compute aux vector manually (from /proc/self/auxv).

base/harmful/harmful.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66
/// It is only enabled in debug build (its intended use is for CI checks).
77
#if !defined(NDEBUG)
88

9-
#if defined(__clang__)
10-
#pragma clang diagnostic ignored "-Wincompatible-library-redeclaration"
11-
#else
12-
#pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch"
13-
#endif
9+
#pragma clang diagnostic ignored "-Wincompatible-library-redeclaration"
1410

1511
/// We cannot use libc headers here.
1612
long write(int, const void *, unsigned long);

programs/benchmark/Benchmark.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,6 @@ class Benchmark : public Poco::Util::Application
567567
}
568568

569569

570-
#ifndef __clang__
571-
#pragma GCC optimize("-fno-var-tracking-assignments")
572-
#endif
573-
574570
int mainEntryClickHouseBenchmark(int argc, char ** argv)
575571
{
576572
using namespace DB;

0 commit comments

Comments
 (0)