public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/30219]  New: Inconsistent reporting of duplicate typedef
@ 2006-12-15 12:22 ross dot alexander at uk dot neceur dot com
  2006-12-15 12:23 ` [Bug c/30219] " ross dot alexander at uk dot neceur dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ross dot alexander at uk dot neceur dot com @ 2006-12-15 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

I have an include (nvidia GL/glext.h) which incorrectly defines a typedef
twice.  However gcc doesn't not always report this is as a failure.

mig27 12:16:21$ cat test.c
#include "GL/gl.h"

mig27 12:15:23$ gcc -E  test.c > a.i
mig27 12:15:30$ gcc -c a.i
mig27 12:15:34$ echo $?
0
mig27 12:15:36$ gcc -E -P test.c > a.i
mig27 12:15:43$ gcc -c a.i
a.i:1505: error: redefinition of typedef ‘PFNGLGETUNIFORMUIVEXTPROC’
a.i:1494: error: previous declaration of ‘PFNGLGETUNIFORMUIVEXTPROC’ was
here


-- 
           Summary: Inconsistent reporting of duplicate typedef
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ross dot alexander at uk dot neceur dot com
 GCC build triplet: i386-unknown-linux
  GCC host triplet: i386-unknown-linux
GCC target triplet: i386-unknown-linux


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


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

* [Bug c/30219] Inconsistent reporting of duplicate typedef
  2006-12-15 12:22 [Bug c/30219] New: Inconsistent reporting of duplicate typedef ross dot alexander at uk dot neceur dot com
@ 2006-12-15 12:23 ` ross dot alexander at uk dot neceur dot com
  2006-12-15 12:24 ` ross dot alexander at uk dot neceur dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ross dot alexander at uk dot neceur dot com @ 2006-12-15 12:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ross dot alexander at uk dot neceur dot com  2006-12-15 12:23 -------
Created an attachment (id=12810)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12810&action=view)
GL/glext.h


-- 


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


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

* [Bug c/30219] Inconsistent reporting of duplicate typedef
  2006-12-15 12:22 [Bug c/30219] New: Inconsistent reporting of duplicate typedef ross dot alexander at uk dot neceur dot com
  2006-12-15 12:23 ` [Bug c/30219] " ross dot alexander at uk dot neceur dot com
@ 2006-12-15 12:24 ` ross dot alexander at uk dot neceur dot com
  2006-12-15 15:16 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ross dot alexander at uk dot neceur dot com @ 2006-12-15 12:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ross dot alexander at uk dot neceur dot com  2006-12-15 12:23 -------
Created an attachment (id=12811)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12811&action=view)
GL/gl.h


-- 


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


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

* [Bug c/30219] Inconsistent reporting of duplicate typedef
  2006-12-15 12:22 [Bug c/30219] New: Inconsistent reporting of duplicate typedef ross dot alexander at uk dot neceur dot com
  2006-12-15 12:23 ` [Bug c/30219] " ross dot alexander at uk dot neceur dot com
  2006-12-15 12:24 ` ross dot alexander at uk dot neceur dot com
@ 2006-12-15 15:16 ` pinskia at gcc dot gnu dot org
  2006-12-15 15:25 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-15 15:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-12-15 15:16 -------
*** Bug 30218 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c/30219] Inconsistent reporting of duplicate typedef
  2006-12-15 12:22 [Bug c/30219] New: Inconsistent reporting of duplicate typedef ross dot alexander at uk dot neceur dot com
                   ` (2 preceding siblings ...)
  2006-12-15 15:16 ` pinskia at gcc dot gnu dot org
