[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2021-08-16 Thread sbergman at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #10 from Stephan Bergmann  ---
(In reply to Andrew Pinski from comment #9)
> There does seems some inconsitency though:
> inline namespace n __attribute__((__abi_tag__(""))) {}
> is rejected but
> inline namespace n __attribute__((__abi_tag__())) {}
> 
> Is not.

How is that inconsistent?  When providing the empty string as argument, it is
rejected with "arguments to the ‘abi_tag’ attribute must contain valid
identifiers" (just like e.g.

> inline namespace n __attribute__((__abi_tag__("+"))) {}

would be, too).  But when providing no argument, the behavior documented in
attachment 36974 "updated documentation patch" kicks in.

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2021-08-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #9 from Andrew Pinski  ---
There does seems some inconsitency though:
inline namespace n __attribute__((__abi_tag__(""))) {}
is rejected but
inline namespace n __attribute__((__abi_tag__())) {}

Is not.

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2015-12-09 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #5 from Jonathan Wakely  ---
(In reply to Stephan Bergmann from comment #4)
> Created attachment 36973 [details]
> proposed documentation patch

is used as the ABI tag

?

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2015-12-09 Thread sbergman at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #3 from Stephan Bergmann  ---
(In reply to Jakub Jelinek from comment #1)
> So, if there is a bug, I'd say just that this is not well documented.

See the attached Fix-abi_tag-doc.patch.


(In reply to Jonathan Wakely from comment #2)
> although I thought the correct syntax in that case was:
> 
> inline namespace n __attribute__((__abi_tag__)) {}
> 
> i.e. no parentheses after __abi_tag__

Would that be considered something worthwhile to change, to only accept

  __attribute__((__abi_tag__))

but reject

  __attribute__((__abi_tag__()))

?

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2015-12-09 Thread sbergman at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #4 from Stephan Bergmann  ---
Created attachment 36973
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36973=edit
proposed documentation patch

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2015-12-09 Thread sbergman at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #8 from Stephan Bergmann  ---
So if the documentation patch is acceptable and somebody with commit rights can
push it, we can close this issue as NOTABUG then.

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2015-12-09 Thread sbergman at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #6 from Stephan Bergmann  ---
Created attachment 36974
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36974=edit
updated documentation patch

(In reply to Jonathan Wakely from comment #5)
> is used as the ABI tag

yeah, probably sounds better

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2015-12-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #7 from Jakub Jelinek  ---
(In reply to Stephan Bergmann from comment #3)
> Would that be considered something worthwhile to change, to only accept
> 
>   __attribute__((__abi_tag__))
> 
> but reject
> 
>   __attribute__((__abi_tag__()))
> 
> ?

GCC generally treats both forms the same, try any other attribute that accepts
zero arguments.

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2015-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||jason at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
On non-namespace there is a clear requirement that it has at least one
argument.
For namespace, the code has for the case of zero arguments to the attribute
in gcc/cp/name-lookup.c (handle_namespace_attrs):
  if (!args)
{
  tree dn = DECL_NAME (ns);
  args = build_string (IDENTIFIER_LENGTH (dn) + 1,
   IDENTIFIER_POINTER (dn));
  TREE_TYPE (args) = char_array_type_node;
  args = fix_string_type (args);
  args = build_tree_list (NULL_TREE, args);
}
That code doesn't look like something one would wrote without thinking what the
behavior should be for no arguments, so I believe that it intentionally uses
the name of the namespace in that case.
So, if there is a bug, I'd say just that this is not well documented.

[Bug c++/68257] Reject empty abi_tag attribute on inline namespace

2015-12-07 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257

--- Comment #2 from Jonathan Wakely  ---
Yes, I was mistaken in my post to the mailing list. It's by design that it uses
the name of the inline namespace as the tag name if no arguments are given,
although I thought the correct syntax in that case was:

inline namespace n __attribute__((__abi_tag__)) {}

i.e. no parentheses after __abi_tag__