public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/30551]  New: -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages
@ 2007-01-23  0:22 truedfx at gentoo dot org
  2007-10-29 20:35 ` [Bug c/30551] " manu at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: truedfx at gentoo dot org @ 2007-01-23  0:22 UTC (permalink / raw)
  To: gcc-bugs

Noticed while doing a test for bug #26494:

int main(char a) {}

gcc bug.c -ansi -pedantic
compiles this without any error or warning.

gcc bug.c -ansi -pedantic -Wmain
reports
bug.c:1: warning: first argument of ‘main’ should be
‘int’
bug.c:1: warning: ‘main’ takes only zero or two arguments
and compiles this.

gcc bug.c -ansi -pedantic-errors
compiles this without any error or warning.

gcc bug.c -ansi -pedantic-errors -Wmain
reports
bug.c:1: error: first argument of ‘main’ should be
‘int’
bug.c:1: error: ‘main’ takes only zero or two arguments
and does not compile this.

gcc --version:
gcc (GCC) 4.1.1 (Gentoo 4.1.1-r3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


-- 
           Summary: -pedantic does not include -Wmain, but -pedantic-errors
                    does make -Wmain cause error messages
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: truedfx at gentoo dot org


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


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

* [Bug c/30551] -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages
  2007-01-23  0:22 [Bug c/30551] New: -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages truedfx at gentoo dot org
@ 2007-10-29 20:35 ` manu at gcc dot gnu dot org
  2007-11-03 14:23 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-10-29 20:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from manu at gcc dot gnu dot org  2007-10-29 20:35 -------
Wmain is using pedwarn when it should use warning (OPT_Wmain,""). It is also an
error by default (unless -fpermissive) in C++ while it is not even enabled in
C.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-10-29 20:35:08
               date|                            |


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


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

* [Bug c/30551] -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages
  2007-01-23  0:22 [Bug c/30551] New: -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages truedfx at gentoo dot org
  2007-10-29 20:35 ` [Bug c/30551] " manu at gcc dot gnu dot org
@ 2007-11-03 14:23 ` manu at gcc dot gnu dot org
  2008-08-13 18:00 ` manu at gcc dot gnu dot org
  2008-08-13 18:14 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-11-03 14:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2007-11-03 14:22 -------
Working in a patch.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |manu at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-10-29 20:35:08         |2007-11-03 14:22:56
               date|                            |


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


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

* [Bug c/30551] -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages
  2007-01-23  0:22 [Bug c/30551] New: -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages truedfx at gentoo dot org
  2007-10-29 20:35 ` [Bug c/30551] " manu at gcc dot gnu dot org
  2007-11-03 14:23 ` manu at gcc dot gnu dot org
@ 2008-08-13 18:00 ` manu at gcc dot gnu dot org
  2008-08-13 18:14 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-13 18:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2008-08-13 17:59 -------
Subject: Bug 30551

Author: manu
Date: Wed Aug 13 17:57:47 2008
New Revision: 139063

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139063
Log:
2008-08-13  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR 30551
        * doc/invoke.texi (Wmain): Update.
        * c-decl.c (start_decl): warn_main is only 0 or 1.
        (start_function): Likewise. Fix formatting.
        (finish_function): Delete redundant warning.
        * c.opt (Wmain): Add Var(warn_main) and Init(-1).
        * c-opts (c_common_handle_option): -Wall only has effect if
        warn_main is uninitialized. OPT_Wmain is automatically
        handled. -pedantic also enables Wmain.
        (c_common_post_options): Handle all logic for Wmain here.
        * c-common.c (warn_main): Delete.
        (check_main_parameter_types): Make pedwarns conditional on
        OPT_Wmain.
        * c-common.h (warn_main): Delete.
cp/     
        * decl.c (grokfndecl): Call check_main_parameters_type only if
        -Wmain.
testsuite/
        * gcc.dg/pr30551.c: New.
        * gcc.dg/pr30551-2.c: New.
        * gcc.dg/pr30551-3.c: New.
        * gcc.dg/pr30551-4.c: New.
        * gcc.dg/pr30551-5.c: New.
        * gcc.dg/pr30551-6.c: New.
        * gcc.dg/tree-ssa/reassoc-3.c: Don't compile with -pedantic-errors.
        * g++.dg/warn/pr30551.C: New.
        * g++.dg/warn/pr30551-2.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/warn/pr30551-2.C
    trunk/gcc/testsuite/g++.dg/warn/pr30551.C
    trunk/gcc/testsuite/gcc.dg/pr30551-2.c
    trunk/gcc/testsuite/gcc.dg/pr30551-3.c
    trunk/gcc/testsuite/gcc.dg/pr30551-4.c
    trunk/gcc/testsuite/gcc.dg/pr30551-5.c
    trunk/gcc/testsuite/gcc.dg/pr30551-6.c
    trunk/gcc/testsuite/gcc.dg/pr30551.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-common.h
    trunk/gcc/c-decl.c
    trunk/gcc/c-opts.c
    trunk/gcc/c.opt
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-3.c


-- 


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


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

* [Bug c/30551] -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages
  2007-01-23  0:22 [Bug c/30551] New: -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages truedfx at gentoo dot org
                   ` (2 preceding siblings ...)
  2008-08-13 18:00 ` manu at gcc dot gnu dot org
@ 2008-08-13 18:14 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-13 18:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2008-08-13 18:13 -------
FIXED in GCC 4.4


-- 

manu at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-08-13 18:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-23  0:22 [Bug c/30551] New: -pedantic does not include -Wmain, but -pedantic-errors does make -Wmain cause error messages truedfx at gentoo dot org
2007-10-29 20:35 ` [Bug c/30551] " manu at gcc dot gnu dot org
2007-11-03 14:23 ` manu at gcc dot gnu dot org
2008-08-13 18:00 ` manu at gcc dot gnu dot org
2008-08-13 18:14 ` manu 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).