public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: egcs, does gcc fixincludes etc guarantee a stdlib.h exists?
@ 1998-04-17  8:41 Kaveh R. Ghazi
  0 siblings, 0 replies; 22+ messages in thread
From: Kaveh R. Ghazi @ 1998-04-17  8:41 UTC (permalink / raw)
  To: wilson; +Cc: egcs

 > From: Jim Wilson <wilson@cygnus.com>
 > 
 > This patch looks OK to me.  Go ahead and install it.
 > Jim

	Done.

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

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: egcs, does gcc fixincludes etc guarantee a stdlib.h exists?
@ 1998-04-14  9:37 Kaveh R. Ghazi
  1998-04-14  7:45 ` Philippe De Muyter
  0 siblings, 1 reply; 22+ messages in thread
From: Kaveh R. Ghazi @ 1998-04-14  9:37 UTC (permalink / raw)
  To: phdm; +Cc: bothner, egcs, law

 > From: "Philippe De Muyter" <phdm@macqel.be>
 > 
 > > Mon Apr 13 12:18:31 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 > >  
 > >         * frame.c: Include stdlib.h and unistd.h to possibly get various
 > >         function prototypes.  The fixproto script guarantees these header
 > >         files exist on the target system.
 > 
 > As I wrote before, stdlib.h and unistd.h are guaranteed to exist, but
 > there is no guarantee that you get a prototype for malloc from stdlib.h,
 > except if you define __USE_FIXED_PROTOTYPES__ before including stdlib.h.
 > 
 > Philippe De Muyter


	I considered doing that, but I wasn't completely sure defining
that macro unconditionally in libgcc2.c or frame.c was a good idea.  Are
we guaranteed that defining __USE_FIXED_PROTOTYPES__ is safe for all
platforms? (I don't know, I'm asking.) If it is safe, then why does the
wrapper exist at all? ... 

	I don't have strong feelings either way.  Whatever Jeff decides
is fine with me. 

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

^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: egcs, does gcc fixincludes etc guarantee a stdlib.h exists?
@ 1998-04-13 12:29 Kaveh R. Ghazi
  1998-04-14  2:02 ` Philippe De Muyter
  1998-04-16 15:31 ` Jim Wilson
  0 siblings, 2 replies; 22+ messages in thread
From: Kaveh R. Ghazi @ 1998-04-13 12:29 UTC (permalink / raw)
  To: bothner, law; +Cc: egcs

 > From: Jeffrey A Law <law@hurl.cygnus.com>
 > 
 >   In message < 199804010732.XAA09115@cygnus.com >you write:
 >   > >  > 	Simple question.  Does gcc guarantee that after it diddles with
 >   > >  > the system headers that a stdlib.h exists in some form?
 >   > > I do not believe that is the case.
 >   > 
 >   > Gcc *does* guarantee that after it diddles with the system headers
 >   > that a stdlib.h exists in some form.
 >   > 
 >   > This is handled by fixproto, which is normally run after fixincludes.
 > 
 > I stand corrected.  Obviously, I'm not all that familiar with the
 > actions of fixproto :-)
 > 
 > jeff


	Okay, I looked in fixproto and it looks as if it makes sure that
both stdlib.h and unistd.h exist.  Therefore, I would like to submit the
following patch to clean up warnings in target files frame.c and
libgcc2.c. 

	It is especially useful in cases where sizeof(int) != sizeof(void*).
This matters when, e.g malloc, because there is no prototype, is
implicitly declared returning int but it is cast and assigned to a
pointer.  I get the following warnings on mips-sgi-irix6.2, among
several others, which are cured by the patch below:

 > ./libgcc2.c: In function `__bb_init_prg':
 > ./libgcc2.c:2096: warning: cast to pointer from integer of different size
 > ./libgcc2.c:2103: warning: cast to pointer from integer of different size
 > ./libgcc2.c:2107: warning: cast to pointer from integer of different size
 > ./libgcc2.c:2117: warning: cast to pointer from integer of different size
 > ./libgcc2.c:2144: warning: cast to pointer from integer of different size
 > ./libgcc2.c:2152: warning: cast to pointer from integer of different size
 > ./libgcc2.c: In function `__bb_trace_func':
 > ./libgcc2.c:2204: warning: cast to pointer from integer of different size
 > ./libgcc2.c: In function `__bb_trace_func_ret':
 > ./libgcc2.c:2267: warning: cast to pointer from integer of different size
 > ./libgcc2.c: In function `__bb_init_file':
 > ./libgcc2.c:2313: warning: cast to pointer from integer of different size
 > ./libgcc2.c: In function `__bb_init_trace_func':
 > ./libgcc2.c:2387: warning: cast to pointer from integer of different size


		--Kaveh







Mon Apr 13 12:18:31 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * frame.c: Include stdlib.h and unistd.h to possibly get various
        function prototypes.  The fixproto script guarantees these header
        files exist on the target system.
        * libgcc2.c: Likewise.
 
        * gthr-single.h (__gthread_mutex_lock, __gthread_mutex_trylock,
        __gthread_mutex_unlock): Add __attribute__ ((__unused__)) to the
        function parameters.
        * libgcc2.c (__udiv_w_sdiv): Likewise.


