On 05/26/2017 01:59 PM, David Malcolm wrote:
Ping:
  https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00334.html

On Thu, 2017-05-04 at 14:16 -0400, David Malcolm wrote:
As of r247522, fix-it-hints can suggest the insertion of new lines.

This patch updates -Wimplicit-fallthrough to provide suggestions
with fix-it hints, showing the user where to insert "break;" or
fallthrough attributes.

For example:

 test.c: In function 'set_x':
 test.c:15:9: warning: this statement may fall through [-Wimplicit
-fallthrough=]
        x = a;
        ~~^~~
 test.c:22:5: note: here
      case 'b':
      ^~~~
 test.c:22:5: note: insert '__attribute__ ((fallthrough));' to
silence this warning
 +        __attribute__ ((fallthrough));
      case 'b':
      ^~~~
 test.c:22:5: note: insert 'break;' to avoid fall-through
 +        break;
      case 'b':
      ^~~~

I haven't read the patch but the notes above make me wonder:

If the location of at least one of t hints is always the same
as that of the first "note: here" would it make sense to lose
the latter and reduce the size of the output?  (Or lose it in
the cases where one of the fix-it hints does share a location
with it).

Martin

Reply via email to