On June 13, 2016 5:48:43 PM GMT+02:00, Georg-Johann Lay <a...@gjlay.de> wrote:
>Pitchumani Sivanupandi schrieb:
>> Hi,
>> 
>> This patch introduces new flags for warning 'misspelled interrupt/
>> signal handler'. Flag -Wmisspelled-isr is enabled by default and it
>> will warn user if the interrupt/ signal handler is without '__vector'
>> prefix. Flag -Wno-misspelled-isr shall be enabled by user to allow
>> custom names, i.e. without __vector prefix.
>> 
>> // avr-gcc -c test.c
>> void custom_interruption(void) __attribute__((signal));
>> void custom_interruption(void) {}
>> 
>> Behavior after applying this patch:
>> 
>> $ avr-gcc test.c 
>> test.c: In function 'custom_interruption':
>> test.c:2:6: warning: 'custom_interruption' appears to be a misspelled
>> signal handler
>>  void custom_interruption(void) {}
>>       ^~~~~~~~~~~~~~~~~~~
>> 
>> $ avr-gcc test.c -Wmisspelled-isr
>> test.c: In function
>> 'custom_interruption':
>> test.c:2:6: warning: 'custom_interruption'
>> appears to be a misspelled signal handler
>>  void
>> custom_interruption(void) {}
>>       ^~~~~~~~~~~~~~~~~~~
>> 
>> $ avr-gcc test.c -Wno-misspelled-isr
>> $
>
>What about -Werror=misspelled-isr?
>
> > [...]
>> diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
>> index ba5cd91..587bdbc 100644
>> --- a/gcc/config/avr/avr.c
>> +++ b/gcc/config/avr/avr.c
>> @@ -753,7 +753,7 @@ avr_set_current_function (tree decl)
>>           that the name of the function is "__vector_NN" so as to
>catch
>>           when the user misspells the vector name.  */
>>  
>> -      if (!STR_PREFIX_P (name, "__vector"))
>> +      if ((!STR_PREFIX_P (name, "__vector")) &&
>(avr_warn_misspelled_isr))
>>          warning_at (loc, 0, "%qs appears to be a misspelled %s
>handler",
>
>If, instead of the "0" the respective OPT_... enum is used in the call 
>to warning_at, the -Werror= should work as expected (and explicit "&& 
>avr_warn_misspelled_isr" no more needed).

And maybe even mention __vector in the message?
thanks,

Reply via email to