public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40989]  New: -Werror=implicit does not enable -Wimplicit
@ 2009-08-06 15:06 flameeyes at gentoo dot org
  2009-08-06 15:10 ` [Bug c/40989] " flameeyes at gentoo dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: flameeyes at gentoo dot org @ 2009-08-06 15:06 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

I'm not sure if this is the cause of the final bug I'm trying to reproduce out
of a project of mine (implicit function declarations are not reported having
any value to the side with -fdiagnostics-show-option), but anyway…

While the man page for gcc implies that -Werror=foo enables -Wfoo, this doesn't
seem to be the case:

flame@yamato mytmpfs % cat test.c
int main() {
  return pippo();
}
flame@yamato mytmpfs % gcc -c -Werror=implicit -fdiagnostics-show-option test.c
-o test.o
flame@yamato mytmpfs % gcc -c -Wimplicit -fdiagnostics-show-option test.c -o
test.o         
test.c: In function ‘main’:
test.c:2: warning: implicit declaration of function ‘pippo’
[-Wimplicit-function-declaration]

Doesn't look right to me.


-- 
           Summary: -Werror=implicit does not enable -Wimplicit
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: flameeyes at gentoo dot org
  GCC host triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror=implicit does not enable -Wimplicit
  2009-08-06 15:06 [Bug c/40989] New: -Werror=implicit does not enable -Wimplicit flameeyes at gentoo dot org
@ 2009-08-06 15:10 ` flameeyes at gentoo dot org
  2009-08-07 13:07 ` [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: flameeyes at gentoo dot org @ 2009-08-06 15:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from flameeyes at gentoo dot org  2009-08-06 15:10 -------
I can confirm this issue on 4.3.3 as well.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
  2009-08-06 15:06 [Bug c/40989] New: -Werror=implicit does not enable -Wimplicit flameeyes at gentoo dot org
  2009-08-06 15:10 ` [Bug c/40989] " flameeyes at gentoo dot org
@ 2009-08-07 13:07 ` manu at gcc dot gnu dot org
  2010-03-12  0:15 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-08-07 13:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2009-08-07 13:07 -------
This is because neither Werror= nor #pragma GCC diagnositcs work with "group
flags", that is, flags that enable other flags. 

Until this is fixed, you need to give exactly the flag reported by
-fdiagnostics-show-option, so in your case it would be:

-Werror=implicit-function-declaration

if none is reported that is also a bug, so open another PR.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-07 13:07:11
               date|                            |
            Summary|-Werror=implicit does not   |-Werror= and #pragma
                   |enable -Wimplicit           |diagnostics do not work with
                   |                            |group flags


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
  2009-08-06 15:06 [Bug c/40989] New: -Werror=implicit does not enable -Wimplicit flameeyes at gentoo dot org
  2009-08-06 15:10 ` [Bug c/40989] " flameeyes at gentoo dot org
  2009-08-07 13:07 ` [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags manu at gcc dot gnu dot org
@ 2010-03-12  0:15 ` manu at gcc dot gnu dot org
  2010-05-06 10:13 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-03-12  0:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2010-03-12 00:15 -------
Created an attachment (id=20091)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20091&action=view)
patch

This is my current patch to fix this. However, it has a big problem: Since
there is no "namespace" for options (all options are visible from everywhere),
functions referenced in options.h must be defined in a file that is linked with
everything, which is very inconvenient. Any ideas how to overcome this?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
  2009-08-06 15:06 [Bug c/40989] New: -Werror=implicit does not enable -Wimplicit flameeyes at gentoo dot org
                   ` (2 preceding siblings ...)
  2010-03-12  0:15 ` manu at gcc dot gnu dot org
