public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17881] New: Incomplete type warning is issued even for prototypes
@ 2004-10-07 12:52 jakub at gcc dot gnu dot org
2004-10-07 13:18 ` [Bug c++/17881] " bangerth at dealii dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2004-10-07 12:52 UTC (permalink / raw)
To: gcc-bugs
struct S;
struct foo { void (*bar) (struct S); };
void baz (struct S);
struct S { int i; };
void baz (struct S s)
{
(void) s.i;
}
warns about the incomplete type in prototype and function pointer, although
the size of the object is not needed in those cases.
--
Summary: Incomplete type warning is issued even for prototypes
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17881
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/17881] Incomplete type warning is issued even for prototypes
2004-10-07 12:52 [Bug c/17881] New: Incomplete type warning is issued even for prototypes jakub at gcc dot gnu dot org
@ 2004-10-07 13:18 ` bangerth at dealii dot org
2004-10-07 13:22 ` [Bug c/17881] " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-10-07 13:18 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c |c++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17881
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/17881] Incomplete type warning is issued even for prototypes
2004-10-07 12:52 [Bug c/17881] New: Incomplete type warning is issued even for prototypes jakub at gcc dot gnu dot org
2004-10-07 13:18 ` [Bug c++/17881] " bangerth at dealii dot org
@ 2004-10-07 13:22 ` pinskia at gcc dot gnu dot org
2004-10-07 16:29 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-07 13:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-07 13:22 -------
The code is C.... ("void (*bar) (struct S);" is a pointer to function).
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |c
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17881
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/17881] Incomplete type warning is issued even for prototypes
2004-10-07 12:52 [Bug c/17881] New: Incomplete type warning is issued even for prototypes jakub at gcc dot gnu dot org
2004-10-07 13:18 ` [Bug c++/17881] " bangerth at dealii dot org
2004-10-07 13:22 ` [Bug c/17881] " pinskia at gcc dot gnu dot org
@ 2004-10-07 16:29 ` pinskia at gcc dot gnu dot org
2004-10-07 19:44 ` jsm at polyomino dot org dot uk
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-07 16:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-07 16:29 -------
Confirmed but I really want a C person to comment here. The C++ front-end does not warn about this.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |diagnostic
Known to fail| |3.0.4 3.2.3 3.3.3
Last reconfirmed|0000-00-00 00:00:00 |2004-10-07 16:29:33
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17881
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/17881] Incomplete type warning is issued even for prototypes
2004-10-07 12:52 [Bug c/17881] New: Incomplete type warning is issued even for prototypes jakub at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-10-07 16:29 ` pinskia at gcc dot gnu dot org
@ 2004-10-07 19:44 ` jsm at polyomino dot org dot uk
2004-10-10 19:20 ` cvs-commit at gcc dot gnu dot org
2004-10-10 19:24 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-10-07 19:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm at polyomino dot org dot uk 2004-10-07 19:44 -------
Subject: Re: New: Incomplete type warning is issued even for
prototypes
On Thu, 7 Oct 2004, jakub at gcc dot gnu dot org wrote:
> struct S;
> struct foo { void (*bar) (struct S); };
> void baz (struct S);
>
> struct S { int i; };
>
> void baz (struct S s)
> {
> (void) s.i;
> }
>
> warns about the incomplete type in prototype and function pointer, although
> the size of the object is not needed in those cases.
Although this is certainly a deliberate warning - and a warning, not a
pedwarn - the comment justifying it
/* If the arg types are incomplete in a declaration, they must
include undefined tags. These tags can never be defined in
the scope of the declaration, so the types can never be
completed, and no call can be compiled successfully. */
is entirely wrong. The case of tags defined at function prototype scope
already gets its own warning. Probably the only case for which this
separate warning is appropriate is for parameters declared with void type
(where a function with such parameter types can never be defined, only
declared).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17881
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/17881] Incomplete type warning is issued even for prototypes
2004-10-07 12:52 [Bug c/17881] New: Incomplete type warning is issued even for prototypes jakub at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-10-07 19:44 ` jsm at polyomino dot org dot uk
@ 2004-10-10 19:20 ` cvs-commit at gcc dot gnu dot org
2004-10-10 19:24 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-10 19:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-10-10 19:20 -------
Subject: Bug 17881
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: jsm28@gcc.gnu.org 2004-10-10 19:20:35
Modified files:
gcc : ChangeLog c-decl.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.dg: parm-incomplete-1.c
Log message:
PR c/17881
* c-decl.c (grokparms): Don't warn for parameters of incomplete
type in declarations that are not definitions except for the case
of parameters of void type.
testsuite:
* parm-incomplete-1.c: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5826&r2=2.5827
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.598&r2=1.599
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4428&r2=1.4429
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/parm-incomplete-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17881
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/17881] Incomplete type warning is issued even for prototypes
2004-10-07 12:52 [Bug c/17881] New: Incomplete type warning is issued even for prototypes jakub at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-10-10 19:20 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-10 19:24 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-10 19:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-10 19:24 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17881
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-10-10 19:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-07 12:52 [Bug c/17881] New: Incomplete type warning is issued even for prototypes jakub at gcc dot gnu dot org
2004-10-07 13:18 ` [Bug c++/17881] " bangerth at dealii dot org
2004-10-07 13:22 ` [Bug c/17881] " pinskia at gcc dot gnu dot org
2004-10-07 16:29 ` pinskia at gcc dot gnu dot org
2004-10-07 19:44 ` jsm at polyomino dot org dot uk
2004-10-10 19:20 ` cvs-commit at gcc dot gnu dot org
2004-10-10 19:24 ` pinskia 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).