[libc-commits] [libc] [libc][cmake] Tidy compiler includes (PR #66783)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Wed Sep 20 04:02:38 PDT 2023


================
@@ -189,13 +188,10 @@ function(_build_gpu_objects fq_target_name internal_target_name)
       )
 
       target_compile_options(${gpu_target_name} PRIVATE ${compile_options})
-      target_include_directories(${gpu_target_name} PRIVATE ${include_dirs})
+      target_include_directories(${gpu_target_name} SYSTEM PRIVATE ${LIBC_INCLUDE_DIR})
----------------
gchatelet wrote:

> Marking include directory as "system" will hide warnings from the headers located in this directory.

Yes this is on purpose. At least for `clang-tidy` we don't want the libc generated headers to participate in the `clang-tidy` checks (see https://github.com/llvm/llvm-project/pull/66477#issuecomment-1724336157)

`-Wsystem-headers` is indeed a good way to catch errors in generated headers but it will potentially also catch warnings in the headers we don't own (clang provided headers or linux headers). WDYT @sivachandra ?

https://github.com/llvm/llvm-project/pull/66783


More information about the libc-commits mailing list