diff mbox series

Fix -Wattributes warning in libstdc++ (PR libstdc++/89402)

Message ID 20190222184736.GF7611@tucnak
State New
Headers show
Series Fix -Wattributes warning in libstdc++ (PR libstdc++/89402) | expand

Commit Message

Jakub Jelinek Feb. 22, 2019, 6:47 p.m. UTC
On Fri, Feb 22, 2019 at 08:35:25AM -0700, Martin Sebor wrote:
> > /home/jwakely/src/gcc/libstdc++-v3/src/c++98/compatibility-ldbl.cc:78:65:
> > warning: ‘pure’ attribute on function returning ‘void’ [-Wattributes]
> >    78 |   _GLIBCXX_PURE __attribute__((alias ("_ZNKSt3tr14hashIeEclEe")));
> >       |                                                                 ^
> 
> Are the attributes on this alias ever considered in calls to it?
> If not (and assuming there's a way to tell, which I think there
> should be but haven't verified it) the warning could be relaxed

There is no point in relating this, this alias is just a hack in a hack
to save a few bytes of code.

I've now finally bootstrapped/regtested on {powerpc64le,s390x}-linux
following patch, without it I indeed get those
../../../../libstdc++-v3/src/c++98/compatibility-ldbl.cc:78:65: warning: 'pure' attribute on function returning 'void' [-Wattributes]
warnings, with the patch I don't get any warnings on compatibility-ldbl.cc
anymore.  Ok for trunk?

2019-02-22  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/89402
	* src/c++98/compatibility-ldbl.cc (_ZNKSt4hashIeEclEe): Change return
	type to std::size_t and argument to type to long double.



	Jakub

Comments

Jonathan Wakely Feb. 22, 2019, 7:03 p.m. UTC | #1
On Fri, 22 Feb 2019 at 18:47, Jakub Jelinek wrote:
>
> On Fri, Feb 22, 2019 at 08:35:25AM -0700, Martin Sebor wrote:
> > > /home/jwakely/src/gcc/libstdc++-v3/src/c++98/compatibility-ldbl.cc:78:65:
> > > warning: ‘pure’ attribute on function returning ‘void’ [-Wattributes]
> > >    78 |   _GLIBCXX_PURE __attribute__((alias ("_ZNKSt3tr14hashIeEclEe")));
> > >       |                                                                 ^
> >
> > Are the attributes on this alias ever considered in calls to it?
> > If not (and assuming there's a way to tell, which I think there
> > should be but haven't verified it) the warning could be relaxed
>
> There is no point in relating this, this alias is just a hack in a hack
> to save a few bytes of code.
>
> I've now finally bootstrapped/regtested on {powerpc64le,s390x}-linux
> following patch, without it I indeed get those
> ../../../../libstdc++-v3/src/c++98/compatibility-ldbl.cc:78:65: warning: 'pure' attribute on function returning 'void' [-Wattributes]
> warnings, with the patch I don't get any warnings on compatibility-ldbl.cc
> anymore.  Ok for trunk?

OK, thanks.
diff mbox series

Patch

--- libstdc++-v3/src/c++98/compatibility-ldbl.cc.jj	2019-02-20 08:57:18.161103140 +0100
+++ libstdc++-v3/src/c++98/compatibility-ldbl.cc	2019-02-22 09:17:54.619348391 +0100
@@ -74,7 +74,7 @@  namespace std _GLIBCXX_VISIBILITY(defaul
 // std::tr1::hash<long double>::operator()
 // and std::hash<long double>::operator()
 // are the same, no need to duplicate them.
-extern "C" void _ZNKSt4hashIeEclEe (void)
+extern "C" std::size_t _ZNKSt4hashIeEclEe (long double)
   _GLIBCXX_PURE __attribute__((alias ("_ZNKSt3tr14hashIeEclEe")));
 
 #endif