public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38105]  New: -Wundef -Werror -Wno-error=undef result in error, not warning
@ 2008-11-13 20:08 simon at josefsson dot org
  2008-11-13 20:11 ` [Bug preprocessor/38105] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: simon at josefsson dot org @ 2008-11-13 20:08 UTC (permalink / raw)
  To: gcc-bugs

jas@mocca:~$ cat foo.c
#if FOO
#endif
int main (void) { return 42; }
jas@mocca:~$ gcc -o foo foo.c -Wundef -Werror -Wno-error=undef
foo.c:1:5: error: "FOO" is not defined
jas@mocca:~$ 

I'd expect that this would only result in a warning.

All other warning parameter I've tried works as expected.


-- 
           Summary: -Wundef -Werror -Wno-error=undef result in error, not
                    warning
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon at josefsson dot org
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug preprocessor/38105] -Wundef -Werror -Wno-error=undef result in error, not warning
  2008-11-13 20:08 [Bug c/38105] New: -Wundef -Werror -Wno-error=undef result in error, not warning simon at josefsson dot org
@ 2008-11-13 20:11 ` pinskia at gcc dot gnu dot org
  2008-11-13 21:17 ` simon at josefsson dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-11-13 20:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-11-13 20:10 -------
I think the issue is that the preprocessor does not use the correct form of
warning :).


-- 


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


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

* [Bug preprocessor/38105] -Wundef -Werror -Wno-error=undef result in error, not warning
  2008-11-13 20:08 [Bug c/38105] New: -Wundef -Werror -Wno-error=undef result in error, not warning simon at josefsson dot org
  2008-11-13 20:11 ` [Bug preprocessor/38105] " pinskia at gcc dot gnu dot org
@ 2008-11-13 21:17 ` simon at josefsson dot org
  2009-01-02 16:42 ` tromey at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: simon at josefsson dot org @ 2008-11-13 21:17 UTC (permalink / raw)
  To: gcc-bugs

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



------- Comment #2 from simon at josefsson dot org  2008-11-13 21:15 -------
I've found another warning parameter that behaves in a similar way, see output
below.  Note that this doesn't appear to be a general problem, I'm using
-Wno-error=foo to turn several errors into merely warnings.

jas@mocca:~$ cat bar.c
enum a { FOO, BAR };
int main (void)
{
  enum a a;
  switch (a)
    {
    case FOO:
      return 1;
    }
  return 0;
}
jas@mocca:~$ gcc -o bar bar.c -Wswitch-enum -Werror -Wno-error=switch-enum
cc1: warnings being treated as errors
bar.c: In function ‘main’:
bar.c:5: error: enumeration value ‘BAR’ not handled in switch
jas@mocca:~$ 


-- 


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


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

* [Bug preprocessor/38105] -Wundef -Werror -Wno-error=undef result in error, not warning
  2008-11-13 20:08 [Bug c/38105] New: -Wundef -Werror -Wno-error=undef result in error, not warning simon at josefsson dot org
  2008-11-13 20:11 ` [Bug preprocessor/38105] " pinskia at gcc dot gnu dot org
  2008-11-13 21:17 ` simon at josefsson dot org
@ 2009-01-02 16:42 ` tromey at gcc dot gnu dot org
  2009-03-29 23:04 ` jsm28 at gcc dot gnu dot org
  2010-06-21 23:17 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at gcc dot gnu dot org @ 2009-01-02 16:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tromey at gcc dot gnu dot org  2009-01-02 16:39 -------
Please report the bug in comment #2 separately.
Otherwise it is unlikely to be seen by the appropriate person.

Andrew is correct; this would probably be fixed if we had gcc
tell libcpp to use its diagnostic code.


-- 

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         |2009-01-02 16:39:43
               date|                            |


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


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

* [Bug preprocessor/38105] -Wundef -Werror -Wno-error=undef result in error, not warning
  2008-11-13 20:08 [Bug c/38105] New: -Wundef -Werror -Wno-error=undef result in error, not warning simon at josefsson dot org
                   ` (2 preceding siblings ...)
  2009-01-02 16:42 ` tromey at gcc dot gnu dot org
@ 2009-03-29 23:04 ` jsm28 at gcc dot gnu dot org
  2010-06-21 23:17 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-29 23:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jsm28 at gcc dot gnu dot org  2009-03-29 23:04 -------
cpplib now uses diagnostic.c, but this does not magically fix this problem.

See what I said in <http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00491.html>
about how to fix this:

  One potential use for making cpplib use the compiler's diagnostic
  infrastructure would be the ability to control the warnings (with
  pragmas, -Werror=option etc.) the same way as with those from the
  compiler.  To implement this on top of this patch, cpp_error and
  cpp_error_with_line could be changed to take a cpplib-specific
  identifier for the diagnostic or group of diagnostics; the callbacks
  could then convert those identifiers to ones suitable for
  diagnostic.c.


-- 


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


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

* [Bug preprocessor/38105] -Wundef -Werror -Wno-error=undef result in error, not warning
  2008-11-13 20:08 [Bug c/38105] New: -Wundef -Werror -Wno-error=undef result in error, not warning simon at josefsson dot org
                   ` (3 preceding siblings ...)
  2009-03-29 23:04 ` jsm28 at gcc dot gnu dot org
@ 2010-06-21 23:17 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-06-21 23:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2010-06-21 23:17 -------
This appears to be fixed on trunk, probably by:

2010-04-07  Simon Baldwin  <simonb@google.com>

        * directives.c (do_diagnostic): Add warning reason argument,
        call appropriate error reporting function for code.
[...]


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.6.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0


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


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

end of thread, other threads:[~2010-06-21 23:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-13 20:08 [Bug c/38105] New: -Wundef -Werror -Wno-error=undef result in error, not warning simon at josefsson dot org
2008-11-13 20:11 ` [Bug preprocessor/38105] " pinskia at gcc dot gnu dot org
2008-11-13 21:17 ` simon at josefsson dot org
2009-01-02 16:42 ` tromey at gcc dot gnu dot org
2009-03-29 23:04 ` jsm28 at gcc dot gnu dot org
2010-06-21 23:17 ` 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).