@ 2010-05-06 10:13 ` manu at gcc dot gnu dot org
  2010-05-06 10:22 ` manu at gcc dot gnu dot org
  2010-05-07 10:26 ` ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-05-06 10:13 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2518 bytes --]



------- Comment #4 from manu at gcc dot gnu dot org  2010-05-06 10:12 -------
Subject: Bug 40989

Author: manu
Date: Thu May  6 10:12:36 2010
New Revision: 159102

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159102
Log:
2010-05-06  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        PR 40989
        * doc/invoke.texi (Wimplicit): Document as C only.
        * opts.c (common_handle_option): Add argument kind.
        (handle_option): Rename as read_cmdline_option. Factor out code to...
        (handle_option): ... here. New.
        (handle_options): Rename as read_cmdline_options.
        (decode_options): Update call.
        (set_option): Use option index instead of option pointer. Classify
        diagnostics correctly.
        (enable_warning_as_error): Call handle_option.
        * opts.h (set_option): Update declaration.
        (handle_option): Declare.
        * langhooks.h (struct lang_hooks): Add argument kind to
        handle_option.
        * c.opt (Wimplicit,Wimplicit-int): Initialize to -1.
        * c-opts.c (set_Wimplicit): Delete.
        (c_family_lang_mask): New static constant.
        (c_common_handle_option): Add argument kind. Use handle_option
        instead of set_Wimplicit.
        (c_common_post_options): warn_implicit and warn_implicit_int
        are disabled by default.
        * c-common.c (warn_implicit): Do not define here.
        * c-common.h (warn_implicit): Do not declare here.
        (c_common_handle_option): Update declaration.
        * lto-opts.c (lto_reissue_options): Update call to set_option.
java/
        * lang.c (java_handle_option): Add argument kind.
fortran/        
        * options.c (gfc_handle_option): Add argument kind.
        * gfortran.h (gfc_handle_option): Update declaration.
ada/
        * gcc-interface/misc.c (gnat_handle_option): Add argument kind.
testsuite/
        * gcc.dg/pr40989.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/pr40989.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/gcc-interface/misc.c
    trunk/gcc/c-common.c
    trunk/gcc/c-common.h
    trunk/gcc/c-opts.c
    trunk/gcc/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/options.c
    trunk/gcc/java/ChangeLog
    trunk/gcc/java/lang.c
    trunk/gcc/langhooks.h
    trunk/gcc/lto-opts.c
    trunk/gcc/opts.c
    trunk/gcc/opts.h
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
  2009-08-06 15:06 [Bug c/40989] New: -Werror=implicit does not enable -Wimplicit flameeyes at gentoo dot org
                   ` (3 preceding siblings ...)
  2010-05-06 10:13 ` manu at gcc dot gnu dot org
@ 2010-05-06 10:22 ` manu at gcc dot gnu dot org
  2010-05-07 10:26 ` ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-05-06 10:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from manu at gcc dot gnu dot org  2010-05-06 10:22 -------
OK, this is fixed for -Wimplicit and the infrastructure is there to fix it for
all other group flags (just use the new handle_option to enable sub-flags).
However, I don't have time at the moment to go over all subflags. So anyone,
feel free to submit patches about this. If you need some help or mentoring,
just ask.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
  2009-08-06 15:06 [Bug c/40989] New: -Werror=implicit does not enable -Wimplicit flameeyes at gentoo dot org
                   ` (4 preceding siblings ...)
  2010-05-06 10:22 ` manu at gcc dot gnu dot org
@ 2010-05-07 10:26 ` ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-05-07 10:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ebotcazou at gcc dot gnu dot org  2010-05-07 10:26 -------
Subject: Bug 40989

Author: ebotcazou
Date: Fri May  7 10:25:54 2010
New Revision: 159149

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159149
Log:
        PR 40989
        * gcc-interface/misc.c (gnat_handle_option): Fix long line.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/gcc-interface/misc.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
       [not found] <bug-40989-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-10-16 15:39 ` manu at gcc dot gnu.org
@ 2012-10-20 14:17 ` manu at gcc dot gnu.org
  3 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-10-20 14:17 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989

--- Comment #10 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-10-20 14:17:14 UTC ---
Author: manu
Date: Sat Oct 20 14:17:08 2012
New Revision: 192635

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192635
Log:
2012-10-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c/53063
    PR c/40989
c-family/
    * c.opt (Waddress,Wchar-subscripts,Wsign-conversion,Wimplicit,
    Wimplicit-function-declaration,Wimplicit-int,Wsizeof-pointer-memaccess,
    Wnarrowing,Wparentheses,Wpointer-sign,Wreturn-type,Wsequence-point,
    Wsign-compare,Wuninitialized,Wmaybe-uninitialized,Wunused,
    Wvolatile-register-var): Add LangEnabledBy or EnabledBy.
    * c-opts.c (c_common_handle_option): Remove explicit handling from
    here.
    (c_common_post_options): Likewise.
