[cfe-commits] [PATCH] Fixes for unintended fall-through bugs (-Wimplicit-fallthrough)

Richard Smith richard at metafoo.co.uk
Fri Jun 1 13:34:27 PDT 2012


On Fri, Jun 1, 2012 at 2:17 AM, Alexander Kornienko <alexfh at google.com> wrote:
> Nice, then I leave this for you to deal with. Any ideas regarding llvm bugs
> and LLVM_FALLTHROUGH macro?

Those should be addressed on llvm-commits at . Feel free to ping your
message there :)

> On Fri, Jun 1, 2012 at 1:47 AM, Richard Smith <richard at metafoo.co.uk> wrote:
>>
>> On Mon, May 28, 2012, at 8:08PM, Alexander Kornienko <alexfh at google.com>
>> wrote:
>> > I've put aside header changes for now. There are patches with bug fixes
>> > (at
>> > least, those seem to be bugs to me) and a patch with LLVM_FALLTHROUGH
>> > macro.
>> > Please, take a look at these. Thanks!
>>
>> Looking at fallthrough-bugs-clang.diff:
>>
>> --- tools/clang/lib/Sema/SemaDeclAttr.cpp       (revision 157508)
>> +++ tools/clang/lib/Sema/SemaDeclAttr.cpp       (working copy)
>> @@ -3342,6 +3342,7 @@
>>     }
>>
>>     D->addAttr(::new (S.Context) PcsAttr(Attr.getRange(), S.Context,
>> PCS));
>> +    return;
>>   }
>>   default:
>>     llvm_unreachable("unexpected attribute kind");
>>
>> Thanks for spotting this. The problem here goes deeper than a simple
>> missing 'return': this code is not reached at all for the AT_pcs
>> attribute. The following crashes clang (with or without this change):
>>
>> int f() __attribute__((pcs("something")));
>
>
>
>
> --
> Best regards,
> Alexander Kornienko




More information about the cfe-commits mailing list