public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/34695]  New: Preprocessor warning->error conversion from -Werror is silent
@ 2008-01-06 22:31 ed at catmur dot co dot uk
  2008-01-06 23:19 ` [Bug preprocessor/34695] " ed at catmur dot co dot uk
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ed at catmur dot co dot uk @ 2008-01-06 22:31 UTC (permalink / raw)
  To: gcc-bugs

When -Werror is passed in, libcpp silently converts warnings to errors:
$ gcc foo.c -Wall -Werror
foo.c:3:1: error: "FOO" redefined
foo.c:2:1: error: this is the location of the previous definition

This is potentially confusing, and inconsistent with cc, which displays:
$ gcc foo.c -Wall -Werror
cc1: warnings being treated as errors
foo.c:1: warning: return type defaults to ‘int’
foo.c: In function ‘main’:
foo.c:1: warning: control reaches end of non-void function


-- 
           Summary: Preprocessor warning->error conversion from -Werror is
                    silent
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ed at catmur dot co dot uk


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
@ 2008-01-06 23:19 ` ed at catmur dot co dot uk
  2008-01-07 20:56 ` tromey at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ed at catmur dot co dot uk @ 2008-01-06 23:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ed at catmur dot co dot uk  2008-01-06 22:35 -------
Created an attachment (id=14892)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14892&action=view)
gcc-cpp-Werror-message.patch

Proposed patch.


-- 


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
  2008-01-06 23:19 ` [Bug preprocessor/34695] " ed at catmur dot co dot uk
@ 2008-01-07 20:56 ` tromey at gcc dot gnu dot org
  2008-01-20 10:00 ` ed at catmur dot co dot uk
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-01-07 20:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tromey at gcc dot gnu dot org  2008-01-07 20:08 -------
I agree this is a bug.

I think this patch is insufficient.  For best results I think that
libcpp and diagnostic.c should agree on whether the "warnins being treated
as errors" message has been emitted.

One way to do this would be to finally switch libcpp to emit all errors
via diagnostic.c.  Though I suppose that, even if we do this, we may still
need something like this patch for other users of libcpp.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-07 20:08:47
               date|                            |


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
  2008-01-06 23:19 ` [Bug preprocessor/34695] " ed at catmur dot co dot uk
  2008-01-07 20:56 ` tromey at gcc dot gnu dot org
@ 2008-01-20 10:00 ` ed at catmur dot co dot uk
  2008-01-20 22:31 ` ed at catmur dot co dot uk
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ed at catmur dot co dot uk @ 2008-01-20 10:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ed at catmur dot co dot uk  2008-01-20 08:56 -------
Created an attachment (id=14977)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14977&action=view)
gcc-cpp-Werror-message-cpp-diagnostic.patch

Is this what you meant?  Not sure whether I've got the source_location stuff
correct, but it seems to work.


-- 

ed at catmur dot co dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14892|0                           |1
        is obsolete|                            |


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
                   ` (2 preceding siblings ...)
  2008-01-20 10:00 ` ed at catmur dot co dot uk
@ 2008-01-20 22:31 ` ed at catmur dot co dot uk
  2008-01-20 23:16 ` ed at catmur dot co dot uk
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ed at catmur dot co dot uk @ 2008-01-20 22:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ed at catmur dot co dot uk  2008-01-20 22:20 -------
Created an attachment (id=14980)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14980&action=view)
gcc-cpp-Werror-message.patch

Also when preprocessing-only.


-- 

ed at catmur dot co dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14977|0                           |1
        is obsolete|                            |


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
                   ` (3 preceding siblings ...)
  2008-01-20 22:31 ` ed at catmur dot co dot uk
@ 2008-01-20 23:16 ` ed at catmur dot co dot uk
  2008-01-22  2:45 ` ed at catmur dot co dot uk
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ed at catmur dot co dot uk @ 2008-01-20 23:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ed at catmur dot co dot uk  2008-01-20 22:28 -------
Created an attachment (id=14981)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14981&action=view)
gcc-cpp-Werror-message.patch


-- 

ed at catmur dot co dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14980|0                           |1
        is obsolete|                            |


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
                   ` (4 preceding siblings ...)
  2008-01-20 23:16 ` ed at catmur dot co dot uk
@ 2008-01-22  2:45 ` ed at catmur dot co dot uk
  2008-01-22  2:47 ` ed at catmur dot co dot uk
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ed at catmur dot co dot uk @ 2008-01-22  2:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ed at catmur dot co dot uk  2008-01-22 00:55 -------
Created an attachment (id=14993)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14993&action=view)
gcc-cpp-Werror-message.patch

