This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] C++: locations for function declarations
2008/9/13 Jason Merrill <jason@redhat.com>:
> Aldy Hernandez wrote:
>>
>> On Fri, Sep 12, 2008 at 11:19:15AM -0400, Jason Merrill wrote:
>>>
>>> You can use %q+#D instead of error_at. Otherwise OK.
>>
>> Manuel's comment below suggested we were getting rid of format
>> specifiers for locations in favor of {error,warning,etc}_at:
>
> That does seem to be the direction he's working on. But that seems to me to
> be unnecessarily verbose when the location we want is also the location of a
> decl we're printing; that's the purpose of the + modifier, which is used
> extensively in the C++ front end.
>
> Manuel, what's the rationale for requiring people to write out
> DECL_SOURCE_LOCATION (decl) in this situation?
There are a few reasons I already gave in the mail that Aldy referenced:
* printf-like modifiers are redundant once all diagnostic functions
take an explicit location. We want all diagnostics functions to take
an explicit location and {error,warning}_at is transitional until all
calls to {error,warning} are updated. All calls to pedwarn and
permerror already take an explicit location.
* The modifiers are processed too late to influence the inhibition of
diagnostics depending on system_headers(location).
* The modifiers obfuscate code unnecessarily. The purpose of %q#+D is
not as clear as DECL_SOURCE_LOCATION (t).
I honestly do not see a problem with being verbose here. On the
contrary, I'll wish that GCC source code were more verbose in many
places.
Manuel.