public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable
@ 2004-08-24 22:31 pinskia at gcc dot gnu dot org
  2004-08-24 22:31 ` [Bug c/17178] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 22:31 UTC (permalink / raw)
  To: gcc-bugs

static const int kUnloadAndDeleteClient = 'N';
gcc -Wunused-variable -Werror t.c
t:1: warning: unused variable `kUnloadAndDeleteClient'

-- 
           Summary: [3.5 Regression] static consts and -Wunused-variable
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: zack at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
@ 2004-08-24 22:31 ` pinskia at gcc dot gnu dot org
  2004-08-24 22:32 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 22:31 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-24 22:31:56
               date|                            |
   Target Milestone|---                         |3.5.0


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
  2004-08-24 22:31 ` [Bug c/17178] " pinskia at gcc dot gnu dot org
@ 2004-08-24 22:32 ` pinskia at gcc dot gnu dot org
  2004-08-24 22:48 ` bangerth at dealii dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 22:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-24 22:32 -------
Casued by:
        PR 12267, 12391, 12560, 13129, 14114, 14113

        * c-tree.h: Forward declare struct c_binding.  Declare
        c_override_bindings_to_false.  Update prototypes.
        ....

-- 


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
  2004-08-24 22:31 ` [Bug c/17178] " pinskia at gcc dot gnu dot org
  2004-08-24 22:32 ` pinskia at gcc dot gnu dot org
@ 2004-08-24 22:48 ` bangerth at dealii dot org
  2004-08-24 22:57 ` zack at codesourcery dot com
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-08-24 22:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-08-24 22:48 -------
Andrew, is your testcase the following single one line? 
--------------------------- 
static const int kUnloadAndDeleteClient = 'N'; 
--------------------------- 
What is wrong with gcc giving a warning about this when you ask for it? Or what 
exactly is the problem you are thinking of? 
 
W. 

-- 


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-08-24 22:48 ` bangerth at dealii dot org
@ 2004-08-24 22:57 ` zack at codesourcery dot com
  2004-08-24 23:30 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: zack at codesourcery dot com @ 2004-08-24 22:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at codesourcery dot com  2004-08-24 22:57 -------
Subject: Re:  New: [3.5 Regression] static consts and -Wunused-variable


This was changed on purpose; please justify changing it back.

zw


-- 


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-08-24 22:57 ` zack at codesourcery dot com
@ 2004-08-24 23:30 ` pinskia at gcc dot gnu dot org
  2004-08-24 23:32 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 23:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-24 23:30 -------
Well look into PR13029, I don't see any justification for changing it in the first place.
<http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01958.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |13029


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-08-24 23:30 ` pinskia at gcc dot gnu dot org
@ 2004-08-24 23:32 ` pinskia at gcc dot gnu dot org
  2004-08-24 23:44 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 23:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-24 23:32 -------
The other thing to look into is the patch from Mark which fixed it for 3.3 and 3.4.0:
<http://gcc.gnu.org/ml/gcc-patches/2003-05/msg00468.html>

So why are you asking me for justification when I don't see any for yours.

-- 


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-08-24 23:32 ` pinskia at gcc dot gnu dot org
@ 2004-08-24 23:44 ` pinskia at gcc dot gnu dot org
  2004-08-24 23:51 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 23:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-24 23:44 -------
Again also look into what Joe Buck posted which says why we should not warn here:
<http://gcc.gnu.org/ml/gcc/2003-05/msg00172.html>.

This should be the justificiation I need.

-- 


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-08-24 23:44 ` pinskia at gcc dot gnu dot org
@ 2004-08-24 23:51 ` pinskia at gcc dot gnu dot org
  2004-08-24 23:53 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 23:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-24 23:51 -------
Warn whenever a local variable or non-constant static variable is unused aside from its declaration

Note the "non-constant static".

Again if this is on purpose as you said it was, why did you not change the documenation then?

-- 


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-08-24 23:51 ` pinskia at gcc dot gnu dot org
@ 2004-08-24 23:53 ` pinskia at gcc dot gnu dot org
  2004-08-25  0:01 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-24 23:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-24 23:53 -------
