From: Martin Sebor <msebor@gmail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>,
Joseph Myers <joseph@codesourcery.com>,
libstdc++ <libstdc++@gcc.gnu.org>
Subject: Re: [PATCH] detect incompatible aliases (PR c/81854)
Date: Fri, 18 Aug 2017 18:22:00 -0000 [thread overview]
Message-ID: <9d38b17a-b458-5c9c-ee08-809f78a69c1d@gmail.com> (raw)
In-Reply-To: <20170818131046.GF4582@redhat.com>
On 08/18/2017 07:10 AM, Jonathan Wakely wrote:
> On 17/08/17 21:21 -0600, Martin Sebor wrote:
>> Joseph, while looking into implementing enhancement your request
>> pr81824 I noticed that GCC silently accepts incompatible alias
>> declarations (pr81854) so as sort of a proof-concept for the
>> former I enhanced the checking already done for other kinds of
>> incompatibilities to also detect those mentioned in the latter
>> bug. Attached is this patch, tested on x85_64-linux.
>>
>> Jonathan, the patch requires suppressing the warning in libstdc++
>> compatibility symbol definitions in compatibility.cc. I couldn't
>> find a way to do it without the suppression but I'd be happy to
>> try again if you have an idea for how.
>
> Doing it that way is fine, but ...
>
>> diff --git a/libstdc++-v3/src/c++98/compatibility.cc
>> b/libstdc++-v3/src/c++98/compatibility.cc
>> index 381f4c4..5f56b9e 100644
>> --- a/libstdc++-v3/src/c++98/compatibility.cc
>> +++ b/libstdc++-v3/src/c++98/compatibility.cc
>> @@ -213,6 +213,11 @@ _ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv
>> _ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv
>> */
>>
>> +// Disable warning about declaring aliases between functions with
>> +// incompatible types.
>> +#pragma GCC diagnostic push
>> +#pragma GCC diagnostic ignored "-Wattributes"
>> +
>
> Could this be moved closer to the point where it's needed?
>
> It's not needed until after line 361, right?
Sure. The other possibility that I forgot to mention is to
declare the alias without a prototype, which in C++ looks
like this:
void foo (...);
The patch would then look like this. Do you have a preference
between these two approaches?
Martin
diff --git a/libstdc++-v3/src/c++98/compatibility.cc
b/libstdc++-v3/src/c++98/compatibility.cc
index 381f4c4..b49a5ca 100644
--- a/libstdc++-v3/src/c++98/compatibility.cc
+++ b/libstdc++-v3/src/c++98/compatibility.cc
@@ -367,13 +367,13 @@ _GLIBCXX_END_NAMESPACE_VERSION
#define _GLIBCXX_3_4_SYMVER(XXname, name) \
extern "C" void \
- _X##name() \
+ _X##name(...) \
__attribute__ ((alias(#XXname))); \
asm (".symver " "_X" #name "," #name "@GLIBCXX_3.4");
#define _GLIBCXX_3_4_5_SYMVER(XXname, name) \
extern "C" void \
- _Y##name() \
+ _Y##name(...) \
__attribute__ ((alias(#XXname))); \
asm (".symver " "_Y" #name "," #name "@@GLIBCXX_3.4.5");
next prev parent reply other threads:[~2017-08-18 14:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 8:10 Martin Sebor
2017-08-18 13:10 ` Joseph Myers
2017-08-18 13:57 ` Jonathan Wakely
2017-08-18 18:22 ` Martin Sebor [this message]
2017-08-18 18:37 ` Jonathan Wakely
2017-08-18 21:02 ` Martin Sebor
2017-09-02 22:50 ` [PING] " Martin Sebor
2017-09-12 16:17 ` Joseph Myers
2017-09-18 21:21 ` Martin Sebor
2017-09-18 21:44 ` Joseph Myers
2017-09-19 15:16 ` Martin Sebor
2017-09-20 15:37 ` Steve Ellcey
2017-09-20 16:17 ` Martin Sebor
2017-09-20 16:38 ` Steve Ellcey
2017-09-20 17:23 ` Steve Ellcey
2017-09-20 17:32 ` Martin Sebor
2017-09-20 17:45 ` Steve Ellcey
2017-09-20 18:05 ` Joseph Myers
2017-09-20 18:01 ` Joseph Myers
2017-09-20 18:08 ` Steve Ellcey
2017-09-20 18:14 ` Joseph Myers
2017-09-20 21:01 ` Joseph Myers
2017-09-20 21:32 ` Martin Sebor
2017-09-20 21:45 ` Joseph Myers
2017-10-02 19:49 ` Steve Ellcey
2017-10-02 19:53 ` Joseph Myers
2017-10-02 20:17 ` Martin Sebor
2017-10-03 21:41 ` Andreas Schwab
2017-10-03 23:43 ` Martin Sebor
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=9d38b17a-b458-5c9c-ee08-809f78a69c1d@gmail.com \
--to=msebor@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=joseph@codesourcery.com \
--cc=jwakely@redhat.com \
--cc=libstdc++@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).