Try to handle system-header and inhibit conditions/flags correctly.


-- 

ed at catmur dot co dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14981|0                           |1
        is obsolete|                            |


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
                   ` (5 preceding siblings ...)
  2008-01-22  2:45 ` ed at catmur dot co dot uk
@ 2008-01-22  2:47 ` ed at catmur dot co dot uk
  2008-01-22  6:07 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ed at catmur dot co dot uk @ 2008-01-22  2:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ed at catmur dot co dot uk  2008-01-22 00:58 -------
Created an attachment (id=14994)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14994&action=view)
gcc-cpp-Werror-message.patch

de-obfuscate the pedwarn code path


-- 

ed at catmur dot co dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14993|0                           |1
        is obsolete|                            |


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
                   ` (6 preceding siblings ...)
  2008-01-22  2:47 ` ed at catmur dot co dot uk
@ 2008-01-22  6:07 ` manu at gcc dot gnu dot org
  2009-02-11  1:14 ` jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-01-22  6:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from manu at gcc dot gnu dot org  2008-01-22 05:52 -------
(In reply to comment #7)
> Created an attachment (id=14994)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14994&action=view) [edit]
> gcc-cpp-Werror-message.patch
> 
> de-obfuscate the pedwarn code path
> 

Hi, Ed, not sure whether you know that for us to be able to accept your patch,
you need a copyright assignment form with the FSF:
http://gcc.gnu.org/contribute.html#legal


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
                   ` (7 preceding siblings ...)
  2008-01-22  6:07 ` manu at gcc dot gnu dot org
@ 2009-02-11  1:14 ` jsm28 at gcc dot gnu dot org
  2009-03-29 22:56 ` jsm28 at gcc dot gnu dot org
  2009-03-29 22:59 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-02-11  1:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2009-02-11 01:14 -------
This is fixed by my patch to make cpplib always use the diagnostic.c
infrastructure: http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00491.html

(This change is the cause of the Wvariadic-1.c and Wvariadic-3.c testcase
changes in that patch.)

Thus, assigning the bug to myself.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jsm28 at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-01-07 20:08:47         |2009-02-11 01:14:11
               date|                            |


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
                   ` (8 preceding siblings ...)
  2009-02-11  1:14 ` jsm28 at gcc dot gnu dot org
@ 2009-03-29 22:56 ` jsm28 at gcc dot gnu dot org
  2009-03-29 22:59 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-29 22:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jsm28 at gcc dot gnu dot org  2009-03-29 22:56 -------
Subject: Bug 34695

Author: jsm28
Date: Sun Mar 29 22:56:07 2009
New Revision: 145263

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145263
Log:
        PR preprocessor/34695

gcc:
        * Makefile.in (c-opts.o): Depend on c-tree.h.
        * c-common.c: Move down include of diagnostic.h.
        (done_lexing, c_cpp_error): New.
        * c-common.h (done_lexing): Declare.
        * c-decl.c (c_write_global_declarations): Don't check cpp_errors
        (parse_in).
        * c-opts.c: Include c-tree.h.
        (c_common_init_options): Set preprocessor error callback.
        (c_common_handle_option): Do not set preprocessor
        inhibit_warnings, warnings_are_errors, warn_system_headers,
        pedantic_errors or inhibit_warnings flags.
        (c_common_post_options): Do not check cpp_errors (parse_in).
        (c_common_finish): Do not output dependencies if there were
        errors.  Do not check return value of cpp_finish.
        * c-ppoutput.c (pp_file_change): Set input_location.
        * c-tree.h (c_cpp_error): Declare.
        * diagnostic.c (diagnostic_set_info_translated): Also initialize
        override_column.
        (diagnostic_build_prefix): Check override_column.
        * diagnostic.h (diagnostic_info): Add override_column field.
        (diagnostic_override_column): Define.

gcc/cp:
        * cp-tree.h (cp_cpp_error): Remove.
        * error.c (cp_cpp_error): Remove.
        * parser.c (cp_lexer_new_main): Set done_lexing instead of
        client_diagnostic and error callback.

gcc/fortran:
        * cpp.c (cb_cpp_error): New.
        (gfc_cpp_post_options): Don't set cpp_option->inhibit_warnings.
        Don't check cpp_errors (cpp_in).
        (gfc_cpp_init_0): Set cb->error.

