Some C compiler flags (CFLAGS) are desired for compilation, but not when running ./configure (or similar scripts).
Now CFLAGS et al. environment variables are set and exported by %configure.
1. Optimization flags may be unwanted in ./configure because they slow down the tests. (Instead, something like -O0 may be wanted if this is not the default.)
2. -Werror (added to %optflags by %def_enable Werror or by other ways) make the tests in ./configure behave differently.
A mechanism should be thought up to "filter" out the flags which are bad for ./configure before running ./configure, but to add them back when running make.
Perhaps, exporting CFLAGS two times (with different values) would work for most packages, but I need a closer look at the packages to find this out.
(A BRP check that would check that the resulting files have been compiles with flags which include all %optflags would help to see whether the new mechanism would work as expected en masse.)