addition of -Wall to default flags (redhat-rpm-config-8.0.38-1)

Roland McGrath roland at redhat.com
Sat Aug 6 22:36:01 UTC 2005


If there was a mention of this change, I overlooked it.

The addition of -Wall to the $RPM_OPT_FLAGS value has some unintended
consequences.  This broke my latest elfutils build until I worked around it.

The CFLAGS given to configure, i.e. what's in %optflags, is usually
appended to the package makefiles' own list of flags.  As gcc processes its
command line, the later flags override the earlier ones.  This is the right
thing e.g. when a package makefile uses -O and we override it to -O2 and so on.

When a package uses -W* flags already itself, it may use some -Wno-* flags
in its standard setting when some of the warnings are over-eager for some
of its code.  For example, elfutils uses -Wall -Werror (and some more
warning options) on every file, but appends -Wno-format for a few files
where gcc's format checking is not smart enough to know what is really OK.

With the new redhat-rpm-config setting of %optflags including -Wall, we
wind up with -Wall -Werror -Wno-format -Wall -Wp,-D_FORTIFY_SOURCE=2 ...
and the second -Wall overrides the -Wno-format that overrode part of the
effect of the first -Wall.  Since it uses -Werror, the additional spurious
warnings break the build.

There is an argument to be made that the upstream package is broken if you
cannot use "configure CFLAGS=-Wall".  But, folks should be aware of this
change and how it might explain sudden differences in the builds of
packages that worked before Monday.

For today's elfutils build, I am using this:

	RPM_OPT_FLAGS=${RPM_OPT_FLAGS/-Wall/}
	%configure CFLAGS="$RPM_OPT_FLAGS"


Thanks,
Roland




More information about the fedora-devel-list mailing list