public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
       [not found] <bug-13029-4@http.gcc.gnu.org/bugzilla/>
@ 2014-02-17  8:10 ` chengniansun at gmail dot com
  2014-02-17  8:18 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: chengniansun at gmail dot com @ 2014-02-17  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

Chengnian Sun <chengniansun at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chengniansun at gmail dot com

--- Comment #4 from Chengnian Sun <chengniansun at gmail dot com> ---
May I ask what is the design rational of not warning unused static const
variables?  

I saw Clang has a different strategy, and it even has a type of warning --
[-Wunused-const-variable]


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

* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
       [not found] <bug-13029-4@http.gcc.gnu.org/bugzilla/>
  2014-02-17  8:10 ` [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable chengniansun at gmail dot com
@ 2014-02-17  8:18 ` jakub at gcc dot gnu.org
  2014-02-17  8:41 ` mikpelinux at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-17  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, clang strategy seems to be not to bother with false positives and always
prefer warning over not warning on anything, so usually the clang output is
just completely unreadable because among the tons of false positives it is hard
to find actual real code problems.  GCC strategy is to find some ballance
between false positive warnings and missed warnings.


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

* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
       [not found] <bug-13029-4@http.gcc.gnu.org/bugzilla/>
  2014-02-17  8:10 ` [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable chengniansun at gmail dot com
  2014-02-17  8:18 ` jakub at gcc dot gnu.org
@ 2014-02-17  8:41 ` mikpelinux at gmail dot com
  2014-02-17  9:07 ` chengniansun at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: mikpelinux at gmail dot com @ 2014-02-17  8:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Mikael Pettersson <mikpelinux at gmail dot com> ---
(In reply to Chengnian Sun from comment #4)
> May I ask what is the design rational of not warning unused static const
> variables?  

See PR28901.  There are cases of unused static const where the warning isn't
wanted, and so far the decision has been to favour those over the cases where
the warning _is_ wanted and would have detected real bugs.  Sigh.


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

* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
       [not found] <bug-13029-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-02-17  8:41 ` mikpelinux at gmail dot com
@ 2014-02-17  9:07 ` chengniansun at gmail dot com
  2014-02-17  9:12 ` jakub at gcc dot gnu.org
  2014-02-17 21:14 ` tromey at gcc dot gnu.org
  5 siblings, 0 replies; 9+ messages in thread
From: chengniansun at gmail dot com @ 2014-02-17  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Chengnian Sun <chengniansun at gmail dot com> ---
Thanks, Jakub and Mikael. 

I see it now. IMHO, it might be worthy to add a flag -Wunused-const-variable
similar to Clang, which is not included either -Wall or -Wextra. Therefore the
end user can decide whether to enable this warning based on their specific
scenario. I think it is better than the current case that people who need this
warning support cannot get it.


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

* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
       [not found] <bug-13029-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-02-17  9:07 ` chengniansun at gmail dot com
@ 2014-02-17  9:12 ` jakub at gcc dot gnu.org
  2014-02-17 21:14 ` tromey at gcc dot gnu.org
  5 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-17  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Chengnian Sun from comment #7)
> Thanks, Jakub and Mikael. 
> 
> I see it now. IMHO, it might be worthy to add a flag -Wunused-const-variable
> similar to Clang, which is not included either -Wall or -Wextra. Therefore
> the end user can decide whether to enable this warning based on their
> specific scenario. I think it is better than the current case that people
> who need this warning support cannot get it.

Yeah, I guess that is a possibility.


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

* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
       [not found] <bug-13029-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-02-17  9:12 ` jakub at gcc dot gnu.org
@ 2014-02-17 21:14 ` tromey at gcc dot gnu.org
  5 siblings, 0 replies; 9+ messages in thread
From: tromey at gcc dot gnu.org @ 2014-02-17 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

Tom Tromey <tromey at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu.org

--- Comment #9 from Tom Tromey <tromey at gcc dot gnu.org> ---
I think my recent comments here apply:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28901#c5
Please consider reopening this PR.


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

* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
  2003-11-12 21:58 [Bug c/13029] New: " mrs at apple dot com
  2003-11-12 22:10 ` [Bug c/13029] [3.4 Regression] " pinskia at gcc dot gnu dot org
  2003-11-13 19:40 ` cvs-commit at gcc dot gnu dot org
@ 2003-11-13 19:42 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-11-13 19:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2003-11-13 19:42 -------
Fixed in GCC 3.4.

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


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


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

* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
  2003-11-12 21:58 [Bug c/13029] New: " mrs at apple dot com
  2003-11-12 22:10 ` [Bug c/13029] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2003-11-13 19:40 ` cvs-commit at gcc dot gnu dot org
  2003-11-13 19:42 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-11-13 19:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-11-13 19:40 -------
Subject: Bug 13029

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-11-13 19:40:20

Modified files:
	gcc            : ChangeLog toplev.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gcc.dg: unused-4.c 

Log message:
	PR c/13029
	* toplev.c (check_global_declarations): Do not warn about unused
	static consts.
	
	PR c/13029
	* gcc.dg/unused-4.c: Update.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1735&r2=2.1736
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff?cvsroot=gcc&r1=1.843&r2=1.844
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3189&r2=1.3190
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/unused-4.c.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


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


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

* [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable
  2003-11-12 21:58 [Bug c/13029] New: " mrs at apple dot com
@ 2003-11-12 22:10 ` pinskia at gcc dot gnu dot org
  2003-11-13 19:40 ` cvs-commit at gcc dot gnu dot org
  2003-11-13 19:42 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-12 22:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-12 22:10 -------
Confirmed.

Broken on the mainline: Search converges between 2002-03-31-trunk (#71) and 2002-04-07-
trunk (#72).

Fixed in the 3.3 branch: Search converges between 2003-05-05-3.3 (#119) and 2003-05-06-3.3 
(#120).
Not fixed again on the mainline.

This patch was not applied to the mainline which fixes it: <http://gcc.gnu.org/ml/gcc-patches/
2003-05/msg00468.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic, patch
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-12 22:10:12
               date|                            |
            Summary|static consts and -Wunused- |[3.4 Regression] static
                   |variable                    |consts and -Wunused-variable
   Target Milestone|---                         |3.4


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


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

end of thread, other threads:[~2014-02-17 21:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-13029-4@http.gcc.gnu.org/bugzilla/>
2014-02-17  8:10 ` [Bug c/13029] [3.4 Regression] static consts and -Wunused-variable chengniansun at gmail dot com
2014-02-17  8:18 ` jakub at gcc dot gnu.org
2014-02-17  8:41 ` mikpelinux at gmail dot com
2014-02-17  9:07 ` chengniansun at gmail dot com
2014-02-17  9:12 ` jakub at gcc dot gnu.org
2014-02-17 21:14 ` tromey at gcc dot gnu.org
2003-11-12 21:58 [Bug c/13029] New: " mrs at apple dot com
2003-11-12 22:10 ` [Bug c/13029] [3.4 Regression] " pinskia at gcc dot gnu dot org
2003-11-13 19:40 ` cvs-commit at gcc dot gnu dot org
2003-11-13 19:42 ` mmitchel 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).