public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17096] New: gcc-3.4.1 allows statements before declarations
@ 2004-08-19  8:38 metze at samba dot org
  2004-08-19  8:47 ` [Bug c/17096] " falk at debian dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: metze at samba dot org @ 2004-08-19  8:38 UTC (permalink / raw)
  To: gcc-bugs

gcc 3.4.1 (gcc 3.3.3 also) allows statements before declarations:

{
   int i1;

   printf("bla");

   int i2;
}

even if I use -ansi (and -Wall -Wshadow -Werror-implicit-function-declaration
-Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings)

I got no warning

gcc 2.95.3 and other c compilers
fail to compile that code

-- 
           Summary: gcc-3.4.1 allows statements before declarations
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: metze at samba dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/17096] gcc-3.4.1 allows statements before declarations
  2004-08-19  8:38 [Bug c/17096] New: gcc-3.4.1 allows statements before declarations metze at samba dot org
@ 2004-08-19  8:47 ` falk at debian dot org
  2004-08-19  8:51 ` jsm at polyomino dot org dot uk
  2004-08-19  9:25 ` metze at samba dot org
  2 siblings, 0 replies; 4+ messages in thread
From: falk at debian dot org @ 2004-08-19  8:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk at debian dot org  2004-08-19 08:47 -------
>From the manual:

           The -ansi option does not cause non-ISO programs to be rejected
           gratuitously.  For that, -pedantic is required in addition to
           -ansi.

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


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


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

* [Bug c/17096] gcc-3.4.1 allows statements before declarations
  2004-08-19  8:38 [Bug c/17096] New: gcc-3.4.1 allows statements before declarations metze at samba dot org
  2004-08-19  8:47 ` [Bug c/17096] " falk at debian dot org
@ 2004-08-19  8:51 ` jsm at polyomino dot org dot uk
  2004-08-19  9:25 ` metze at samba dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-08-19  8:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm at polyomino dot org dot uk  2004-08-19 08:51 -------
Subject: Re:  New: gcc-3.4.1 allows statements before declarations

On Thu, 19 Aug 2004, metze at samba dot org wrote:

> even if I use -ansi (and -Wall -Wshadow -Werror-implicit-function-declaration
> -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings)

So use -pedantic or -Wdeclaration-after-statement.

We are always interested in improving the quality of the manual.  Could 
you let us know how the manual might be improved so that you would have 
noticed the "Mixed Declarations" section documenting this extension, and 
the documentation of -Wdeclaration-after-statement, before making this bug 
report?



-- 


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


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

* [Bug c/17096] gcc-3.4.1 allows statements before declarations
  2004-08-19  8:38 [Bug c/17096] New: gcc-3.4.1 allows statements before declarations metze at samba dot org
  2004-08-19  8:47 ` [Bug c/17096] " falk at debian dot org
  2004-08-19  8:51 ` jsm at polyomino dot org dot uk
@ 2004-08-19  9:25 ` metze at samba dot org
  2 siblings, 0 replies; 4+ messages in thread
From: metze at samba dot org @ 2004-08-19  9:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From metze at samba dot org  2004-08-19 09:24 -------
Ok, thanks -Wdeclaration-after-statement works
but a -Werror-declaration-after-statement would also be nice



-- 


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


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

end of thread, other threads:[~2004-08-19  9:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-19  8:38 [Bug c/17096] New: gcc-3.4.1 allows statements before declarations metze at samba dot org
2004-08-19  8:47 ` [Bug c/17096] " falk at debian dot org
2004-08-19  8:51 ` jsm at polyomino dot org dot uk
2004-08-19  9:25 ` metze at samba 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).