public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kai Tietz <ktietz70@googlemail.com>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch c++]:PR/15774 - Conflicting function decls not diagnosed (this time really for 15774)
Date: Sun, 26 Dec 2010 16:56:00 -0000	[thread overview]
Message-ID: <AANLkTinzaGiLOM+k2QKknmNEPJEt1Y=CSREUecP4ADsJ@mail.gmail.com> (raw)
In-Reply-To: <4D1613C3.7020905@redhat.com>

2010/12/25 Jason Merrill <jason@redhat.com>:
> On 12/24/2010 05:24 PM, Kai Tietz wrote:
>>
>> Ok, I'll apply it tomorrow. No the error message doesn't display the
>> attribute as it displays a decl.  This would be possibly another task
>> to display attributes (at least a wished limited set) also for
>> declarations.
>
> I think we want to print whatever attributes cause the attributed entity to
> be considered distinct from the non-attributed version, rather than a
> redeclaration.
>
> Thinking about it that way, I think your patch actually isn't the right way
> to handle this: in pr15774-1.C, the two foos are the same foo, just the
> change in attributes is ill-formed.  So decls_match should return 1, but we
> should complain about attribute mismatch in duplicate_decls, perhaps just
> before the call to merge_decl_attributes.
>
> Jason
>

Hmm, not sure. Case 2 is simply ill-formed, but doesn't cause wrong
code. But case 1 in fact can produce wrong code. See as expample

extern void foo (int);
void doo(int a) { foo(a); }
void __attribute__((stdcall)) foo (int i) { }

As here in function "doo" the "foo" gets called with cdecl
calling-convention, but its implementation gets "stdcall" one, which
are incompatible and therefore lead to wrong-code.

The -2 case doesn't have this issue

Kai
-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

  reply	other threads:[~2010-12-25 16:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTinGynF-v_UmCCNJrH7GEOcFQDC-5RHc4XbK+Fr2@mail.gmail.com>
2010-12-22 23:48 ` Kai Tietz
2010-12-23 12:33   ` Kai Tietz
2010-12-25  6:27     ` Jason Merrill
2010-12-25  6:27       ` Kai Tietz
2010-12-25 16:00         ` Kai Tietz
2011-01-04  3:41           ` Dave Korn
2011-01-04  6:09             ` Dave Korn
2010-12-26  9:50         ` Jason Merrill
2010-12-26 16:56           ` Kai Tietz [this message]
2010-12-26 18:19             ` Jason Merrill

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='AANLkTinzaGiLOM+k2QKknmNEPJEt1Y=CSREUecP4ADsJ@mail.gmail.com' \
    --to=ktietz70@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /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).