Mark, could you settle  this one as Zack said he did it deliberately but did not change the 
documentation because:
[16:32] < pinskia> zwol: http://gcc.gnu.org/ml/gcc-patches/2003-05/msg00468.html
[16:44] * stevenb (~steven@70-90.ipact.nl) has left the channel
[16:45] < zwol> pinskia: you might deduce from my response that i think that change was wrong.
[16:45] < pinskia> well it is still a regression which needs to be fixed.
[16:46] < pinskia> I should note that Mac OS X has a huge number of these static const variables in the 
headers is we are going to warn about them
[16:47] < zwol> static const char*, sure, i can see the rcsid[] argument.  but static const int, that's 
different, that's someone expecting C++ const semantics, and it's very likely their program is not doing 
what they thought it was.
[16:47] < zwol> Mac OS X headers should be fixed then.
[16:48] < zwol> no, i have no sympathy.
[16:48] < zwol> why do you ask?
[16:49] < pinskia> I don't care it is a regression and that is all I am going to say
[16:50] < pinskia> Should I quote the manual  which you did not change when you committed the 
change?
[16:50] < pinskia> Warn whenever a local variable or non-constant static variable is unused aside from 
its declaration
[16:50] < pinskia> "non-constant static"
[16:50] * gadek (~gadek@209.29.internet.uqam.ca) has joined
[16:51] < zwol> I do not consider the manual to be Free and therefore (while I will fix obvious 
problems that are pointed out to me) I will not look through it for problems when I make changes.
[16:51] < zwol> and, my response to "it is a regression" is "no, it is a deliberate change, justify why it 
should be changed back."
[16:51] < zwol> and if you don't care to justify it, then i don't care.
[16:52] < pinskia> but you did not justify why it was changed in the first place which means it was not 
a deliberate change 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c/17178] [3.5 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-08-24 23:53 ` pinskia at gcc dot gnu dot org
@ 2004-08-25  0:01 ` mmitchel at gcc dot gnu dot org
  2004-10-03 23:03 ` [Bug c/17178] [4.0 " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-25  0:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-25 00:01 -------
I'm not sure I can "settle this"; my voice is no stronger than any other
maintainer on non-release issues.

My feeling is that we should indeed not warn on this case; that's why I made the
change you reference.  I see the logic in Zack's argument that we should target
rcs_id more specifically by using "const char *" -- but I think that given the
previous controversy, we should make changes here only with substantial
consensus.  So, I think that the behavior should be changed back to not warn on
this case. Then, if Zack feels strongly (and is willing to fight the battle) he
could reopen this debate on the mailing lists.  If that doesn't happen, for some
reason, I agree that we should change the manual to reflect the new reality.

Just my two cents, though.

-- 


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


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

* [Bug c/17178] [4.0 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2004-08-25  0:01 ` mmitchel at gcc dot gnu dot org
@ 2004-10-03 23:03 ` pinskia at gcc dot gnu dot org
  2004-10-03 23:19 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-03 23:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-03 23:03 -------
I have a fix, the same patch which fixes PR 17820 also fixes this one, it looks like it was a mistake in 
the patch which broke this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|zack at gcc dot gnu dot org |pinskia at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c/17178] [4.0 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2004-10-03 23:03 ` [Bug c/17178] [4.0 " pinskia at gcc dot gnu dot org
@ 2004-10-03 23:19 ` pinskia at gcc dot gnu dot org
  2004-10-04  0:10 ` pinskia at gcc dot gnu dot org
  2004-10-04  0:10 ` cvs-commit at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-03 23:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-03 23:19 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00217.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug c/17178] [4.0 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2004-10-03 23:19 ` pinskia at gcc dot gnu dot org
@ 2004-10-04  0:10 ` pinskia at gcc dot gnu dot org
  2004-10-04  0:10 ` cvs-commit at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-04  0:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-04 00:10 -------
Fixed.

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


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


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

* [Bug c/17178] [4.0 Regression] static consts and -Wunused-variable
  2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2004-10-04  0:10 ` pinskia at gcc dot gnu dot org
@ 2004-10-04  0:10 ` cvs-commit at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-04  0:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-04 00:10 -------
Subject: Bug 17178

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2004-10-04 00:10:11

Modified files:
	gcc/testsuite/gcc.dg: unused-4.c 
	gcc/testsuite  : ChangeLog 
	gcc            : ChangeLog c-decl.c 
Added files:
	gcc/testsuite/gcc.dg: unused-7.c 

Log message:
	2004-10-03  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR c/17178, PR c/17820
	* c-decl.c (pop_scope): Do not warn about unused static
	variables as they warned in the middle-end.
	
	2004-10-03  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR c/17178
	* gcc.dg/unused-4.c: Adjust to be correct.
	
	PR c/17820
	* gcc.dg/unused-7.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/unused-7.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/unused-4.c.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4376&r2=1.4377
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5735&r2=2.5736
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.594&r2=1.595



-- 


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


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

end of thread, other threads:[~2004-10-04  0:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-24 22:31 [Bug c/17178] New: [3.5 Regression] static consts and -Wunused-variable pinskia at gcc dot gnu dot org
2004-08-24 22:31 ` [Bug c/17178] " pinskia at gcc dot gnu dot org
2004-08-24 22:32 ` pinskia at gcc dot gnu dot org
2004-08-24 22:48 ` bangerth at dealii dot org
2004-08-24 22:57 ` zack at codesourcery dot com
2004-08-24 23:30 ` pinskia at gcc dot gnu dot org
2004-08-24 23:32 ` pinskia at gcc dot gnu dot org
2004-08-24 23:44 ` pinskia at gcc dot gnu dot org
2004-08-24 23:51 ` pinskia at gcc dot gnu dot org
2004-08-24 23:53 ` pinskia at gcc dot gnu dot org
2004-08-25  0:01 ` mmitchel at gcc dot gnu dot org
2004-10-03 23:03 ` [Bug c/17178] [4.0 " pinskia at gcc dot gnu dot org
2004-10-03 23:19 ` pinskia at gcc dot gnu dot org
2004-10-04  0:10 ` pinskia at gcc dot gnu dot org
2004-10-04  0:10 ` cvs-commit 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).