This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

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


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]