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] Add clang specific warnings suppress macros Date: Wed, 17 Apr 2024 20:04:31 +0000 (GMT) [thread overview] Message-ID: <20240417200431.C378E3858D3C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e182dc08d71c8268495acc1a980a7fb57fa84103 commit e182dc08d71c8268495acc1a980a7fb57fa84103 Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Tue Sep 12 15:45:24 2023 -0300 Add clang specific warnings suppress macros Four new macros are added: * DIAG_{PUSH,POP}_NEEDS_COMMENT_CLANG are similar to DIAG_{PUSH,POP}_NEEDS_COMMENT, but enable clang specific pragmas to handle warnings for options only supported by clang. * DIAG_IGNORE_NEEDS_COMMENT_{CLANG,GCC} are similar to DIAG_IGNORE_NEEDS_COMMENT, but enable the warning suppression only for the referenced compiler. Diff: --- include/libc-diag.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/libc-diag.h b/include/libc-diag.h index 4b1c916756..7666a386f3 100644 --- a/include/libc-diag.h +++ b/include/libc-diag.h @@ -38,6 +38,16 @@ /* Pop diagnostic state. */ #define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop") +/* These macros are used to push/pop diagnostic states for warnings only + supported by clang. */ +#ifdef __clang__ +# define DIAG_PUSH_NEEDS_COMMENT_CLANG _Pragma ("clang diagnostic push") +# define DIAG_POP_NEEDS_COMMENT_CLANG _Pragma ("clang diagnostic pop") +#else +# define DIAG_PUSH_NEEDS_COMMENT_CLANG +# define DIAG_POP_NEEDS_COMMENT_CLANG +#endif + #define _DIAG_STR1(s) #s #define _DIAG_STR(s) _DIAG_STR1(s) @@ -71,4 +81,16 @@ # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) #endif +/* Similar to DIAG_IGNORE_NEEDS_COMMENT, these macros should be used + to suppress warning supported by the specific compiler. */ +#ifndef __clang__ +# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \ + DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING) +# define DIAG_IGNORE_NEEDS_COMMENT_CLANG(version, option) +#else +# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) +# define DIAG_IGNORE_NEEDS_COMMENT_CLANG(version, option) \ + _Pragma (_DIAG_STR (clang diagnostic ignored option)) +#endif + #endif /* libc-diag.h */
next reply other threads:[~2024-04-17 20:04 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-17 20:04 Adhemerval Zanella [this message] -- strict thread matches above, loose matches on Subject: below -- 2024-04-02 15:50 Adhemerval Zanella 2024-02-09 17:28 Adhemerval Zanella 2024-02-07 14:04 Adhemerval Zanella 2024-01-29 17:54 Adhemerval Zanella 2023-12-21 18:50 Adhemerval Zanella 2023-09-28 17:49 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=20240417200431.C378E3858D3C@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).