public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] nss: Suppress nss_module.c warning on clang Date: Thu, 31 Mar 2022 19:05:04 +0000 (GMT) [thread overview] Message-ID: <20220331190504.A837C3839425@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2009ec1584695a3a859796d16e61660d37d3b062 commit 2009ec1584695a3a859796d16e61660d37d3b062 Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Thu Mar 10 08:31:06 2022 -0300 nss: Suppress nss_module.c warning on clang Diff: --- include/libc-diag.h | 13 +++++++++++++ nss/nss_module.c | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/include/libc-diag.h b/include/libc-diag.h index e1dbe99eb3..61e33d6c36 100644 --- a/include/libc-diag.h +++ b/include/libc-diag.h @@ -71,6 +71,19 @@ # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) #endif +/* Same as before, but only enables the warning suppression for clang. + It is for clang-only issues and options that only clang emits. */ +#ifdef __clang__ +# define DIAG_PUSH_NEEDS_COMMENT_CLANG _Pragma ("clang diagnostic push") +# define DIAG_POP_NEEDS_COMMENT_CLANG _Pragma ("clang diagnostic pop") +# define DIAG_IGNORE_NEEDS_COMMENT_CLANG(version, option) \ + _Pragma (_DIAG_STR (clang diagnostic ignored option)) +#else +# define DIAG_PUSH_NEEDS_COMMENT_CLANG +# define DIAG_POP_NEEDS_COMMENT_CLANG +# define DIAG_IGNORE_NEEDS_COMMENT_CLANG(version, option) +#endif + /* Some warnings are not support for all compilers. */ #ifndef __clang__ # define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \ diff --git a/nss/nss_module.c b/nss/nss_module.c index f00bbd9e1a..852dc991b4 100644 --- a/nss/nss_module.c +++ b/nss/nss_module.c @@ -33,6 +33,7 @@ #include <stdlib.h> #include <string.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 +41,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, however it is exactly what code means here. */ +DIAG_PUSH_NEEDS_COMMENT_CLANG; +DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-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
next reply other threads:[~2022-03-31 19:05 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-31 19:05 Adhemerval Zanella [this message] -- strict thread matches above, loose matches on Subject: below -- 2024-04-17 20:05 Adhemerval Zanella 2024-04-02 15:51 Adhemerval Zanella 2024-02-09 17:29 Adhemerval Zanella 2024-02-07 14:05 Adhemerval Zanella 2024-01-29 17:55 Adhemerval Zanella 2023-12-21 18:51 Adhemerval Zanella 2023-09-28 17:50 Adhemerval Zanella 2023-08-30 12:34 Adhemerval Zanella 2023-02-09 19:46 Adhemerval Zanella 2022-10-28 17:39 Adhemerval Zanella 2022-10-04 12:57 Adhemerval Zanella 2022-06-09 21:18 Adhemerval Zanella 2022-06-09 13:15 Adhemerval Zanella 2022-06-03 14:04 Adhemerval Zanella 2022-05-13 14:18 Adhemerval Zanella 2022-05-12 19:32 Adhemerval Zanella 2022-05-10 18:22 Adhemerval Zanella 2022-04-29 14:02 Adhemerval Zanella 2022-04-04 12:52 Adhemerval Zanella 2022-03-29 20:28 Adhemerval Zanella 2022-03-16 18:00 Adhemerval Zanella 2022-03-15 18:38 Adhemerval Zanella 2022-03-11 17:22 Adhemerval Zanella 2022-03-10 19:21 Adhemerval Zanella
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220331190504.A837C3839425@sourceware.org \ --to=azanella@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).