gcc/testsuite:
        * gcc.dg/builtin-redefine.c, gcc.dg/cpp/redef2.c,
        gcc.dg/cpp/redef3.c, gcc.dg/cpp/trad/redef2.c: Use dg-message
        instead of dg-warning for "previous definition" messages.
        * gcc.dg/cpp/Wvariadic-1.c, gcc.dg/cpp/Wvariadic-3.c: Expect
        "warnings being treated as errors" message.
        * gcc.dg/fltconst-1.c: Use -fshow-column.

libcpp:
        * makedepend.c: Remove.
        * Makefile.in (makedepend_OBJS, makedepend$(EXEEXT)): Remove.
        (all, clean, TAGS_SOURCES, include): Remove makedepend handling.
        * directives.c (cpp_errors): Remove.
        * errors.c (print_location, _cpp_begin_message, v_message):
        Remove.
        (cpp_error, cpp_error_with_line): Always use error callback.
        (cpp_error, cpp_error_with_line, cpp_errno): Return bool.
        * include/cpplib.h (cpp_options): Remove pedantic_errors,
        inhibit_warnings, warn_system_headers, inhibit_errors,
        warnings_are_errors, client_diagnostic.
        (cpp_callbacks): Add extra arguments to error callback; make it
        return bool.
        (cpp_finish): Return void.
        (cpp_destroy): Remove inaccurate comment about return value.
        (cpp_errors, CPP_DL_EXTRACT, CPP_DL_WARNING_P): Remove.
        (CPP_DL_NOTE): Define.
        * include/line-map.h (linemap_print_containing_files): Remove.
        * init.c (cpp_finish): Do not check for or return number of
        errors.
        * internal.h (cpp_reader): Remove errors field.
        * line-map.c (linemap_print_containing_files): Remove.
        * macro.c (_cpp_create_definition): Use CPP_DL_NOTE for message
        about previous definition.  Only emit it if previous diagnostic
        was emitted.

Removed:
    trunk/libcpp/makedepend.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/c-common.c
    trunk/gcc/c-common.h
    trunk/gcc/c-decl.c
    trunk/gcc/c-opts.c
    trunk/gcc/c-ppoutput.c
    trunk/gcc/c-tree.h
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/error.c
    trunk/gcc/cp/parser.c
    trunk/gcc/diagnostic.c
    trunk/gcc/diagnostic.h
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/cpp.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/builtin-redefine.c
    trunk/gcc/testsuite/gcc.dg/cpp/Wvariadic-1.c
    trunk/gcc/testsuite/gcc.dg/cpp/Wvariadic-3.c
    trunk/gcc/testsuite/gcc.dg/cpp/redef2.c
    trunk/gcc/testsuite/gcc.dg/cpp/redef3.c
    trunk/gcc/testsuite/gcc.dg/cpp/trad/redef2.c
    trunk/gcc/testsuite/gcc.dg/fltconst-1.c
    trunk/libcpp/ChangeLog
    trunk/libcpp/Makefile.in
    trunk/libcpp/directives.c
    trunk/libcpp/errors.c
    trunk/libcpp/include/cpplib.h
    trunk/libcpp/include/line-map.h
    trunk/libcpp/init.c
    trunk/libcpp/internal.h
    trunk/libcpp/line-map.c
    trunk/libcpp/macro.c


-- 


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


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

* [Bug preprocessor/34695] Preprocessor warning->error conversion from -Werror is silent
  2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
                   ` (9 preceding siblings ...)
  2009-03-29 22:56 ` jsm28 at gcc dot gnu dot org
@ 2009-03-29 22:59 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-29 22:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jsm28 at gcc dot gnu dot org  2009-03-29 22:58 -------
Fixed for 4.5.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2009-03-29 22:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-06 22:31 [Bug preprocessor/34695] New: Preprocessor warning->error conversion from -Werror is silent ed at catmur dot co dot uk
2008-01-06 23:19 ` [Bug preprocessor/34695] " ed at catmur dot co dot uk
2008-01-07 20:56 ` tromey at gcc dot gnu dot org
2008-01-20 10:00 ` ed at catmur dot co dot uk
2008-01-20 22:31 ` ed at catmur dot co dot uk
2008-01-20 23:16 ` ed at catmur dot co dot uk
2008-01-22  2:45 ` ed at catmur dot co dot uk
2008-01-22  2:47 ` ed at catmur dot co dot uk
2008-01-22  6:07 ` manu at gcc dot gnu dot org
2009-02-11  1:14 ` jsm28 at gcc dot gnu dot org
2009-03-29 22:56 ` jsm28 at gcc dot gnu dot org
2009-03-29 22:59 ` jsm28 at gcc dot gnu dot 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).