How can I tell gcc to warn (or fail) on switch/case statements without a break?

后端 未结 6 1342
有刺的猬
有刺的猬 2021-01-17 17:50

I have a complicated switch statement, and I forgot to put a break at the end of one of the cases. This is quite legal, and as a resu

6条回答
  •  感情败类
    2021-01-17 18:17

    GCC 7 has a warning enabled with -Wextra or -Wimplicit-fallthrough(=[1-5])?: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

提交回复
热议问题