diff -rup orig/egcs-980406/gcc/frame.c egcs-980406/gcc/frame.c
--- orig/egcs-980406/gcc/frame.c	Fri Apr  3 11:34:56 1998
+++ egcs-980406/gcc/frame.c	Sat Apr 11 15:12:27 1998
@@ -32,6 +32,11 @@ Boston, MA 02111-1307, USA.  */
    do not apply.  */
 
 #include "tconfig.h"
+
+/* fixproto guarantees these system headers exist. */
+#include <stdlib.h>
+#include <unistd.h>
+
 #include "defaults.h"
 
 #ifdef DWARF2_UNWIND_INFO
diff -rup orig/egcs-980406/gcc/gthr-single.h egcs-980406/gcc/gthr-single.h
--- orig/egcs-980406/gcc/gthr-single.h	Fri Apr  3 11:35:40 1998
+++ egcs-980406/gcc/gthr-single.h	Sat Apr 11 15:23:36 1998
@@ -42,19 +42,19 @@ __gthread_active_p ()
 }
 
 static inline int
-__gthread_mutex_lock (__gthread_mutex_t *mutex)
+__gthread_mutex_lock (__gthread_mutex_t *mutex __attribute__ ((__unused__)))
 {
   return 0;
 }
 
 static inline int
-__gthread_mutex_trylock (__gthread_mutex_t *mutex)
+__gthread_mutex_trylock (__gthread_mutex_t *mutex __attribute__ ((__unused__)))
 {
   return 0;
 }
 
 static inline int
-__gthread_mutex_unlock (__gthread_mutex_t *mutex)
+__gthread_mutex_unlock (__gthread_mutex_t *mutex __attribute__ ((__unused__)))
 {
   return 0;
 }
diff -rup orig/egcs-980406/gcc/libgcc2.c egcs-980406/gcc/libgcc2.c
--- orig/egcs-980406/gcc/libgcc2.c	Sat Apr  4 12:38:13 1998
+++ egcs-980406/gcc/libgcc2.c	Sat Apr 11 15:15:44 1998
@@ -31,6 +31,11 @@ Boston, MA 02111-1307, USA.  */
    do not apply.  */
 
 #include "tconfig.h"
+
+/* fixproto guarantees these system headers exist. */
+#include <stdlib.h>
+#include <unistd.h>
+
 #include "machmode.h"
 #include "defaults.h" 
 #ifndef L_trampoline
@@ -391,7 +396,10 @@ __udiv_w_sdiv (USItype *rp, USItype a1, 
 #else
 /* If sdiv_qrnnd doesn't exist, define dummy __udiv_w_sdiv.  */
 USItype
-__udiv_w_sdiv (USItype *rp, USItype a1, USItype a0, USItype d)
+__udiv_w_sdiv (USItype *rp __attribute__ ((__unused__)),
+	       USItype a1 __attribute__ ((__unused__)),
+	       USItype a0 __attribute__ ((__unused__)),
+	       USItype d __attribute__ ((__unused__)))
 {
   return 0;
 }

^ permalink raw reply	[flat|nested] 22+ messages in thread
* egcs, does gcc fixincludes etc guarantee a stdlib.h exists?
@ 1998-03-27 15:18 Kaveh R. Ghazi
  1998-03-28 19:24 ` Philippe De Muyter
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Kaveh R. Ghazi @ 1998-03-27 15:18 UTC (permalink / raw)
  To: egcs; +Cc: ghazi

	Simple question.  Does gcc guarantee that after it diddles with
the system headers that a stdlib.h exists in some form?

	For target files which include tconfig.h, since we can't check
autoconf macros, I'd like to hardwire including stdlib.h to possibly get
prototypes for malloc, et al. 

	This set of files would include frame.c and libgcc2.c.

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

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

end of thread, other threads:[~1998-04-21 17:38 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-17  8:41 egcs, does gcc fixincludes etc guarantee a stdlib.h exists? Kaveh R. Ghazi
  -- strict thread matches above, loose matches on Subject: below --
1998-04-14  9:37 Kaveh R. Ghazi
1998-04-14  7:45 ` Philippe De Muyter
1998-04-16 16:34   ` Jim Wilson
1998-04-16 18:39     ` Jeffrey A Law
1998-04-17  2:23     ` Philippe De Muyter
1998-04-17 14:49       ` Jim Wilson
1998-04-20  4:16         ` Philippe De Muyter
1998-04-17 14:42   ` Philippe De Muyter
1998-04-20 22:16     ` Jim Wilson
1998-04-21 13:29       ` Philippe De Muyter
1998-04-21 17:38         ` Jim Wilson
1998-04-13 12:29 Kaveh R. Ghazi
1998-04-14  2:02 ` Philippe De Muyter
1998-04-16 15:31 ` Jim Wilson
1998-03-27 15:18 Kaveh R. Ghazi
1998-03-28 19:24 ` Philippe De Muyter
1998-03-29  5:14 ` Manfred Hollstein
1998-03-31  0:46   ` Manfred Hollstein
1998-03-31  0:46 ` Jeffrey A Law
1998-04-02 11:32   ` Per Bothner
1998-04-02  9:35     ` Jeffrey A Law

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