[libc-commits] [libc] [libc] Add compile tests for each public header (PR #122527)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Tue Jan 14 09:59:18 PST 2025
================
@@ -483,3 +483,69 @@ add_libc_test(
DEPENDS
libc.include.llvm-libc-macros.math_function_macros
)
+
+# Test `#include <...>` of each header in each available language mode.
+# This is gated on -DLLVM_LIBC_BUILD_HEADER_TESTS=ON until all the bugs
+# in headers are fixed so the tests all compile.
+set(TEST_STDC_VERSIONS 89;99;11;17;23)
+set(TEST_STDCXX_VERSIONS 03;11;14;17;20;23;26)
+
+function(add_header_test target_name source_file deps std_mode)
+ if(LLVM_LIBC_BUILD_HEADER_TESTS)
+ add_libc_test(
+ ${target_name}
+ C_TEST
+ HERMETIC_TEST_ONLY
+ SUITE
+ libc_include_tests
+ SRCS
+ ${source_file}
+ COMPILE_OPTIONS
+ -Werror
+ -Wall
+ -Wextra
----------------
nickdesaulniers wrote:
>From what I can recall, the use of `<>` vs `""` for `#include` preprocessor directives changes one of the numbers in the generated line markers. Those control whether the diagnostic is considered from a system header or not. Unless `-Wsystem-headers` is set, such diagnostics are elided rather than emitted. There's a few other command line flags, a pragma, and specific system directories that can change this, too. I remember setting it once, seeing the additional diagnostics from my system headers, and thinking "ok, well, won't be fixing those any time soon, better leave that warning flag off for now..."
https://github.com/llvm/llvm-project/pull/122527
More information about the libc-commits
mailing list