abi_tag questions

Stephan Bergmann sbergman@redhat.com
Wed Nov 4 09:07:00 GMT 2015


I have two questions regarding the abi_tag attribute (as documented at 
<https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html>):


1  "The attribute can also be applied to an inline namespace, but does 
not affect the mangled name of the namespace; in this case it is only 
used for -Wabi-tag warnings and automatic tagging of functions and 
variables."

I would naively assume that the "automatic tagging" part means that with

> inline namespace n __attribute__((__abi_tag__("t"))) { void f() {} }

n::f would be tagged, but that appears not to be the case?


2  "The argument can be a list of strings of arbitrary length."

Does that mean the list can be empty?

> void f() __attribute__((__abi_tag__()));

fails with "error: wrong number of arguments specified for ‘__abi_tag__’ 
attribute" while

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

is accepted by recent trunk GCC (as well as older versions).

(I stumbled across the latter on Fedora 23, where libstdc++'s 
<https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=226022> "Fix 
abi_tag in special modes" is not yet fixed, so it contains such an empty 
abi_tag on an inline namespace, and Clang with patch 
<http://reviews.llvm.org/D12834> "add gcc abi_tag support" produces an 
error.)



More information about the Gcc mailing list