[PATCH] Add gnu::diagnose_as attribute

Jason Merrill jason@redhat.com
Thu May 27 17:39:48 GMT 2021


On 5/4/21 7:13 AM, Matthias Kretz wrote:
> From: Matthias Kretz <kretz@kde.org>
> 
> This attribute overrides the diagnostics output string for the entity it
> appertains to. The motivation is to improve QoI for library TS
> implementations, where diagnostics have a very bad signal-to-noise ratio
> due to the long namespaces involved.

> On Tuesday, 27 April 2021 11:46:48 CEST Jonathan Wakely wrote:
>> I think it's a great idea and would like to use it for all the TS
>> implementations where there is some inline namespace that the user
>> doesn't care about. std::experimental::fundamentals_v1:: would be much
>> better as just std::experimental::, or something like std::[LFTS]::.

Hmm, how much of the benefit could we get from a flag (probably on by 
default) to skip inline namespaces in diagnostics?

> With the attribute, it is possible to solve PR89370 and make
> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> appear as
> std::string in diagnostic output without extra hacks to recognize the
> type.

That sounds wrong to me; std::string is the <char> instantiation, not 
the template.  Your patch doesn't make it possible to apply this 
attribute to class template instantiations, does it?

Jason



More information about the Libstdc++ mailing list