[master] e509aace2 Flexelint silencing for new HDR() macro

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Apr 14 15:47:07 UTC 2025


commit e509aace226eec1f3bd31df91ddd5a3b649da90e
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Apr 14 12:31:26 2025 +0200

    Flexelint silencing for new HDR() macro
    
    The "local struct member ... not referenced" warning can only be suppressed
    using name::member. Because our struct used for the compound literal is
    anonymous, we have no name:: component and any silencing on member names will
    apply globally to any other anonymous struct with the same name.
    
    To avoid accidental silencing, we use the _hdr_ prefix.

diff --git a/include/vrt.h b/include/vrt.h
index 59d461087..2252cdc74 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -701,10 +701,12 @@ typedef const struct {
 	const char	str[];
 } *hdr_t;
 
+//lint -esym(754, _hdr_s, _hdr_l) local struct member ... not referenced
+//lint -emacro(740, HDR) unusual cast
 #define HDR(name)							\
 	((hdr_t)&(const struct {					\
-		unsigned char _l;					\
-		char _s[sizeof(name ":")];				\
+		unsigned char _hdr_l;					\
+		char _hdr_s[sizeof(name ":")];				\
 	}){ sizeof(name), name ":" })
 
 #define CHECK_HDR(hdr)							\


More information about the varnish-commit mailing list