Skip to content

Commit 5e4bb98

Browse files
authored
[Chore](build) enable -Wpedantic and update lowest gcc version to 11.1 (#16290)
enable -Wpedantic and update lowest gcc version to 11.1
1 parent 7d5a10e commit 5e4bb98

121 files changed

Lines changed: 246 additions & 321 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clangd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@
1818
Diagnostics:
1919
UnusedIncludes: Strict
2020

21+
If:
22+
PathMatch: be/test/.*
23+
24+
CompileFlags:
25+
CompilationDatabase: be/ut_build_ASAN/

be/CMakeLists.txt

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ endif ()
6060
# Set boost/stacktrace use backtrace api to unwind
6161
if (NOT OS_MACOSX)
6262
add_definitions(-DBOOST_STACKTRACE_USE_BACKTRACE)
63-
#add_definitions(-DPRINT_ALL_ERR_STATUS_STACKTRACE)
6463
else()
6564
add_definitions(-DBOOST_STACKTRACE_USE_NOOP)
6665
endif()
@@ -118,8 +117,8 @@ option(WITH_MYSQL "Support access MySQL" ON)
118117

119118
# Check gcc
120119
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
121-
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0")
122-
message(FATAL_ERROR "Need GCC version at least 11.0")
120+
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.1")
121+
message(FATAL_ERROR "Need GCC version at least 11.1")
123122
endif()
124123
endif()
125124

@@ -490,27 +489,25 @@ if (NOT CUSTUM_LINKER_COMMAND STREQUAL "ld")
490489
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=${CUSTUM_LINKER_COMMAND}")
491490
endif()
492491

493-
if (USE_LIBCPP AND COMPILER_CLANG)
494-
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -stdlib=libc++")
495-
if (NOT OS_MACOSX)
496-
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -lstdc++")
497-
endif()
498-
add_definitions(-DUSE_LIBCPP)
499-
endif()
500-
501492
if (COMPILER_GCC)
502-
# Avoid GCC 11 false alarm
503-
# https://stackoverflow.com/questions/67584073/gcc-11-false-array-subscript-is-partly-outside-array-bounds-warning
504-
# https://stackoverflow.com/questions/69426070/gcc-11-order-of-arguments-triggers-false-positive-wstringop-overflow-is-this-bu
505-
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-array-bounds -Wno-stringop-overread")
506-
add_compile_options(-Wno-stringop-overflow -fdiagnostics-color=always)
493+
add_compile_options(-fdiagnostics-color=always -Wno-array-bounds -Wno-stringop-overread)
507494
endif ()
508495

509496
if (COMPILER_CLANG)
510-
add_compile_options(-fcolor-diagnostics -fno-limit-debug-info)
497+
add_compile_options(-fcolor-diagnostics -fno-limit-debug-info -Wpedantic)
498+
add_compile_options(-Wno-zero-length-array -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -Wno-vla-extension -Wno-c++20-designator -Wno-gnu-label-as-value -Wno-embedded-directive -Wno-array-bounds)
511499
if(MAKE_TEST STREQUAL "OFF")
512500
add_compile_options(-Qunused-arguments)
513501
endif()
502+
if (USE_LIBCPP)
503+
add_compile_options(-stdlib=libc++)
504+
if (NOT OS_MACOSX)
505+
add_compile_options(-lstdc++)
506+
endif()
507+
add_definitions(-DUSE_LIBCPP)
508+
else()
509+
add_compile_options(-Wno-c++20-attribute-extensions)
510+
endif()
514511
endif ()
515512

516513
# https://github.com/boostorg/uuid/issues/92

be/src/agent/utils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace doris {
2929
class MasterServerClient {
3030
public:
3131
MasterServerClient(const TMasterInfo& master_info, FrontendServiceClientCache* client_cache);
32-
virtual ~MasterServerClient() {};
32+
virtual ~MasterServerClient() = default;
3333

3434
// Report finished task to the master server
3535
//
@@ -59,8 +59,8 @@ class MasterServerClient {
5959

6060
class AgentUtils {
6161
public:
62-
AgentUtils() {};
63-
virtual ~AgentUtils() {};
62+
AgentUtils() = default;
63+
virtual ~AgentUtils() = default;
6464

6565
// Execute shell cmd
6666
virtual bool exec_cmd(const std::string& command, std::string* errmsg,

be/src/common/logging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class TaggableLogger {
8686
} else {
8787
_stream << fmt::format(fmt, std::forward<Args>(args)...);
8888
}
89-
};
89+
}
9090

9191
template <typename V>
9292
TaggableLogger& tag(std::string_view key, const V& value) {

be/src/common/status.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ E(INVERTED_INDEX_CLUCENE_ERROR, -6002);
253253
E(INVERTED_INDEX_FILE_NOT_FOUND, -6003);
254254
E(INVERTED_INDEX_FILE_HIT_LIMIT, -6004);
255255
#undef E
256-
}; // namespace ErrorCode
256+
} // namespace ErrorCode
257257

258258
// clang-format off
259259
// whether to capture stacktrace

be/src/exec/data_sink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DataSink {
5959
// Send a Block into this sink.
6060
virtual Status send(RuntimeState* state, vectorized::Block* block, bool eos = false) {
6161
return Status::NotSupported("Not support send block");
62-
};
62+
}
6363
// Releases all resources that were allocated in prepare()/send().
6464
// Further send() calls are illegal after calling close().
6565
// It must be okay to call this multiple times. Subsequent calls should

be/src/exec/olap_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class ColumnValueRange {
336336
set_whole_value_range();
337337
}
338338
_contain_null = contain_null;
339-
};
339+
}
340340

341341
int precision() const { return _precision; }
342342

be/src/exec/tablet_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct VOlapTablePartition {
9999
std::vector<OlapTableIndexTablets> indexes;
100100

101101
VOlapTablePartition(vectorized::Block* partition_block)
102-
: start_key {partition_block, -1}, end_key {partition_block, -1} {};
102+
: start_key {partition_block, -1}, end_key {partition_block, -1} {}
103103
};
104104

105105
class VOlapTablePartKeyComparator {

be/src/exprs/bitmapfilter_predicate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BitmapFilterFuncBase {
3333
virtual void insert_many(const std::vector<const BitmapValue*> bitmaps) = 0;
3434
virtual bool empty() = 0;
3535
virtual Status assign(BitmapValue* bitmap_value) = 0;
36-
virtual void light_copy(BitmapFilterFuncBase* other) { _not_in = other->_not_in; };
36+
virtual void light_copy(BitmapFilterFuncBase* other) { _not_in = other->_not_in; }
3737
virtual uint16_t find_fixed_len_olap_engine(const char* data, const uint8* nullmap,
3838
uint16_t* offsets, int number) = 0;
3939
virtual void find_batch(const char* data, const uint8* nullmap, int number,

be/src/exprs/create_predicate_function.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MinmaxFunctionTraits {
3333
template <PrimitiveType type>
3434
static BasePtr get_function() {
3535
return new MinMaxNumFunc<typename PrimitiveTypeTraits<type>::CppType>();
36-
};
36+
}
3737
};
3838

3939
class HybridSetTraits {
@@ -45,7 +45,7 @@ class HybridSetTraits {
4545
using Set =
4646
std::conditional_t<std::is_same_v<CppType, StringRef>, StringSet, HybridSet<type>>;
4747
return new Set();
48-
};
48+
}
4949
};
5050

5151
class BloomFilterTraits {
@@ -54,7 +54,7 @@ class BloomFilterTraits {
5454
template <PrimitiveType type>
5555
static BasePtr get_function() {
5656
return new BloomFilterFunc<type>();
57-
};
57+
}
5858
};
5959

6060
class BitmapFilterTraits {
@@ -63,7 +63,7 @@ class BitmapFilterTraits {
6363
template <PrimitiveType type>
6464
static BasePtr get_function() {
6565
return new BitmapFilterFunc<type>();
66-
};
66+
}
6767
};
6868

6969
template <class Traits>

0 commit comments

Comments
 (0)