@ 2006-12-15 15:25 ` pinskia at gcc dot gnu dot org
  2006-12-15 16:28 ` ross dot alexander at uk dot neceur dot com
  2006-12-15 16:57 ` ross dot alexander at uk dot neceur dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-15 15:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-12-15 15:25 -------
This is inconsistent on purpose.
Try using -Wsystem-headers if you want an error on system headers.

Also this is the main reason why we only error with -Wsystem-headers with
system headers.

PS please don't send private header files next time.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c/30219] Inconsistent reporting of duplicate typedef
  2006-12-15 12:22 [Bug c/30219] New: Inconsistent reporting of duplicate typedef ross dot alexander at uk dot neceur dot com
                   ` (3 preceding siblings ...)
  2006-12-15 15:25 ` pinskia at gcc dot gnu dot org
@ 2006-12-15 16:28 ` ross dot alexander at uk dot neceur dot com
  2006-12-15 16:57 ` ross dot alexander at uk dot neceur dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ross dot alexander at uk dot neceur dot com @ 2006-12-15 16:28 UTC (permalink / raw)
  To: gcc-bugs

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



------- Comment #5 from ross dot alexander at uk dot neceur dot com  2006-12-15 16:28 -------
Subject: Re:  Inconsistent reporting of duplicate typedef

 > This is inconsistent on purpose.

 > Try using -Wsystem-headers if you want an error on system headers.

I can't get it to error if it is using -Wsystem-headers.  Reading the 
documentation I understand the purpose of flag but this seems to be 
ignoring an error rather than not reporting a warning.  I have 
/usr/include/GL -> /usr/X11R6/include/GL so I can see why I get a 
failure with -I/usr/X11R6/include but it should still be erring with 
-I/usr/include (since glext.h does have an error in it).

mig27 15:47:08$ gcc -c -Wsystem-headers -I/usr/include test.c
mig27 15:47:12$ gcc -c -Wsystem-headers -I/usr/X11R6/include test.c
In file included from /usr/X11R6/include/GL/gl.h:1630,
                 from test.c:1:
/usr/X11R6/include/GL/glext.h:6952: error: redefinition of typedef 
‘PFNGLGETUNIFORMUIVEXTPROC’
/usr/X11R6/include/GL/glext.h:6941: error: previous declaration of 
‘PFNGLGETUNIFORMUIVEXTPROC’ was here
mig27 15:47:19$ gcc -c -Wsystem-headers -I/usr/include test.c
mig27 15:49:20$ gcc -c -Wsystem-headers -Werror -I/usr/include test.c

mig27 15:56:23$ gcc -c -I/usr/include test.c
mig27 15:56:26$ gcc -c -I/usr/X11R6/include test.c
In file included from /usr/X11R6/include/GL/gl.h:1630,
                 from test.c:1:
/usr/X11R6/include/GL/glext.h:6952: error: redefinition of typedef 
‘PFNGLGETUNIFORMUIVEXTPROC’
/usr/X11R6/include/GL/glext.h:6941: error: previous declaration of 
‘PFNGLGETUNIFORMUIVEXTPROC’ was here


 > Also this is the main reason why we only error with -Wsystem-headers 
with system headers.

 > PS please don't send private header files next time.

Okay.

Cheers,

Ross


------- Comment #6 from ross dot alexander at uk dot neceur dot com  2006-12-15 16:28 -------
Created an attachment (id=12814)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12814&action=view)


-- 


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


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

* [Bug c/30219] Inconsistent reporting of duplicate typedef
  2006-12-15 12:22 [Bug c/30219] New: Inconsistent reporting of duplicate typedef ross dot alexander at uk dot neceur dot com
                   ` (4 preceding siblings ...)
  2006-12-15 16:28 ` ross dot alexander at uk dot neceur dot com
@ 2006-12-15 16:57 ` ross dot alexander at uk dot neceur dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ross dot alexander at uk dot neceur dot com @ 2006-12-15 16:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ross dot alexander at uk dot neceur dot com  2006-12-15 16:56 -------
I have found the relevent code in c-decl.c but it would be nice if this emitted
a warning so that if -Wsystem-headers is set then the warning will show up.  

Thanks for the assistence.

Ross

  /* Redeclaration of a type is a constraint violation (6.7.2.3p1),
     but silently ignore the redeclaration if either is in a system
     header.  (Conflicting redeclarations were handled above.)  */
  if (TREE_CODE (newdecl) == TYPE_DECL)
    {
      if (DECL_IN_SYSTEM_HEADER (newdecl) || DECL_IN_SYSTEM_HEADER (olddecl))
        return true;  /* Allow OLDDECL to continue in use.  */

      error ("redefinition of typedef %q+D", newdecl);
      locate_old_decl (olddecl, error);
      return false;
    }



-- 


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


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

end of thread, other threads:[~2006-12-15 16:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-15 12:22 [Bug c/30219] New: Inconsistent reporting of duplicate typedef ross dot alexander at uk dot neceur dot com
2006-12-15 12:23 ` [Bug c/30219] " ross dot alexander at uk dot neceur dot com
2006-12-15 12:24 ` ross dot alexander at uk dot neceur dot com
2006-12-15 15:16 ` pinskia at gcc dot gnu dot org
2006-12-15 15:25 ` pinskia at gcc dot gnu dot org
2006-12-15 16:28 ` ross dot alexander at uk dot neceur dot com
2006-12-15 16:57 ` ross dot alexander at uk dot neceur dot com

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).