public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: bothner@cygnus.com, law@cygnus.com
Cc: egcs@cygnus.com
Subject: Re: egcs, does gcc fixincludes etc guarantee a stdlib.h exists?
Date: Mon, 13 Apr 1998 12:29:00 -0000	[thread overview]
Message-ID: <199804131651.MAA24088@caip.rutgers.edu> (raw)

 > 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;
 }

             reply	other threads:[~1998-04-13 12:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-13 12:29 Kaveh R. Ghazi [this message]
1998-04-14  2:02 ` Philippe De Muyter
1998-04-16 15:31 ` Jim Wilson
  -- strict thread matches above, loose matches on Subject: below --
1998-04-17  8:41 Kaveh R. Ghazi
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-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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199804131651.MAA24088@caip.rutgers.edu \
    --to=ghazi@caip.rutgers.edu \
    --cc=bothner@cygnus.com \
    --cc=egcs@cygnus.com \
    --cc=law@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).