public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24068] New: Unconditional warning when using -fwhole-program
@ 2005-09-26 19:24 dann at godzilla dot ics dot uci dot edu
  2005-09-26 19:25 ` [Bug c/24068] " dann at godzilla dot ics dot uci dot edu
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2005-09-26 19:24 UTC (permalink / raw)
  To: gcc-bugs

When trying to compile the attached preprocessed files using
gcc -c -fwhole-program --combine xterm.i xlwmenu.i

These warnings are produced unconditionally:

/home/dann/build/Emacs-CVS/emacs/lwlib/xlwmenu.c:57: warning: prototype for
'x_alloc_nearest_color_for_widget' follows non-prototype definition
/home/dann/build/Emacs-CVS/emacs/lwlib/xlwmenu.c:58: warning: prototype for
'x_alloc_lighter_color_for_widget' follows non-prototype definition
/home/dann/build/Emacs-CVS/emacs/lwlib/xlwmenu.c:64: warning: prototype for
'x_clear_errors' follows non-prototype definition
/home/dann/build/Emacs-CVS/emacs/lwlib/xlwmenu.c:65: warning: prototype for
'x_copy_dpy_color' follows non-prototype definition

AFAICT the warnings don't make much sense. The code is correct. The functions in
questions are defined in one file and then prototyped and used in the other
file. This kind of stuff appears in countless C programs. 
Can this warning be turned off by default?

-- 
           Summary: Unconditional warning when using -fwhole-program
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c/24068] Unconditional warning when using -fwhole-program
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
@ 2005-09-26 19:25 ` dann at godzilla dot ics dot uci dot edu
  2005-09-26 19:25 ` dann at godzilla dot ics dot uci dot edu
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2005-09-26 19:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2005-09-26 19:25 -------
Created an attachment (id=9808)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9808&action=view)
xlwmenu.i


-- 


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


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

* [Bug c/24068] Unconditional warning when using -fwhole-program
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
  2005-09-26 19:25 ` [Bug c/24068] " dann at godzilla dot ics dot uci dot edu
@ 2005-09-26 19:25 ` dann at godzilla dot ics dot uci dot edu
  2005-09-26 19:29 ` [Bug c/24068] Unconditional warning when using -combine pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2005-09-26 19:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2005-09-26 19:25 -------
Created an attachment (id=9807)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9807&action=view)
xterm.i


-- 


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
  2005-09-26 19:25 ` [Bug c/24068] " dann at godzilla dot ics dot uci dot edu
  2005-09-26 19:25 ` dann at godzilla dot ics dot uci dot edu
@ 2005-09-26 19:29 ` pinskia at gcc dot gnu dot org
  2005-09-26 19:31 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-26 19:29 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Unconditional warning when  |Unconditional warning when
                   |using -fwhole-program       |using -combine


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
                   ` (2 preceding siblings ...)
  2005-09-26 19:29 ` [Bug c/24068] Unconditional warning when using -combine pinskia at gcc dot gnu dot org
@ 2005-09-26 19:31 ` pinskia at gcc dot gnu dot org
  2005-09-26 19:41 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-26 19:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-26 19:31 -------
Actually this is where C standard is werid really.

-- 


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
                   ` (3 preceding siblings ...)
  2005-09-26 19:31 ` pinskia at gcc dot gnu dot org
@ 2005-09-26 19:41 ` pinskia at gcc dot gnu dot org
  2005-09-26 19:47 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-26 19:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-26 19:41 -------
Because one file uses K&R style function defintions and the other uses a prototype which is ANSI/ISO 
style.

Simple example:
file1.c:
int f(int);
---
file2.c:
int f(a)
int a;
{
  return a;
}
---
Compile it as:
gcc file2.c file1.c -combine


So this about the following:
int f(a)
int a;
{
  return a;
}
int f(int);

Which is questionable.

So I don't think this is not an inappropriate warning.


--------------------------------------------
As an aside, I wish people would stop using K&R style C already.

-- 


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
                   ` (4 preceding siblings ...)
  2005-09-26 19:41 ` pinskia at gcc dot gnu dot org
@ 2005-09-26 19:47 ` pinskia at gcc dot gnu dot org
  2005-09-26 19:54 ` dann at godzilla dot ics dot uci dot edu
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-26 19:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-26 19:46 -------
I really want to say this is a bug in their code as
x_alloc_nearest_color_for_widget's prototype is in the source file which is bad form really.

-- 


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
                   ` (5 preceding siblings ...)
  2005-09-26 19:47 ` pinskia at gcc dot gnu dot org
@ 2005-09-26 19:54 ` dann at godzilla dot ics dot uci dot edu
  2005-09-26 19:59 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2005-09-26 19:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2005-09-26 19:54 -------
