Skip to content

Commit 254a3ae

Browse files
nickdesaulnierssmallp-o-p
authored and
smallp-o-p
committed
[libc][cmake] disable include tests in overlay mode (llvm#114566)
This avoids -Wmacro-redefinition diagnostics observed when building the libc_include_tests ninja target. For example, the signbit_test will attempt to include BOTH our math-macros.h (via math-function-macros.h), and the system's math.h (via hdr/math_macros.h). While it's nice that we can get some coverage of the headers we will provide to end users of fullbuilds in CI of overlay builds, it's not worth chasing each individual conflict and disabling some include tests as conflicts arise. Disable the include tests unless `-DLLVM_LIBC_FULL_BUILD=ON` is specified.
1 parent 1abcf03 commit 254a3ae

File tree

2 files changed

+42
-45
lines changed

2 files changed

+42
-45
lines changed

libc/test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ if(LIBC_TARGET_OS_IS_GPU)
1818
endif()
1919
endif()
2020

21-
add_subdirectory(include)
2221
add_subdirectory(src)
2322
add_subdirectory(utils)
2423

2524
if(NOT LLVM_LIBC_FULL_BUILD)
2625
return()
2726
endif()
2827

28+
add_subdirectory(include)
29+
2930
if(NOT ${LIBC_TARGET_OS} STREQUAL "linux" AND
3031
NOT ${LIBC_TARGET_OS} STREQUAL "gpu")
3132
# Integration tests are currently only available for linux and the GPU.

libc/test/include/CMakeLists.txt

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -36,50 +36,46 @@ add_libc_test(
3636
-Wno-gnu-statement-expression-from-macro-expansion
3737
)
3838

39-
# stdbit_test only tests our generated stdbit.h, which is not generated in
40-
# overlay mode.
41-
if(LLVM_LIBC_FULL_BUILD AND libc.include.stdbit IN_LIST TARGET_PUBLIC_HEADERS)
42-
add_libc_test(
43-
stdbit_test
44-
SUITE
45-
libc_include_tests
46-
HDRS
47-
stdbit_stub.h
48-
SRCS
49-
stdbit_test.cpp
50-
DEPENDS
51-
libc.include.llvm-libc-macros.stdbit_macros
52-
libc.include.llvm_libc_common_h
53-
libc.include.stdbit
54-
# Intentionally do not depend on libc.src.stdbit.*. The include test is
55-
# simply testing the macros provided by stdbit.h, not the implementation
56-
# of the underlying functions which the type generic macros may dispatch
57-
# to.
58-
)
59-
add_libc_test(
60-
stdbit_c_test
61-
C_TEST
62-
UNIT_TEST_ONLY
63-
SUITE
64-
libc_include_tests
65-
HDRS
66-
stdbit_stub.h
67-
SRCS
68-
stdbit_test.c
69-
COMPILE_OPTIONS
70-
-Wall
71-
-Werror
72-
DEPENDS
73-
libc.include.llvm-libc-macros.stdbit_macros
74-
libc.include.llvm_libc_common_h
75-
libc.include.stdbit
76-
libc.src.assert.__assert_fail
77-
# Intentionally do not depend on libc.src.stdbit.*. The include test is
78-
# simply testing the macros provided by stdbit.h, not the implementation
79-
# of the underlying functions which the type generic macros may dispatch
80-
# to.
81-
)
82-
endif()
39+
add_libc_test(
40+
stdbit_test
41+
SUITE
42+
libc_include_tests
43+
HDRS
44+
stdbit_stub.h
45+
SRCS
46+
stdbit_test.cpp
47+
DEPENDS
48+
libc.include.llvm-libc-macros.stdbit_macros
49+
libc.include.llvm_libc_common_h
50+
libc.include.stdbit
51+
# Intentionally do not depend on libc.src.stdbit.*. The include test is
52+
# simply testing the macros provided by stdbit.h, not the implementation
53+
# of the underlying functions which the type generic macros may dispatch
54+
# to.
55+
)
56+
add_libc_test(
57+
stdbit_c_test
58+
C_TEST
59+
UNIT_TEST_ONLY
60+
SUITE
61+
libc_include_tests
62+
HDRS
63+
stdbit_stub.h
64+
SRCS
65+
stdbit_test.c
66+
COMPILE_OPTIONS
67+
-Wall
68+
-Werror
69+
DEPENDS
70+
libc.include.llvm-libc-macros.stdbit_macros
71+
libc.include.llvm_libc_common_h
72+
libc.include.stdbit
73+
libc.src.assert.__assert_fail
74+
# Intentionally do not depend on libc.src.stdbit.*. The include test is
75+
# simply testing the macros provided by stdbit.h, not the implementation
76+
# of the underlying functions which the type generic macros may dispatch
77+
# to.
78+
)
8379

8480
add_libc_test(
8581
stdckdint_test

0 commit comments

Comments
 (0)