diff --git a/CMakeLists.txt b/CMakeLists.txt index 18407e864523..cb013d6cd588 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,8 +211,8 @@ if(NOT PYTHON_ONLY) endif(NOT PYTHON_ONLY) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${CXX_ISYSTEM_DIRS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=undef") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=undef ${CXX_ISYSTEM_DIRS}") add_subdirectory(src) add_subdirectory(introspection) diff --git a/src/cc/frontends/clang/CMakeLists.txt b/src/cc/frontends/clang/CMakeLists.txt index f45365fc02c6..1469c5cd9ae4 100644 --- a/src/cc/frontends/clang/CMakeLists.txt +++ b/src/cc/frontends/clang/CMakeLists.txt @@ -7,6 +7,8 @@ if(DEFINED BCC_CUR_CPU_IDENTIFIER) endif() if(DEFINED BCC_BACKUP_COMPILE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBCC_BACKUP_COMPILE='${BCC_BACKUP_COMPILE}'") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBCC_BACKUP_COMPILE=0") endif() add_library(clang_frontend-objects OBJECT loader.cc b_frontend_action.cc tp_frontend_action.cc kbuild_helper.cc) diff --git a/src/cc/usdt/usdt.cc b/src/cc/usdt/usdt.cc index a6213653ec6e..24960e52a88b 100644 --- a/src/cc/usdt/usdt.cc +++ b/src/cc/usdt/usdt.cc @@ -36,15 +36,15 @@ Location::Location(uint64_t addr, const std::string &bin_path, const char *arg_f : address_(addr), bin_path_(bin_path) { -#ifdef __aarch64__ +#if defined(__aarch64__) ArgumentParser_aarch64 parser(arg_fmt); -#elif __loongarch64 +#elif defined(__loongarch64) ArgumentParser_loongarch64 parser(arg_fmt); -#elif __powerpc64__ +#elif defined(__powerpc64__) ArgumentParser_powerpc64 parser(arg_fmt); -#elif __s390x__ +#elif defined(__s390x__) ArgumentParser_s390x parser(arg_fmt); -#elif __riscv +#elif defined(__riscv) ArgumentParser_riscv64 parser(arg_fmt); #else ArgumentParser_x64 parser(arg_fmt); diff --git a/tests/cc/test_usdt_args.cc b/tests/cc/test_usdt_args.cc index d9c4d46a394d..db77fb426fa5 100644 --- a/tests/cc/test_usdt_args.cc +++ b/tests/cc/test_usdt_args.cc @@ -59,15 +59,15 @@ static void verify_register(USDT::ArgumentParser &parser, int arg_size, TEST_CASE("test usdt argument parsing", "[usdt]") { SECTION("parse failure") { -#ifdef __aarch64__ +#if defined(__aarch64__) USDT::ArgumentParser_aarch64 parser("4@[x32,200]"); -#elif __loongarch64 +#elif defined(__loongarch64) USDT::ArgumentParser_loongarch64 parser("4@[$r32,200]"); -#elif __powerpc64__ +#elif defined(__powerpc64__) USDT::ArgumentParser_powerpc64 parser("4@-12(42)"); -#elif __s390x__ +#elif defined(__s390x__) USDT::ArgumentParser_s390x parser("4@-12(%r42)"); -#elif __riscv +#elif defined(__riscv) USDT::ArgumentParser_riscv64 parser("4@20(s35)"); #elif defined(__x86_64__) USDT::ArgumentParser_x64 parser("4@i%ra+1r"); @@ -82,7 +82,7 @@ TEST_CASE("test usdt argument parsing", "[usdt]") { REQUIRE(i < 10); } SECTION("argument examples from the Python implementation") { -#ifdef __aarch64__ +#if defined(__aarch64__) USDT::ArgumentParser_aarch64 parser( "-1@x0 4@5 8@[x12] -4@[x30,-40] -4@[x31,-40] 8@[sp, 120]"); verify_register(parser, -1, "regs[0]"); @@ -91,7 +91,7 @@ TEST_CASE("test usdt argument parsing", "[usdt]") { verify_register(parser, -4, "regs[30]", -40); verify_register(parser, -4, "sp", -40); verify_register(parser, 8, "sp", 120); -#elif __loongarch64 +#elif defined(__loongarch64) USDT::ArgumentParser_loongarch64 parser( "-1@$r0 4@5 8@[$r12] -4@[$r30,-40] -4@[$r3,-40] 8@[sp, 120]"); verify_register(parser, -1, "regs[0]"); @@ -100,7 +100,7 @@ TEST_CASE("test usdt argument parsing", "[usdt]") { verify_register(parser, -4, "regs[30]", -40); verify_register(parser, -4, "sp", -40); verify_register(parser, 8, "sp", 120); -#elif __powerpc64__ +#elif defined(__powerpc64__) USDT::ArgumentParser_powerpc64 parser( "-4@0 8@%r0 8@i0 4@0(%r0) -2@0(0) " "1@0 -2@%r3 -8@i9 -1@0(%r4) -4@16(6) " @@ -144,7 +144,7 @@ TEST_CASE("test usdt argument parsing", "[usdt]") { verify_register(parser, 2, 1097); verify_register(parser, 4, "gpr[30]", 108); verify_register(parser, -2, "gpr[31]", -4); -#elif __s390x__ +#elif defined(__s390x__) USDT::ArgumentParser_s390x parser( "-4@%r0 8@%r0 8@0 4@0(%r0) -2@0(%r0) " "1@%r0 -2@%r3 -8@9 -1@0(%r4) -4@16(%r6) " @@ -188,7 +188,7 @@ TEST_CASE("test usdt argument parsing", "[usdt]") { verify_register(parser, 2, 1097); verify_register(parser, 4, "gprs[7]", 108); verify_register(parser, -2, "gprs[6]", -4); -#elif __riscv +#elif defined(__riscv) USDT::ArgumentParser_riscv64 parser( "-4@s5 -4@a0 4@20(s1) -4@-1 8@-72(s0) 8@0"); verify_register(parser, -4, "s5"); diff --git a/tests/python/include/folly/tracing/StaticTracepoint.h b/tests/python/include/folly/tracing/StaticTracepoint.h index 858b7dbc0cee..8e580309fd9f 100644 --- a/tests/python/include/folly/tracing/StaticTracepoint.h +++ b/tests/python/include/folly/tracing/StaticTracepoint.h @@ -17,7 +17,7 @@ #pragma once #if defined(__ELF__) && (defined(__x86_64__) || defined(__i386__)) && \ - !FOLLY_DISABLE_SDT + !(defined(FOLLY_DISABLE_SDT) && FOLLY_DISABLE_SDT) #include