public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Olivier Hainque <hainque@adacore.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Olivier Hainque <hainque@adacore.com>
Subject: [patch] Prevent secondary warning from diagnostic tweak in  gthr-vxworks.h
Date: Fri, 30 Sep 2022 17:59:59 +0200	[thread overview]
Message-ID: <54C14E56-2BC8-4F58-AF84-BAB4F463F531@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]


Within gthr-vxworks.h, we prevent C++ errors from missing
declarations in some system headers by prepending their inclusion
with a

    #pragma GCC diagnostic ignored "-Wstrict-prototypes"

But Wstrict-prototypes is internally registered as valid for
C/ObjC only, not C++, and this trick in turn triggers a Wpragma
warning with -Wsystem-headers.

This change just arranges to ignore the secondary warning locally.

We have been using this for a while with gcc-11 based toolchains,
where the only effect was the intended disappearance of a test failure
observed on g++.dg/warn/Wstringop-overflow-6.C.

Sanity checked with a build + basic testing with a gcc-12
compiler, then a mainline build for arm-vxworks7r2.

Cheers

Olivier

2021-02-03  Olivier Hainque  <hainque@adacore.com>

        * config/gthr-vxworks.h: Prevent Wpragma warning for the
        pragma diagnostics on Wstrict-prototypes.


[-- Attachment #2: 0010-Prevent-secondary-warning-from-diagnostic-tweak-in-g.patch --]
[-- Type: application/octet-stream, Size: 1784 bytes --]

From 97e4ee1d69a350e8e4bac25265e27f207baf2850 Mon Sep 17 00:00:00 2001
From: Olivier Hainque <hainque@adacore.com>
Date: Thu, 3 Feb 2022 15:57:32 +0000
Subject: [PATCH 10/18] Prevent secondary warning from diagnostic tweak in
 gthr-vxworks.h

Within gthr-vxworks.h, we prevent C++ errors from missing
declarations in some system headers by prepending their inclusion
with a

    #pragma GCC diagnostic ignored "-Wstrict-prototypes"

But Wstrict-prototypes is internally registered as valid for
C/ObjC only, not C++, and this trick in turn triggers a Wpragma
warning with -Wsystem-headers.

This change just arranges to ignore the secondary warning locally.

2021-02-03  Olivier Hainque  <hainque@adacore.com>

	* config/gthr-vxworks.h: Prevent Wpragma warning for the
	pragma diagnostics on Wstrict-prototypes.
---
 libgcc/config/gthr-vxworks.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libgcc/config/gthr-vxworks.h b/libgcc/config/gthr-vxworks.h
index 9861a11511a..31c4b9f2557 100644
--- a/libgcc/config/gthr-vxworks.h
+++ b/libgcc/config/gthr-vxworks.h
@@ -38,8 +38,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <_vxworks-versions.h>
 
 /* Some VxWorks headers profusely use typedefs of a pointer to a function with
-   undefined number of arguments.  */
+   undefined number of arguments.  Arrange to ignore declaration errors in C++,
+   which is achievable by ignoring Wstrict-prototypes diagnostics even when the
+   option is registered as only valid for c/objc.  */
 #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wpragmas"
   #pragma GCC diagnostic ignored "-Wstrict-prototypes"
   #include <semLib.h>
 #pragma GCC diagnostic pop
-- 
2.25.1


[-- Attachment #3: Type: text/plain, Size: 2 bytes --]




                 reply	other threads:[~2022-09-30 16:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=54C14E56-2BC8-4F58-AF84-BAB4F463F531@adacore.com \
    --to=hainque@adacore.com \
    --cc=gcc-patches@gcc.gnu.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: link
Be 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).