[cfe-dev] [cfe-commits] r62192 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Fri Jan 23 09:11:50 PST 2009


On Jan 22, 2009, at 6:08 PM, Chris Lattner wrote:
> On Jan 22, 2009, at 8:16 AM, Douglas Gregor wrote:
>>>> +  // Permit typedefs without declarators as a Microsoft extension.
>>>> if (!DS.isMissingDeclaratorOk()) {
>>>> +    if (getLangOptions().Microsoft &&
>>>> +        DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
>>>> +      Diag(DS.getSourceRange().getBegin(),  
>>>> diag::ext_no_declarators)
>>>> +        << DS.getSourceRange();
>>>> +      return Tag;
>>>> +    }
>>>
>>> This touches on meta-design issues, but do you think it is better  
>>> to test for getLangOptions.MS here, or do you think it is better  
>>> to have the Clang driver map this onto ERROR by default when not  
>>> is ms extensions mode?  Both approaches work, but they have  
>>> different tradeoffs.  I'm curious what you (and others!) think.
>>
>> It's an apt meta-issue, but I think in this case, since it's also a  
>> GNU extension, it should be an EXTWARN regardless of dialect. On  
>> the meta-issue itself, I think I like having the Clang driver make  
>> decisions between WARNING/EXTWARN/EXTENSION, but to me it seems  
>> like switching a diagnostic from or to ERROR is just asking for  
>> trouble: even if it works when we initially do it, we're likely to  
>> evolve Sema or the Parser to assume that an error really is an  
>> error, and screw up processing when that error turns out not to be  
>> an error.
>
> It doesn't matter in this case anymore, however, the point that I  
> was trying to make was that LangOptions and fine-grain warning  
> control are very similar in some cases.  In this case, the compiler  
> (including down-stream clients) clearly has to be able to handle  
> this feature.  Using a langoption to control a warning just seems  
> strange...

Yeah, I agree with that. When a diagnostic doesn't actually effect  
what the compiler is going to do, we shouldn't be checking LangOptions  
to decide whether to emit the warning; the diagnostics system can make  
that decision.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090123/f48ac454/attachment.html>


More information about the cfe-dev mailing list