[Bug c/79677] Weird handling of -Werror=

2017-02-27 Thread orion at cora dot nwra.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #12 from Orion Poplawski  ---
Adding -Wno-format-security does indeed work.  Thank you.

[Bug c/79677] Weird handling of -Werror=

2017-02-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #11 from Jakub Jelinek  ---
It is not a GCC bug, the general rule is that the options that enable
suboptions don't change those (either way) if that option has been specified
explicitly.
So, -Wformat -Wformat-security -Wno-format does not disable -Wformat-security,
but e.g. disables -Wformat-y2k because that option has not been set explicitly.
So, either you change that
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format")
to
set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format
-Wno-format-security")
or e.g. strip off -Werror=format-security from RPM_OPT_FLAGS.

[Bug c/79677] Weird handling of -Werror=

2017-02-27 Thread orion at cora dot nwra.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #10 from Orion Poplawski  ---
I'm not sure how I'm practically supposed to handle this.  In this case, for
one sub-directory upstream adds -Wno-format to the flags:

./Utilities/KWIML/test/CMakeLists.txt:set(CMAKE_${lang}_FLAGS
"${CMAKE_${lang}_FLAGS} -Wno-format")

Is this still a bug in gcc?

[Bug c/79677] Weird handling of -Werror=

2017-02-27 Thread orion at cora dot nwra.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #9 from Orion Poplawski  ---
Ah, just got the -Wno-format

[Bug c/79677] Weird handling of -Werror=

2017-02-27 Thread orion at cora dot nwra.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #8 from Orion Poplawski  ---
Created attachment 40838
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40838=edit
/builddir/build/BUILD/cmake-3.7.2/Utilities/KWIML/test/test.c

/usr/lib64/ccache/gcc  -DKWIML_LANGUAGE_C -DKWIML_LANGUAGE_CXX
-I/builddir/build/BUILD/cmake-3.7.2/build/Utilities
-I/builddir/build/BUILD/cmake-3.7.2/Utilities  -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wno-format 
 -std=gnu11 -o CMakeFiles/kwiml_test.dir/test.c.o   -c
/builddir/build/BUILD/cmake-3.7.2/Utilities/KWIML/test/test.c
cc1: error: -Wformat-security ignored without -Wformat
[-Werror=format-security]
cc1: some warnings being treated as errors

I don't see any extra options myself.

[Bug c/79677] Weird handling of -Werror=

2017-02-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #6 from Jakub Jelinek  ---
(In reply to Orion Poplawski from comment #5)
> With gcc 7.0.1-0.10.fc26 I'm starting to see errors like:
> 
> cc1plus: error: -Wformat-security ignored without -Wformat
> [-Werror=format-security]
> 
> If this is intended, we're going to need to fix redhat-rpm-config to change:
> 
> %__global_compiler_flags -O2 -g -pipe -Wall -Werror=format-security
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
> --param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags}
> 
> to add -Wformat.

Well, -Wformat is implied by -Wall, so it must be packages doing -Wno-format or
similar.  -Wformat -Wformat-security -Wno-format used to warn in the past,
-Wformat -Werror=format-security -Wno-format used to be quite due to a bug, but
now errors out.
We have one instance of this problem in gcc too:
AS_IF([test $enable_build_format_warnings = no],
  [wf_opt=-Wno-format],[wf_opt=])
Guess we want there:
AS_IF([test $enable_build_format_warnings = no],
  [wf_opt="-Wno-format -Wno-format-security -Wno-format-y2k
-Wno-format-extra-args -Wno-format-zero-length
-Wno-format-nonliteral"],[wf_opt=])

[Bug c/79677] Weird handling of -Werror=

2017-02-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #7 from Jakub Jelinek  ---
Or perhaps makefiles filtering away -Wall or using -Wno-all.

[Bug c/79677] Weird handling of -Werror=

2017-02-27 Thread orion at cora dot nwra.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

Orion Poplawski  changed:

   What|Removed |Added

 CC||orion at cora dot nwra.com

--- Comment #5 from Orion Poplawski  ---
With gcc 7.0.1-0.10.fc26 I'm starting to see errors like:

cc1plus: error: -Wformat-security ignored without -Wformat
[-Werror=format-security]

If this is intended, we're going to need to fix redhat-rpm-config to change:

%__global_compiler_flags -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags}

to add -Wformat.

[Bug c/79677] Weird handling of -Werror=

2017-02-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Jakub Jelinek  ---
Fixed.

[Bug c/79677] Weird handling of -Werror=

2017-02-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Fri Feb 24 23:15:56 2017
New Revision: 245728

URL: https://gcc.gnu.org/viewcvs?rev=245728=gcc=rev
Log:
PR c/79677
* opts.h (handle_generated_option): Add GENERATED_P argument.
* opts-common.c (handle_option): Adjust function comment.
(handle_generated_option): Add GENERATED_P argument, pass it to
handle_option.
(control_warning_option): Pass false to handle_generated_option
GENERATED_P.
* opts.c (maybe_default_option): Pass true to handle_generated_option
GENERATED_P.
* optc-gen.awk: Likewise.
ada/
* gcc-interface/misc.c (gnat_handle_option): Pass true to
handle_generated_option GENERATED_P.
testsuite/
* gcc.dg/pr79677.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr79677.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ada/ChangeLog
trunk/gcc/ada/gcc-interface/misc.c
trunk/gcc/optc-gen.awk
trunk/gcc/opts-common.c
trunk/gcc/opts.c
trunk/gcc/opts.h
trunk/gcc/testsuite/ChangeLog

[Bug c/79677] Weird handling of -Werror=

2017-02-24 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-02-24
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Jakub Jelinek  ---
Created attachment 40824
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40824=edit
gcc7-pr79677.patch

Untested fix.

[Bug c/79677] Weird handling of -Werror=

2017-02-22 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #1 from joseph at codesourcery dot com  ---
For the theory of how I think this should behave, see 
 (referring back 
to  and 
 for the concept of 
distance for options overriding each other).  That is, 
-Werror=format-security should act like a -Wformat-security variant, and 
so all these examples should warn/error.

I don't know what the immediate cause of this issue or appropriate fix in 
the context of the present implementation might be.