public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Shut up -Wattribute-alias warning [PR109694]
@ 2023-05-02  8:42 Jakub Jelinek
  2023-05-02  8:48 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2023-05-02  8:42 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

Hi!

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.

Tested on x86_64-linux, ok for trunk and later 13.2?

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.

--- libstdc++-v3/src/c++98/ios_init.cc.jj	2023-04-28 10:49:22.105352644 +0200
+++ libstdc++-v3/src/c++98/ios_init.cc	2023-05-02 10:24:09.073741162 +0200
@@ -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

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libstdc++: Shut up -Wattribute-alias warning [PR109694]
  2023-05-02  8:42 [PATCH] libstdc++: Shut up -Wattribute-alias warning [PR109694] Jakub Jelinek
@ 2023-05-02  8:48 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2023-05-02  8:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: libstdc++, gcc-patches

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

On Tue, 2 May 2023 at 09:42, Jakub Jelinek wrote:

> Hi!
>
> 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.
>
> Tested on x86_64-linux, ok for trunk and later 13.2?
>

OK, thanks.


>
> 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.
>
> --- libstdc++-v3/src/c++98/ios_init.cc.jj       2023-04-28
> 10:49:22.105352644 +0200
> +++ libstdc++-v3/src/c++98/ios_init.cc  2023-05-02 10:24:09.073741162 +0200
> @@ -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
>
>         Jakub
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-02  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02  8:42 [PATCH] libstdc++: Shut up -Wattribute-alias warning [PR109694] Jakub Jelinek
2023-05-02  8:48 ` Jonathan Wakely

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).