[PATCH] PR12463 : Warnings about nonsensical comparisons are disabled if macro expansion is involved
Eli Friedman
eli.friedman at gmail.com
Mon Jul 29 17:15:12 PDT 2013
On Sun, Jul 28, 2013 at 3:41 AM, Lubos Lunak <l.lunak at suse.cz> wrote:
> On Monday 01 of July 2013, Eli Friedman wrote:
>> On Sat, Jun 29, 2013 at 11:23 PM, Lubos Lunak <l.lunak at suse.cz> wrote:
>> > Hello,
>> >
>> > could somebody please review and commit the atached patch for pr12463?
>> > Thank
>> > you.
>> >
>> > + bool InMacro = LHS.get()->getLocStart().isMacroID() ||
>>
>> + RHS.get()->getLocStart().isMacroID();
>>
>> Why not just check the source location of the operator itself? It seems
>> like we want to diagnose "MYMACRO1 == MYMACRO2".
>
> I don't know, because that's not my code. If you look at the patch, this is
> just moved out of the first if(), in order to prevent it from applying to all
> the cases. So maybe it's a good question, but it's not really part of this
> issue.
Okay, I'll put that aside, then.
+ !isa<StringLiteral>(LHSStripped) &&
+ !isa<ObjCEncodeExpr>(LHSStripped)) {
A DeclRefExpr can't be a StringLiteral.
Why should array1 == array2 and array1 <= array2 behave differently
inside macros?
With this patch, we won't print the right diagnostic for array1 <
array1 expanded from a macro.
-Eli
More information about the cfe-commits
mailing list