[Bug c/77817] -Wimplicit-fallthrough: cpp directive renders FALLTHRU comment ineffective

2018-07-05 Thread antmak.pub at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817

Anton Maklakov  changed:

   What|Removed |Added

 CC||antmak.pub at gmail dot com

--- Comment #16 from Anton Maklakov  ---
Hi,

I have the same problem:


int main() {
int s = 1;

switch (s) {
case 2:
s = 2;
#if B
break;
#else
s = 4;
/* falls through */
#endif
case 3:
s = 3;
}
} 

It appears

prog.c: In function 'main':
prog.c:11:15: warning: this statement may fall through
[-Wimplicit-fallthrough=]
 s = 4;
 ~~^~~
prog.c:14:9: note: here
 case 3:
 ^~~~

At the moment I use a workaround:

#if (__GNUC__ >= 7)
#define FALLTHROUGH __attribute__ ((fallthrough));
#else
#define FALLTHROUGH
#endif

int main() {
int s = 1;

switch (s) {
case 2:
s = 2;
#if B
break;
#else
s = 4;
FALLTHROUGH
#endif
case 3:   
s = 3;
}
}

This code is based on the real code from libexpat

[Bug c/77817] -Wimplicit-fallthrough: cpp directive renders FALLTHRU comment ineffective

2018-07-05 Thread antmak.pub at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817

--- Comment #18 from Anton Maklakov  ---
Thank you for the answer!

I've got. Using the hint after #endif is not pretty good, by the logic. But
this is easier.

[Bug c++/101767] [10/11/12 Regression] Aggregate initialization fails for struct that has both unnamed struct and union fields

2022-02-09 Thread antmak.pub at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101767

--- Comment #4 from Anton Maklakov  ---
I've stumbled this bug as well