Re: [patch, avr] Fix PR67353
2016-06-15 13:19 GMT+03:00 Pitchumani Sivanupandi: > On Mon, 2016-06-13 at 17:48 +0200, Georg-Johann Lay wrote: >> Pitchumani Sivanupandi schrieb: >> > >> > $ avr-gcc test.c -Wno-misspelled-isr >> > $ >> What about -Werror=misspelled-isr? > > Updated patch. > >> > >> > 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). > > Ok. Updated patch as per the comments. > > If OK, could someone commit please? > > Regards, > Pitchumani > > gcc/ChangeLog > > 2016-06-15 Pitchumani Sivanupandi > > PR target/67353 > * config/avr/avr.c (avr_set_current_function): Warn misspelled > interrupt/ signal handler if -Wmisspelled-isr flag is enabled. > * config/avr/avr.opt (Wmisspelled-isr): New warning flag. Enabled > by default to warn misspelled interrupt/ signal handler. > * doc/invoke.texi (AVR Options): Document it. Update description > for -nodevicelib option. Committed.
Re: [patch, avr] Fix PR67353
On Mon, 2016-06-13 at 17:48 +0200, Georg-Johann Lay wrote: > Pitchumani Sivanupandi schrieb: > > > > $ avr-gcc test.c -Wno-misspelled-isr > > $ > What about -Werror=misspelled-isr? Updated patch. > > > > 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). Ok. Updated patch as per the comments. If OK, could someone commit please? Regards, Pitchumani gcc/ChangeLog 2016-06-15 Pitchumani SivanupandiPR target/67353 * config/avr/avr.c (avr_set_current_function): Warn misspelled interrupt/ signal handler if -Wmisspelled-isr flag is enabled. * config/avr/avr.opt (Wmisspelled-isr): New warning flag. Enabled by default to warn misspelled interrupt/ signal handler. * doc/invoke.texi (AVR Options): Document it. Update description for -nodevicelib option. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index ba5cd91..b327624 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -754,8 +754,8 @@ avr_set_current_function (tree decl) when the user misspells the vector name. */ if (!STR_PREFIX_P (name, "__vector")) -warning_at (loc, 0, "%qs appears to be a misspelled %s handler", -name, isr); +warning_at (loc, OPT_Wmisspelled_isr, "%qs appears to be a misspelled " + "%s handler, missing __vector prefix", name, isr); } /* Don't print the above diagnostics more than once. */ diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt index 8809b9b..05aa4b6 100644 --- a/gcc/config/avr/avr.opt +++ b/gcc/config/avr/avr.opt @@ -91,6 +91,10 @@ Waddr-space-convert Warning C Report Var(avr_warn_addr_space_convert) Init(0) Warn if the address space of an address is changed. +Wmisspelled-isr +Warning C C++ Report Var(avr_warn_misspelled_isr) Init(1) +Warn if the ISR is misspelled, i.e. without __vector prefix. Enabled by default. + mfract-convert-truncate Target Report Mask(FRACT_CONV_TRUNC) Allow to use truncation instead of rounding towards 0 for fractional int types. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index aa11209..0bf39c5 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -640,7 +640,8 @@ Objective-C and Objective-C++ Dialects}. @emph{AVR Options} @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol --mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert} +-mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert @gol +-Wmisspelled-isr} @emph{Blackfin Options} @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol @@ -14554,12 +14555,17 @@ Only change the lower 8@tie{}bits of the stack pointer. @item -nodevicelib @opindex nodevicelib -Don't link against AVR-LibC's device specific library @code{libdev.a}. +Don't link against AVR-LibC's device specific library @code{lib.a}. @item -Waddr-space-convert @opindex Waddr-space-convert Warn about conversions between address spaces in the case where the resulting address space is not contained in the incoming address space. + +@item -Wmisspelled-isr +@opindex Wmisspelled-isr +Warn if the ISR is misspelled, i.e. without __vector prefix. +Enabled by default. @end table @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
Re: [patch, avr] Fix PR67353
On Mon, 2016-06-13 at 17:48 +0200, Georg-Johann Lay wrote: > Pitchumani Sivanupandi schrieb: > > > > $ avr-gcc test.c -Wno-misspelled-isr > > $ > What about -Werror=misspelled-isr? Updated patch. > > > > 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). Ok. Updated patch as per the comments. If OK, could someone commit please? Regards, Pitchumani diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index ba5cd91..b327624 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -754,8 +754,8 @@ avr_set_current_function (tree decl) when the user misspells the vector name. */ if (!STR_PREFIX_P (name, "__vector")) -warning_at (loc, 0, "%qs appears to be a misspelled %s handler", -name, isr); +warning_at (loc, OPT_Wmisspelled_isr, "%qs appears to be a misspelled " + "%s handler, missing __vector prefix", name, isr); } /* Don't print the above diagnostics more than once. */ diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt index 8809b9b..05aa4b6 100644 --- a/gcc/config/avr/avr.opt +++ b/gcc/config/avr/avr.opt @@ -91,6 +91,10 @@ Waddr-space-convert Warning C Report Var(avr_warn_addr_space_convert) Init(0) Warn if the address space of an address is changed. +Wmisspelled-isr +Warning C C++ Report Var(avr_warn_misspelled_isr) Init(1) +Warn if the ISR is misspelled, i.e. without __vector prefix. Enabled by default. + mfract-convert-truncate Target Report Mask(FRACT_CONV_TRUNC) Allow to use truncation instead of rounding towards 0 for fractional int types. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index aa11209..0bf39c5 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -640,7 +640,8 @@ Objective-C and Objective-C++ Dialects}. @emph{AVR Options} @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol --mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert} +-mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert @gol +-Wmisspelled-isr} @emph{Blackfin Options} @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol @@ -14554,12 +14555,17 @@ Only change the lower 8@tie{}bits of the stack pointer. @item -nodevicelib @opindex nodevicelib -Don't link against AVR-LibC's device specific library @code{libdev.a}. +Don't link against AVR-LibC's device specific library @code{lib.a}. @item -Waddr-space-convert @opindex Waddr-space-convert Warn about conversions between address spaces in the case where the resulting address space is not contained in the incoming address space. + +@item -Wmisspelled-isr +@opindex Wmisspelled-isr +Warn if the ISR is misspelled, i.e. without __vector prefix. +Enabled by default. @end table @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
Re: [patch, avr] Fix PR67353
On June 13, 2016 5:48:43 PM GMT+02:00, Georg-Johann Laywrote: >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,
Re: [patch, avr] Fix PR67353
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). Johann
Re: [patch, avr] Fix PR67353
On Fri, 2016-06-10 at 20:08 +0200, Georg-Johann Lay 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 > > $ > > > > If OK, could someone commit please? I do not have commit access. > > > > Regards, > > Pitchumani > > > > gcc/ChangeLog > > > > 2016-06-10 Pitchumani Sivanupandi> > > Missing PR target/67353 > > > > * config/avr/avr.c (avr_set_current_function): Warn misspelled > > interrupt/ signal handler if warn_misspelled_isr flag is set. > > * config/avr/avr.opt (Wmisspelled-isr): New warning flag. > > Enabled > > by default to warn misspelled interrupt/ signal handler. > Shouldn't it also be documented in doc/invoke.texi? Thanks Johann. Updated the patch. Updated description for -nodevicelib option as well, device library should be lib.a. Regards, Pitchumani gcc/ChangeLog 2016-06-10 Pitchumani Sivanupandi PR target/67353 * config/avr/avr.c (avr_set_current_function): Warn misspelled interrupt/ signal handler if warn_misspelled_isr flag is set. * config/avr/avr.opt (Wmisspelled-isr): New warning flag. Enabled by default to warn misspelled interrupt/ signal handler. * doc/invoke.texi (AVR Options): Document it. Update description for -nodevicelib option.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", name, isr); } diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt index 8809b9b..0703f5a 100644 --- a/gcc/config/avr/avr.opt +++ b/gcc/config/avr/avr.opt @@ -91,6 +91,10 @@ Waddr-space-convert Warning C Report Var(avr_warn_addr_space_convert) Init(0) Warn if the address space of an address is changed. +Wmisspelled-isr +Target Warning Report Var(avr_warn_misspelled_isr) Init(1) +Warn if the ISR is misspelled, i.e. without __vector prefix. Enabled by default. + mfract-convert-truncate Target Report Mask(FRACT_CONV_TRUNC) Allow to use truncation instead of rounding towards 0 for fractional int types. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index aa11209..0bf39c5 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -640,7 +640,8 @@ Objective-C and Objective-C++ Dialects}. @emph{AVR Options} @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol --mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert} +-mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert @gol +-Wmisspelled-isr} @emph{Blackfin Options} @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol @@ -14554,12 +14555,17 @@ Only change the lower 8@tie{}bits of the stack pointer. @item -nodevicelib @opindex nodevicelib -Don't link against AVR-LibC's device specific library @code{libdev.a}. +Don't link against AVR-LibC's device specific library @code{lib.a}. @item -Waddr-space-convert @opindex Waddr-space-convert Warn about conversions between address spaces in the case where the resulting address space is not contained in the incoming address space. + +@item -Wmisspelled-isr +@opindex Wmisspelled-isr +Warn if the ISR is misspelled, i.e. without __vector prefix. +Enabled by default. @end table @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
Re: [patch, avr] Fix PR67353
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 $ If OK, could someone commit please? I do not have commit access. Regards, Pitchumani gcc/ChangeLog 2016-06-10 Pitchumani SivanupandiMissing PR target/67353 * config/avr/avr.c (avr_set_current_function): Warn misspelled interrupt/ signal handler if warn_misspelled_isr flag is set. * config/avr/avr.opt (Wmisspelled-isr): New warning flag. Enabled by default to warn misspelled interrupt/ signal handler. Shouldn't it also be documented in doc/invoke.texi? Johann
[patch, avr] Fix PR67353
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 $ If OK, could someone commit please? I do not have commit access. Regards, Pitchumani gcc/ChangeLog 2016-06-10 Pitchumani Sivanupandi* config/avr/avr.c (avr_set_current_function): Warn misspelled interrupt/ signal handler if warn_misspelled_isr flag is set. * config/avr/avr.opt (Wmisspelled-isr): New warning flag. Enabled by default to warn misspelled interrupt/ signal handler. 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", name, isr); } diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt index 8809b9b..0703f5a 100644 --- a/gcc/config/avr/avr.opt +++ b/gcc/config/avr/avr.opt @@ -91,6 +91,10 @@ Waddr-space-convert Warning C Report Var(avr_warn_addr_space_convert) Init(0) Warn if the address space of an address is changed. +Wmisspelled-isr +Target Warning Report Var(avr_warn_misspelled_isr) Init(1) +Warn if the ISR is misspelled, i.e. without __vector prefix. Enabled by default. + mfract-convert-truncate Target Report Mask(FRACT_CONV_TRUNC) Allow to use truncation instead of rounding towards 0 for fractional int types.