This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH] Fix -Wattributes warning in libstdc++ (PR libstdc++/89402)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>, Martin Sebor <msebor at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Fri, 22 Feb 2019 19:47:36 +0100
- Subject: [PATCH] Fix -Wattributes warning in libstdc++ (PR libstdc++/89402)
- References: <20190220080731.GC2135@tucnak> <20190222011032.GA29002@redhat.com> <dde0291f-a953-3d84-4ecf-9fb988760e62@gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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