misleading "-Wmisleading-indentation" warning on break in switch/case?

2017-08-24 Thread Stefan Sobernig
Hi I got a code base with the following indentation style for break within switch/case: ---%<--- #include int main(void) { const char *c = "XX"; int out = 0; switch (c[0]) { case 'X': if (strcmp(c, "XX")) out = 1; break; /* ok */ case 'Y': if (strcmp(c, "XY")

Re: nonnull, -Wnonnull, and do/while

2016-02-17 Thread Stefan Sobernig
> On Tue, Feb 16, 2016 at 11:04:38AM +0100, Marek Polacek wrote: >> On Tue, Feb 16, 2016 at 10:43:08AM +0100, Stefan Sobernig wrote: >>> Under a recent gcc 6 [*], we run into -Wnonnull warnings using the >>> nonnull attribute: >> >> Yes, this warning has b

nonnull, -Wnonnull, and do/while

2016-02-16 Thread Stefan Sobernig
Hi We have a number of do/while loops with NULL checks in their exit conditions: #include static void f(const char *s) __attribute__((nonnull(1))); int main(void) { const char *p = "X"; f(p); } static void f(const char *s) { do { printf("%s\n",s); s = NULL; } while (s != NULL)