[PATCH v3 08/19] nss: Suppress clang -Wstring-plus-int on __nss_shlib_revision definition

H.J. Lu hjl.tools@gmail.com
Fri Oct 31 23:38:42 GMT 2025


On Sat, Nov 1, 2025 at 4:03 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> clang issues an warning that adding 'unsigned long' to a string does not
> append to the string.
> ---
>  nss/nss_module.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/nss/nss_module.c b/nss/nss_module.c
> index 3cd1940b225..ac94e4d3f02 100644
> --- a/nss/nss_module.c
> +++ b/nss/nss_module.c
> @@ -41,7 +41,7 @@
>     pointer manipulation.  The "-1" accounts for the trailing NUL
>     included in the sizeof.  */
>  static const char *const __nss_shlib_revision
> -       = LIBNSS_FILES_SO + sizeof("libnss_files.so") - 1;
> +       = &LIBNSS_FILES_SO[sizeof("libnss_files.so") - 1];
>
>  /* 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
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.

-- 
H.J.


More information about the Libc-alpha mailing list