2016-10-08 Jakub Jelinek <jakub@redhat.com>
+ * doc/invoke.texi: Document accepting Else, fallthrough.
+
* doc/invoke.texi (-Wimplicit-fallthrough): Document FALLTHRU comment
style changes.
@item @code{lint -fallthrough ?}
-@item @code{[ \t.!]*(ELSE |INTENTIONAL(LY)? )?FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
+@item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
-@item @code{[ \t.!]*(Else |Intentional(ly)? )?Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
+@item @code{[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
-@item @code{[ \t.!]*([Ee]lse |[Ii]ntentional(ly)? )?fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
+@item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
@end itemize
* c-c++-common/Wimplicit-fallthrough-23.c (foo): Add further tests.
+ * c-c++-common/Wimplicit-fallthrough-23.c (foo): Add further tests.
+
* c-c++-common/Wimplicit-fallthrough-23.c: New test.
* c-c++-common/Wimplicit-fallthrough-24.c: New test.
2016-10-08 Jakub Jelinek <jakub@redhat.com>
+ * lex.c (fallthrough_comment_p): Accept Else, fallthrough.
+
* lex.c (fallthrough_comment_p): Extend to handle more common FALLTHRU
comment styles.
from++;
}
/* Whole comment contents (regex):
- [ \t.!]*(ELSE |INTENTIONAL(LY)? )?FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?
- [ \t.!]*(Else |Intentional(ly)? )?Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?
- [ \t.!]*([Ee]lse |[Ii]ntentional(ly)? )?fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?
+ [ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?
+ [ \t.!]*(Else,? |Intentional(ly)? )?Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?
+ [ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?
*/
else
{
if ((size_t) (pfile->buffer->cur - from)
< sizeof "else fallthru" - 1)
return false;
- if (f == 'E' && memcmp (from + 1, "LSE F", sizeof "LSE F" - 1) == 0)
+ if (f == 'E' && memcmp (from + 1, "LSE", sizeof "LSE" - 1) == 0)
all_upper = true;
- else if (memcmp (from + 1, "lse ", sizeof "lse " - 1))
+ else if (memcmp (from + 1, "lse", sizeof "lse" - 1))
+ return false;
+ from += sizeof "else" - 1;
+ if (*from == ',')
+ from++;
+ if (*from != ' ')
+ return false;
+ from++;
+ if (all_upper && *from == 'f')
return false;
- from += sizeof "else " - 1;
if (f == 'e' && *from == 'F')
return false;
f = *from;