[PATCH 10/59] nss: Suppress clang -Wstring-plus-int on __nss_shlib_revision definition

Adhemerval Zanella adhemerval.zanella@linaro.org
Fri Oct 17 19:12:45 GMT 2025


clang issues an warning that adding 'unsigned long' to a string does not
append to the string.
---
 nss/nss_module.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/nss/nss_module.c b/nss/nss_module.c
index 3cd1940b22..9087d3c429 100644
--- a/nss/nss_module.c
+++ b/nss/nss_module.c
@@ -33,6 +33,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <pointer_guard.h>
+#include <sysdep.h>
+#include <libc-diag.h>
 
 /* Suffix after .so of NSS service modules.  This is a bit of magic,
    but we assume LIBNSS_FILES_SO looks like "libnss_files.so.2" and we
@@ -40,8 +42,14 @@
    except through the auto-generated lib-names.h and some static
    pointer manipulation.  The "-1" accounts for the trailing NUL
    included in the sizeof.  */
+
+/* clang issues an warning adding 'unsigned long' to a string does not append
+   to the string.  e.  */
+DIAG_PUSH_NEEDS_COMMENT_CLANG;
+DIAG_IGNORE_NEEDS_COMMENT_CLANG (18, "-Wstring-plus-int");
 static const char *const __nss_shlib_revision
 	= LIBNSS_FILES_SO + sizeof("libnss_files.so") - 1;
+DIAG_POP_NEEDS_COMMENT_CLANG;
 
 /* A single-linked list used to implement a mapping from service names
    to NSS modules.  (Most systems only use five or so modules, so a
-- 
2.43.0



More information about the Libc-alpha mailing list