(In reply to comment #4)
> Because one file uses K&R style function defintions and the other uses a
prototype which is ANSI/ISO 
> style.
> Simple example:
[snip]
> So I don't think this is not an inappropriate warning.

The question is: can this EVER result in incorrect behavior? 
Is it incorrect from the standard point of view? 

If the answer to the above is no, then there no reason to warn.

> --------------------------------------------
> As an aside, I wish people would stop using K&R style C already.

Aggreed.


-- 


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
                   ` (6 preceding siblings ...)
  2005-09-26 19:54 ` dann at godzilla dot ics dot uci dot edu
@ 2005-09-26 19:59 ` pinskia at gcc dot gnu dot org
  2005-09-26 20:46 ` dann at godzilla dot ics dot uci dot edu
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-26 19:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-26 19:59 -------
This is not a regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
      Known to fail|                            |3.4.0 4.0.0 4.1.0


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
                   ` (7 preceding siblings ...)
  2005-09-26 19:59 ` pinskia at gcc dot gnu dot org
@ 2005-09-26 20:46 ` dann at godzilla dot ics dot uci dot edu
  2005-09-29 18:58 ` drow at false dot org
  2005-09-29 20:10 ` dann at godzilla dot ics dot uci dot edu
  10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2005-09-26 20:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2005-09-26 20:46 -------
(In reply to comment #4)
> So this about the following:
> int f(a)
> int a;
> {
>   return a;
> }
> int f(int);
> 
> Which is questionable.
> 
> So I don't think this is not an inappropriate warning.

It seems that the warning was designed for code like your example above. 
But if you have 1 K&R file and one C90 file, then there should be no warning... 
Another bad thing is that if you swap the files on the command line then you get
no warning.


-- 


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
                   ` (8 preceding siblings ...)
  2005-09-26 20:46 ` dann at godzilla dot ics dot uci dot edu
@ 2005-09-29 18:58 ` drow at false dot org
  2005-09-29 20:10 ` dann at godzilla dot ics dot uci dot edu
  10 siblings, 0 replies; 12+ messages in thread
From: drow at false dot org @ 2005-09-29 18:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From drow at false dot org  2005-09-29 18:58 -------
Subject: Re:  Unconditional warning when using -combine

On Mon, Sep 26, 2005 at 08:46:20PM -0000, dann at godzilla dot ics dot uci dot edu wrote:
> > So this about the following:
> > int f(a)
> > int a;
> > {
> >   return a;
> > }
> > int f(int);
> > 
> > Which is questionable.
> > 
> > So I don't think this is not an inappropriate warning.
> 
> It seems that the warning was designed for code like your example above. 
> But if you have 1 K&R file and one C90 file, then there should be no warning... 
> Another bad thing is that if you swap the files on the command line then you get
> no warning.

There certainly should be a warning.  It's not obvious on most targets
with int, but what you're doing here won't work with float arguments;
if the prototype includes an argument list, the definition should also.



-- 


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


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

* [Bug c/24068] Unconditional warning when using -combine
  2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
                   ` (9 preceding siblings ...)
  2005-09-29 18:58 ` drow at false dot org
@ 2005-09-29 20:10 ` dann at godzilla dot ics dot uci dot edu
  10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2005-09-29 20:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dann at godzilla dot ics dot uci dot edu  2005-09-29 20:10 -------
(In reply to comment #9)
> Subject: Re:  Unconditional warning when using -combine
> 
> On Mon, Sep 26, 2005 at 08:46:20PM -0000, dann at godzilla dot ics dot uci dot
edu wrote:
> > > So this about the following:
> > > int f(a)
> > > int a;
> > > {
> > >   return a;
> > > }
> > > int f(int);
> > > 
> > > Which is questionable.
> > > 
> > > So I don't think this is not an inappropriate warning.
> > 
> > It seems that the warning was designed for code like your example above. 
> > But if you have 1 K&R file and one C90 file, then there should be no warning... 
> > Another bad thing is that if you swap the files on the command line then you get
> > no warning.
> 
> There certainly should be a warning.  It's not obvious on most targets
> with int, but what you're doing here won't work with float arguments;
> if the prototype includes an argument list, the definition should also.
> 

Sorry, I am not sure I understand what are you referring to... Both in the
original bug report and in Andrew's example above both the definition and the
prototype included an argument list with types for all the declarations.


-- 


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


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

end of thread, other threads:[~2005-09-29 20:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-26 19:24 [Bug c/24068] New: Unconditional warning when using -fwhole-program dann at godzilla dot ics dot uci dot edu
2005-09-26 19:25 ` [Bug c/24068] " dann at godzilla dot ics dot uci dot edu
2005-09-26 19:25 ` dann at godzilla dot ics dot uci dot edu
2005-09-26 19:29 ` [Bug c/24068] Unconditional warning when using -combine pinskia at gcc dot gnu dot org
2005-09-26 19:31 ` pinskia at gcc dot gnu dot org
2005-09-26 19:41 ` pinskia at gcc dot gnu dot org
2005-09-26 19:47 ` pinskia at gcc dot gnu dot org
2005-09-26 19:54 ` dann at godzilla dot ics dot uci dot edu
2005-09-26 19:59 ` pinskia at gcc dot gnu dot org
2005-09-26 20:46 ` dann at godzilla dot ics dot uci dot edu
2005-09-29 18:58 ` drow at false dot org
2005-09-29 20:10 ` dann at godzilla dot ics dot uci dot edu

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