public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Warning elimination patch in sched.c
@ 1998-03-10  6:46 Bjørn Wennberg
  0 siblings, 0 replies; 6+ messages in thread
From: Bjørn Wennberg @ 1998-03-10  6:46 UTC (permalink / raw)
  To: 'Kaveh R. Ghazi', egcs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]

I did include the appropriate include-files to get the correct
definition of qsort. That
is why I find the warning messages strange.

bjornw>

> -----Original Message-----
> From:	Kaveh R. Ghazi [SMTP:ghazi@caip.rutgers.edu]
> Sent:	10. mars 1998 14:42
> To:	Bjorn.Wennberg@lcc.no; egcs@cygnus.com;
> schmid@ltoi.iap.physik.tu-darmstadt.de
> Subject:	RE: Warning elimination patch in sched.c
> 
>  > From: Bjørn Wennberg <Bjorn.Wennberg@lcc.no>
>  > 
>  > This might be the correct solution to the problem but I'm curios to
> why
>  > the warnings are reported from gcc.
>  > If I create a small file containing:
>  > -----
>  > static int function(int *, int *);
>  > int main() {
>  >   qsort(0, 0, 0, function);
>  > }
>  > ------
>  > Then I do not get a warning message from gcc. So why do we get a
> warning
>  > message when compiling haifa-sched.c (or sched.c)?
>  > bjornw>
> 
> 	Your program must include stdlib.h to prototype qsort's argument
> list, or the -W -Wall flags won't know anything's amiss.
> --
> Kaveh R. Ghazi			Project Manager / Custom
> Development
> ghazi@caip.rutgers.edu		ICon CMT Corp.

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

* Re: Warning elimination patch in sched.c
  1998-03-09 12:52 Peter Schmid
@ 1998-03-12 14:50 ` Jim Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Jim Wilson @ 1998-03-12 14:50 UTC (permalink / raw)
  To: Peter Schmid; +Cc: egcs

	While compiling gcc/sched.c I get the warning:
	sched.c: In function `schedule_block':
	sched.c:3138: warning: passing arg 4 of `qsort' from incompatible pointer type
	sched.c:3233: warning: passing arg 4 of `qsort' from incompatible pointer type

A patch has been installed to fix this.  It is very similar to your patch,
except that it uses GENERIC_PTR instead of void *, as some older K&R C
compiler doesn't handle void *.

Jim

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

* RE: Warning elimination patch in sched.c
@ 1998-03-10 10:28 Kaveh R. Ghazi
  0 siblings, 0 replies; 6+ messages in thread
From: Kaveh R. Ghazi @ 1998-03-10 10:28 UTC (permalink / raw)
  To: Bjorn.Wennberg, egcs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

>  > From: Bjxrn Wennberg <Bjorn.Wennberg@lcc.no>
>  >
>  > This might be the correct solution to the problem but I'm curios to why
>  > the warnings are reported from gcc.
>  > If I create a small file containing:
>  > -----
>  > static int function(int *, int *);
>  > int main() {
>  >   qsort(0, 0, 0, function);
>  > }
>  > ------


 > From: Bjørn Wennberg <Bjorn.Wennberg@lcc.no>
 > 
 > I did include the appropriate include-files to get the correct
 > definition of qsort. That
 > is why I find the warning messages strange.
 > 
 > bjornw>

	Hmm, your posting of the code fragment didn't indicate stdlib.h
was included.  Its hard to figure out what's going on with incomplete
information. 

	Perhaps if you posted the output from "gcc -v", the exact source
code, and the exact flags you passed to gcc to compile the program, it
would help.  Also run the compilation with -save-temps and send the .i
file.  This will let me see the prototype for qsort on your platform.

		--Kaveh
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

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

* RE: Warning elimination patch in sched.c
@ 1998-03-10  6:46 Kaveh R. Ghazi
  0 siblings, 0 replies; 6+ messages in thread
From: Kaveh R. Ghazi @ 1998-03-10  6:46 UTC (permalink / raw)
  To: Bjorn.Wennberg, egcs, schmid

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

 > From: Bjørn Wennberg <Bjorn.Wennberg@lcc.no>
 > 
 > This might be the correct solution to the problem but I'm curios to why
 > the warnings are reported from gcc.
 > If I create a small file containing:
 > -----
 > static int function(int *, int *);
 > int main() {
 >   qsort(0, 0, 0, function);
 > }
 > ------
 > Then I do not get a warning message from gcc. So why do we get a warning
 > message when compiling haifa-sched.c (or sched.c)?
 > bjornw>

	Your program must include stdlib.h to prototype qsort's argument
list, or the -W -Wall flags won't know anything's amiss.
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

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

* RE: Warning elimination patch in sched.c
@ 1998-03-10  2:14 Bjørn Wennberg
  0 siblings, 0 replies; 6+ messages in thread
From: Bjørn Wennberg @ 1998-03-10  2:14 UTC (permalink / raw)
  To: 'Peter Schmid', egcs

This might be the correct solution to the problem but I'm curios to why
the warnings are reported from gcc.
If I create a small file containing:
-----
static int function(int *, int *);
int main() {
  qsort(0, 0, 0, function);
}
------
Then I do not get a warning message from gcc. So why do we get a warning
message when compiling haifa-sched.c (or sched.c)?

bjornw>

