Fix implicit fallthrough warning with gcc 9.3.0

../daemon/escape.c: In function ‘escape’:
../daemon/escape.c:49:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
   49 |       if ((flags & LADISH_ESCAPE_FLAG_OTHER) == 0)
      |          ^
../daemon/escape.c:53:5: note: here
   53 |     case '<':               /* invalid attribute value char (XML spec) */
      |     ^~~~

gcc (Gentoo 9.3.0 p2) 9.3.0
This commit is contained in:
Nedko Arnaudov 2020-05-07 23:32:36 +03:00
parent c76a72c6e4
commit 16e6233620
2 changed files with 4 additions and 0 deletions

View File

@ -50,6 +50,7 @@ void escape(const char ** src_ptr, char ** dst_ptr, unsigned int flags)
{
break;
}
/* fall through intentionally, some compilers are parsing comments */
case '<': /* invalid attribute value char (XML spec) */
case '&': /* invalid attribute value char (XML spec) */
case '"': /* we store attribute values in double quotes - invalid attribute value char (XML spec) */

View File

@ -224,6 +224,9 @@ def configure(conf):
if not conf.env['BUILD_PYLASH']:
add_cflag(conf, '-Wextra')
conf.env.append_unique('CXXFLAGS', '-Wno-unused-parameter') # the UNUSED() macro doesnt work for C++
add_cflag(conf, '-Wimplicit-fallthrough=2')
if conf.env['BUILD_WERROR']:
add_cflag(conf, '-Werror')
# for pre gcc-4.4, enable optimizations so use of uninitialized variables gets detected