Hi, Martin Kletzander wrote: > When compiling libvirt with updated GCC (v7.1.0), the following warning > pops out (which then ends up treated like an error): > > ../config.h:2994:48: error: this use of "defined" may not be portable > [-Werror=expansion-to-defined] > || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ > > If I remove the ternary operator, the warning/error goes away.
This warning (-Wexpansion-to-defined) is documented in [1]: Warn whenever ‘defined’ is encountered in the expansion of a macro (including the case where the macro is expanded by an ‘#if’ directive). What is the expansion of _FORTIFY_SOURCE in your case? (You can use "gcc -E -dM" to determine it.) If it does contain the 'defined' keyword, please fix that. If not, you have found a GCC bug. Please report it at [2]. And disable -Werror until it gets fixed. Gnulib does *not* support the use of -Werror. [3] Bruno [1] https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Warning-Options.html [2] https://gcc.gnu.org/bugs/ [3] https://www.gnu.org/software/gnulib/manual/html_node/warnings.html