public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13482] New: -Wall -W and -Wunused do not behave as documented
@ 2003-12-23 22:44 boris at kolpackov dot net
  2003-12-24 18:30 ` [Bug c++/13482] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: boris at kolpackov dot net @ 2003-12-23 22:44 UTC (permalink / raw)
  To: gcc-bugs

$ cat >test.cpp
void bar ();

void foo (int const& a)
{
  try
  {
    bar ();
  }
  catch (int const& e)
  {
    bar ();
  }
}

$ g++ --version
g++ (GCC) 3.3 (Debian)

$ g++ -c ./test.cpp
$ g++ -Wunused -c ./test.cpp
$ # would expect two warnings here
$ g++ -Wall -c ./test.cpp
$ # would expect two warnings here
$ g++ -W -Wunused -c ./test.cpp
test.cpp: In function `void foo(const int&)':
test.cpp:4: warning: unused parameter `const int&a'
$ # doc never said I should use -W to make -Wunused work
$ # only one warning
$ # also note how ugly `const int&a' looks
$ g++ -W -Wall -c ./test.cpp
test.cpp: In function `void foo(const int&)':
test.cpp:4: warning: unused parameter `const int&a'
$ # again only one warning

-- 
           Summary: -Wall -W and -Wunused do not behave as documented
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: boris at kolpackov dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-gnu-linux
  GCC host triplet: i386-gnu-linux
GCC target triplet: i386-gnu-linux


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


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

* [Bug c++/13482] -Wall -W and -Wunused do not behave as documented
  2003-12-23 22:44 [Bug c++/13482] New: -Wall -W and -Wunused do not behave as documented boris at kolpackov dot net
  2003-12-24 18:30 ` [Bug c++/13482] " pinskia at gcc dot gnu dot org
@ 2003-12-24 18:30 ` pinskia at gcc dot gnu dot org
  2003-12-24 21:12 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-24 18:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-24 18:17 -------
Also note that warning message has been fixed for the format on the mainline:
pr13482.cc:4: warning: unused parameter 'a'

-- 


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


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

* [Bug c++/13482] -Wall -W and -Wunused do not behave as documented
  2003-12-23 22:44 [Bug c++/13482] New: -Wall -W and -Wunused do not behave as documented boris at kolpackov dot net
@ 2003-12-24 18:30 ` pinskia at gcc dot gnu dot org
  2003-12-24 18:30 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-24 18:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-24 18:16 -------
Confirmed.
For some reason -Wunused is not turning on -Wunused-parameter, if I use -Wunused-parameter, 
GCC will warn about it.
Also exceptions variables are used always so GCC does not know that they are unused by the user.

This is not a regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-24 18:16:57
               date|                            |


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


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

* [Bug c++/13482] -Wall -W and -Wunused do not behave as documented
  2003-12-23 22:44 [Bug c++/13482] New: -Wall -W and -Wunused do not behave as documented boris at kolpackov dot net
  2003-12-24 18:30 ` [Bug c++/13482] " pinskia at gcc dot gnu dot org
  2003-12-24 18:30 ` pinskia at gcc dot gnu dot org
@ 2003-12-24 21:12 ` pinskia at gcc dot gnu dot org
  2003-12-24 21:13 ` pinskia at gcc dot gnu dot org
  2003-12-24 21:38 ` boris at kolpackov dot net
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-24 21:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-24 21:05 -------
This is expected behavior so it is a documenation problem:
  /* Unused function parameter warnings are reported when either
     ``-Wextra -Wunused'' or ``-Wunused-parameter'' is specified.
     Thus, if -Wextra has already been seen, set warn_unused_parameter;
     otherwise set maybe_warn_extra_parameter, which will be picked up
     by set_Wextra.  */
  maybe_warn_unused_parameter = setting;
  warn_unused_parameter = (setting && extra_warnings);

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|diagnostic                  |documentation


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


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

* [Bug c++/13482] -Wall -W and -Wunused do not behave as documented
  2003-12-23 22:44 [Bug c++/13482] New: -Wall -W and -Wunused do not behave as documented boris at kolpackov dot net
                   ` (2 preceding siblings ...)
  2003-12-24 21:12 ` pinskia at gcc dot gnu dot org
@ 2003-12-24 21:13 ` pinskia at gcc dot gnu dot org
  2003-12-24 21:38 ` boris at kolpackov dot net
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-24 21:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-24 21:09 -------
The documenation says:
In order to get a warning about an unused function parameter, you must
either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
So it is right.

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


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


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

* [Bug c++/13482] -Wall -W and -Wunused do not behave as documented
  2003-12-23 22:44 [Bug c++/13482] New: -Wall -W and -Wunused do not behave as documented boris at kolpackov dot net
                   ` (3 preceding siblings ...)
  2003-12-24 21:13 ` pinskia at gcc dot gnu dot org
@ 2003-12-24 21:38 ` boris at kolpackov dot net
  4 siblings, 0 replies; 6+ messages in thread
From: boris at kolpackov dot net @ 2003-12-24 21:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From boris at kolpackov dot net  2003-12-24 21:31 -------
Subject: Re:  -Wall -W and -Wunused do not behave as documented

> Also exceptions variables are used always so GCC does not know that they 
> are unused by the user.

This doesn't make sense to me. Can you elaborate a little bit?


-- 


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


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

end of thread, other threads:[~2003-12-24 21:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-23 22:44 [Bug c++/13482] New: -Wall -W and -Wunused do not behave as documented boris at kolpackov dot net
2003-12-24 18:30 ` [Bug c++/13482] " pinskia at gcc dot gnu dot org
2003-12-24 18:30 ` pinskia at gcc dot gnu dot org
2003-12-24 21:12 ` pinskia at gcc dot gnu dot org
2003-12-24 21:13 ` pinskia at gcc dot gnu dot org
2003-12-24 21:38 ` boris at kolpackov dot net

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