> -----Original Message-----
> From:	Peter Schmid [SMTP:schmid@ltoi.iap.physik.tu-darmstadt.de]
> Sent:	9. mars 1998 20:27
> To:	egcs@cygnus.com
> Subject:	Warning elimination patch in sched.c
> 
> While compiling gcc/sched.c I get the warning:
> sched.c: In function `schedule_block':
> sched.c:3138: warning: passing arg 4 of `qsort' from incompatible
> pointer type
> sched.c:3233: warning: passing arg 4 of `qsort' from incompatible
> pointer type
> 
> The following patch eliminates the warning.
> 
> Perhaps something like:
> #ifndef __cplusplus
> #ifndef __STDC__
> #define const
> #endif
> #endif
> should also be included, as in c-parse.c.
> 
> Peter Schmid
> 
> Mon Mar  9 19:34:17 1998  Peter Schmid
> <schmid@ltoi.iap.physik.tu-darmstadt.de>
> 
> 	* sched.c: change rank_for_schedule prototype to 
> (const void*,const void*) to avoid passing arg 4 of `qsort'
> incompatible 
> pointer type warning
> 
> *** gcc/sched.c~	Fri Feb 20 14:24:50 1998
> --- gcc/sched.c	Mon Mar  9 20:22:55 1998
> *************** static void sched_analyze_2		PROTO((rtx,
> *** 322,328 ****
>   static void sched_analyze_insn		PROTO((rtx, rtx, rtx));
>   static int sched_analyze		PROTO((rtx, rtx));
>   static void sched_note_set		PROTO((int, rtx, int));
> ! static int rank_for_schedule		PROTO((rtx *, rtx *));
>   static void swap_sort			PROTO((rtx *, int));
>   static void queue_insn			PROTO((rtx, int));
>   static int birthing_insn_p		PROTO((rtx));
> --- 322,328 ----
>   static void sched_analyze_insn		PROTO((rtx, rtx, rtx));
>   static int sched_analyze		PROTO((rtx, rtx));
>   static void sched_note_set		PROTO((int, rtx, int));
> ! static int rank_for_schedule		PROTO((const void *,
> const void *));
>   static void swap_sort			PROTO((rtx *, int));
>   static void queue_insn			PROTO((rtx, int));
>   static int birthing_insn_p		PROTO((rtx));
> *************** sched_note_set (b, x, death)
> *** 1859,1867 ****
>      unstable.  */
>   
>   static int
> ! rank_for_schedule (x, y)
> !      rtx *x, *y;
>   {
>     rtx tmp = *y;
>     rtx tmp2 = *x;
>     rtx link;
> --- 1859,1869 ----
>      unstable.  */
>   
>   static int
> ! rank_for_schedule (xv, yv)
> !      const void *xv, *yv;
>   {
> +   rtx *x = (rtx *) xv;
> +   rtx *y = (rtx *) yv;
>     rtx tmp = *y;
>     rtx tmp2 = *x;
>     rtx link;

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

* Warning elimination patch in sched.c
@ 1998-03-09 12:52 Peter Schmid
  1998-03-12 14:50 ` Jim Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Schmid @ 1998-03-09 12:52 UTC (permalink / raw)
  To: egcs

While compiling gcc/sched.c I get the warning:
sched.c: In function `schedule_block':
sched.c:3138: warning: passing arg 4 of `qsort' from incompatible pointer type
sched.c:3233: warning: passing arg 4 of `qsort' from incompatible pointer type

The following patch eliminates the warning.

Perhaps something like:
#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif
should also be included, as in c-parse.c.

Peter Schmid

Mon Mar  9 19:34:17 1998  Peter Schmid  <schmid@ltoi.iap.physik.tu-darmstadt.de>

	* sched.c: change rank_for_schedule prototype to 
(const void*,const void*) to avoid passing arg 4 of `qsort' incompatible 
pointer type warning

*** gcc/sched.c~	Fri Feb 20 14:24:50 1998
--- gcc/sched.c	Mon Mar  9 20:22:55 1998
*************** static void sched_analyze_2		PROTO((rtx,
*** 322,328 ****
  static void sched_analyze_insn		PROTO((rtx, rtx, rtx));
  static int sched_analyze		PROTO((rtx, rtx));
  static void sched_note_set		PROTO((int, rtx, int));
! static int rank_for_schedule		PROTO((rtx *, rtx *));
  static void swap_sort			PROTO((rtx *, int));
  static void queue_insn			PROTO((rtx, int));
  static int birthing_insn_p		PROTO((rtx));
--- 322,328 ----
  static void sched_analyze_insn		PROTO((rtx, rtx, rtx));
  static int sched_analyze		PROTO((rtx, rtx));
  static void sched_note_set		PROTO((int, rtx, int));
! static int rank_for_schedule		PROTO((const void *, const void *));
  static void swap_sort			PROTO((rtx *, int));
  static void queue_insn			PROTO((rtx, int));
  static int birthing_insn_p		PROTO((rtx));
*************** sched_note_set (b, x, death)
*** 1859,1867 ****
     unstable.  */
  
  static int
! rank_for_schedule (x, y)
!      rtx *x, *y;
  {
    rtx tmp = *y;
    rtx tmp2 = *x;
    rtx link;
--- 1859,1869 ----
     unstable.  */
  
  static int
! rank_for_schedule (xv, yv)
!      const void *xv, *yv;
  {
+   rtx *x = (rtx *) xv;
+   rtx *y = (rtx *) yv;
    rtx tmp = *y;
    rtx tmp2 = *x;
    rtx link;


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

end of thread, other threads:[~1998-03-12 14:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-10  6:46 Warning elimination patch in sched.c Bjørn Wennberg
  -- strict thread matches above, loose matches on Subject: below --
1998-03-10 10:28 Kaveh R. Ghazi
1998-03-10  6:46 Kaveh R. Ghazi
1998-03-10  2:14 Bjørn Wennberg
1998-03-09 12:52 Peter Schmid
1998-03-12 14:50 ` Jim Wilson

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