]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libsystemd: Skip _sd-common.h include check when __clang_analyzer__ is defined
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 20 Apr 2025 10:25:42 +0000 (12:25 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 23 Apr 2025 09:50:32 +0000 (11:50 +0200)
This check doesn't work properly when tools such as clang-tidy are
analyzing headers. Since we don't care about the check in that case,
skip it if __clang_analyzer__ is defined similar to how we skip it as
well if __COVERITY__ is defined.

src/systemd/_sd-common.h

index 5792dd8106d167c8ba7f7c05cc5746227c808228..00537eaf16453b9615f9ba446d61f9385f455194 100644 (file)
@@ -19,7 +19,7 @@
 
 /* This is a private header; never even think of including this directly! */
 
-#if defined(__INCLUDE_LEVEL__) && __INCLUDE_LEVEL__ <= 1 && !defined(__COVERITY__)
+#if defined(__INCLUDE_LEVEL__) && __INCLUDE_LEVEL__ <= 1 && !defined(__COVERITY__) && !defined(__clang_analyzer__)
 #  error "Do not include _sd-common.h directly; it is a private header."
 #endif