public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-389] ibstdc++: Shut up -Wattribute-alias warning [PR109694]
Date: Tue,  2 May 2023 08:59:07 +0000 (GMT)	[thread overview]
Message-ID: <20230502085907.7FBB23858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:87de39e4c3686535728f3a347f772e73af4cf262

commit r14-389-g87de39e4c3686535728f3a347f772e73af4cf262
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue May 2 10:58:19 2023 +0200

    ibstdc++: Shut up -Wattribute-alias warning [PR109694]
    
    I've followed what other files do, using attribute alias with not really
    matching function type (after all, it isn't really possible when it is a
    constructor), but seems I've missed it warns:
    ../../../../../libstdc++-v3/src/c++98/ios_init.cc:203:8: warning: ‘void std::ios_base_library_init()’ alias between functions of incompatible types ‘void()’ and ‘void
    +(std::ios_base::Init::)()’ [-Wattribute-alias=]
      203 |   void ios_base_library_init (void)
          |        ^~~~~~~~~~~~~~~~~~~~~
    ../../../../../libstdc++-v3/src/c++98/ios_init.cc:78:3: note: aliased declaration here
       78 |   ios_base::Init::Init()
          |   ^~~~~~~~
    The PR talks about clang++ warning there (which I think isn't really
    supported, libstdc++ sources ought to be built by GCC), but it warns
    when built with GCC too.
    
    The following patch fixes it by doing what other libstdc++ sources do in
    those cases.
    
    2023-05-02  Jakub Jelinek  <jakub@redhat.com>
    
            PR libstdc++/109694
            * src/c++98/ios_init.cc: Add #pragma GCC diagnostic ignored for
            -Wattribute-alias.

Diff:
---
 libstdc++-v3/src/c++98/ios_init.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libstdc++-v3/src/c++98/ios_init.cc b/libstdc++-v3/src/c++98/ios_init.cc
index 0c2ba945f36..ace94b992b5 100644
--- a/libstdc++-v3/src/c++98/ios_init.cc
+++ b/libstdc++-v3/src/c++98/ios_init.cc
@@ -200,6 +200,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   }
 
 #ifdef _GLIBCXX_SYMVER_GNU
+#pragma GCC diagnostic ignored "-Wattribute-alias"
+
   void ios_base_library_init (void)
   __attribute__((alias ("_ZNSt8ios_base4InitC1Ev")));
 #endif

                 reply	other threads:[~2023-05-02  8:59 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=20230502085907.7FBB23858D1E@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).