5.18.14 fail to build due to -Werror
Brought to you by:
bkorb
autogen 5.18.14 sets AM_CFLAGS to @WARN_CFLAGS@ in autoopts/Makefile.am (see 32da2280eb7747514af8b1e31b20075b67e6edca) and therefore adds -Werror to CFLAGS. Wgich causes a build error:
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../autoopts -Wdate-time -D_FORTIFY_SOURCE=2 -DPKGDATADIR=\"/usr/share/autogen\" -g -O2 -fdebug-prefix-map=/tmp/AUTOGEN/autogen-5.18.14=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-format-contains-nul -Wno-format-contains-nul -fno-strict-aliasing -Wall -Werror -Wcast-align -Wmissing-prototypes -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings -Wstrict-aliasing=3 -Wextra -Wno-cast-qual -g -O2 -fdebug-prefix-map=/tmp/AUTOGEN/autogen-5.18.14=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-format-contains-nul -Wno-format-contains-nul -fno-strict-aliasing -c libopts.c -fPIC -DPIC -o .libs/libopts_la-libopts.o
In file included from libopts.c:24:0:
configfile.c: In function 'file_preset':
configfile.c:467:20: error: this statement may fall through [-Werror=implicit-fallthrough=]
if (ftext++ != NULL)
^
configfile.c:470:13: note: here
default:
^~~~~~~
In file included from libopts.c:46:0:
usage.c: In function 'parse_usage_flags':
usage.c:155:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
txt = SPN_WHITESPACE_CHARS(txt + 1);
usage.c:158:9: note: here
default:
^~~~~~~
In file included from libopts.c:22:0:
boolean.c: In function 'optionBooleanVal':
boolean.c:63:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
{
^
boolean.c:69:5: note: here
case 'N':
^~~~
In file included from libopts.c:32:0:
makeshell.c: In function 'text_to_var':
makeshell.c:324:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
(*(opts->pUsageProc))(opts, EXIT_SUCCESS);
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
makeshell.c:327:9: note: here
case TT_USAGE:
^~~~
makeshell.c:328:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
(*(opts->pUsageProc))(opts, EXIT_FAILURE);
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
makeshell.c:331:9: note: here
case TT_VERSION:
^~~~
makeshell.c:337:13: error: this statement may fall through [-Werror=implicit-fallthrough=]
optionPrintVersion(opts, od);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
makeshell.c:340:9: note: here
default:
^~~~~~~
makeshell.c: In function 'genshelloptUsage':
makeshell.c:887:9: error: this statement may fall through [-Werror=implicit-fallthrough=]
optionUsage(opts, EXIT_FAILURE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
makeshell.c:890:5: note: here
case 0:
^~~~
makeshell.c:932:9: error: this statement may fall through [-Werror=implicit-fallthrough=]
optionUsage(optionParseShellOptions, EXIT_FAILURE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
makeshell.c:934:5: note: here
default:
^~~~~~~
In file included from libopts.c:34:0:
numeric.c: In function 'optionNumericVal':
numeric.c:139:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 't': val *= 1000;
~~~~^~~~~~~
numeric.c:140:9: note: here
case 'g': val *= 1000;
^~~~
numeric.c:140:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 'g': val *= 1000;
~~~~^~~~~~~
numeric.c:141:9: note: here
case 'm': val *= 1000;
^~~~
numeric.c:141:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 'm': val *= 1000;
~~~~^~~~~~~
numeric.c:142:9: note: here
case 'k': val *= 1000; break;
^~~~
numeric.c:144:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 'T': val *= 1024;
~~~~^~~~~~~
numeric.c:145:9: note: here
case 'G': val *= 1024;
^~~~
numeric.c:145:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 'G': val *= 1024;
~~~~^~~~~~~
numeric.c:146:9: note: here
case 'M': val *= 1024;
^~~~
numeric.c:146:24: error: this statement may fall through [-Werror=implicit-fallthrough=]
case 'M': val *= 1024;
~~~~^~~~~~~
numeric.c:147:9: note: here
case 'K': val *= 1024; break;
^~~~
cc1: all warnings being treated as errors
New warning. My best guess is that I'm going to fix it by disabling "implicit-fallthrough".
I've been programming for too many decades to consider it a problem, but I will look
to see what is easier.
Fallthrough warnings being errors is an error in your build. Don't do that. They all have FALLTHROUGH comments that must be honored.