gcc/
    * opts.c (finish_options): Remove explicit handling from here.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-opts.c
    trunk/gcc/c-family/c.opt
    trunk/gcc/opts.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
       [not found] <bug-40989-4@http.gcc.gnu.org/bugzilla/>
  2012-04-28  0:11 ` manu at gcc dot gnu.org
  2012-10-16 15:32 ` manu at gcc dot gnu.org
@ 2012-10-16 15:39 ` manu at gcc dot gnu.org
  2012-10-20 14:17 ` manu at gcc dot gnu.org
  3 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-10-16 15:39 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989

--- Comment #9 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-10-16 15:39:08 UTC ---
Author: manu
Date: Tue Oct 16 15:38:58 2012
New Revision: 192503

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192503
Log:
2012-10-16  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c/53063
    PR c/40989
    * doc/options.texi (EnabledBy): Document new form.
    * optc-gen.awk: Handle new form of EnabledBy.
    * common.opt (Wunused-but-set-parameter): Use EnabledBy.
    (Wunused-parameter): Likewise.
    * opts.c (finish_options): Do not handle them explicitly.
    * opt-functions.awk (search_var_name): New.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/common.opt
    trunk/gcc/doc/options.texi
    trunk/gcc/opt-functions.awk
    trunk/gcc/optc-gen.awk
    trunk/gcc/opts.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
       [not found] <bug-40989-4@http.gcc.gnu.org/bugzilla/>
  2012-04-28  0:11 ` manu at gcc dot gnu.org
@ 2012-10-16 15:32 ` manu at gcc dot gnu.org
  2012-10-16 15:39 ` manu at gcc dot gnu.org
  2012-10-20 14:17 ` manu at gcc dot gnu.org
  3 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-10-16 15:32 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-10-16 15:31:55 UTC ---
Author: manu
Date: Tue Oct 16 15:31:46 2012
New Revision: 192502

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192502
Log:
2012-10-16  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c/53063
    PR c/40989
gcc/
    * optc-gen.awk: Handle new form of LangEnabledBy.
    * opts.c (set_Wstrict_aliasing): Declare here. Make static.
    * common.opt (Wstrict-aliasing=,Wstrict-overflow=): Do not use Init.
    * doc/options.texi (LangEnabledBy): Document new form.
    * flags.h (set_Wstrict_aliasing): Do not declare.
c-family/
    * c.opt (Wstrict-aliasing=,Wstrict-overflow=): Use LangEnabledBy.
    * c-opts.c (c_common_handle_option): Do not set them here. Add
    comment.
    (c_common_post_options): Likewise.
testsuite/
    * gcc.dg/Wstrict-overflow-24.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/Wstrict-overflow-24.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-opts.c
    trunk/gcc/c-family/c.opt
    trunk/gcc/common.opt
    trunk/gcc/doc/options.texi
    trunk/gcc/flags.h
    trunk/gcc/optc-gen.awk
    trunk/gcc/opts.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags
       [not found] <bug-40989-4@http.gcc.gnu.org/bugzilla/>
@ 2012-04-28  0:11 ` manu at gcc dot gnu.org
  2012-10-16 15:32 ` manu at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-28  0:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40989

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |53063

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-28 00:11:12 UTC ---
Doing this option by option is stupid. Groups options should be encoded in .opt
files and the code to handle sub-options be automatically generated. PR50363
needs to be fixed first.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-10-20 14:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-06 15:06 [Bug c/40989] New: -Werror=implicit does not enable -Wimplicit flameeyes at gentoo dot org
2009-08-06 15:10 ` [Bug c/40989] " flameeyes at gentoo dot org
2009-08-07 13:07 ` [Bug c/40989] -Werror= and #pragma diagnostics do not work with group flags manu at gcc dot gnu dot org
2010-03-12  0:15 ` manu at gcc dot gnu dot org
2010-05-06 10:13 ` manu at gcc dot gnu dot org
2010-05-06 10:22 ` manu at gcc dot gnu dot org
2010-05-07 10:26 ` ebotcazou at gcc dot gnu dot org
     [not found] <bug-40989-4@http.gcc.gnu.org/bugzilla/>
2012-04-28  0:11 ` manu at gcc dot gnu.org
2012-10-16 15:32 ` manu at gcc dot gnu.org
2012-10-16 15:39 ` manu at gcc dot gnu.org
2012-10-20 14:17 ` manu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).