http-paser是一个用c编写的http消息解析器,地址:https://github.com/nodejs/http-parser,目前版本2.9node
今天用gcc 7.3.0编译其2.1版本时,编译器报错以下:git
找到对应的代码:github
http-parser的编译同时打开了-Wall -Wextra -Werrorblog
-Wimplicit-fallthrough,是C++17标准引入的警告选项,由于这个地方没有break。若是编译时有编译选项-Wextra,该编译选项将添加。-Werror将警告视为错误报出。ci
参考文档:文档
https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/编译器
具体文档介绍可参考,man gccit
备注:编译
最新版本编译没有问题,由于代码改成这样了ejs
至于为何改成这样就不报错了,由于默认Wimplicit-fallthrough=3的时候,加上/* fall through */是能够绕过的。详细请见gcc文档。
话说,直接添加一个下面的处理语句,再break不更好吗?代码复用到了极致了。