This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: SIG_ERR in libf2c/libU77
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: RFA: SIG_ERR in libf2c/libU77
- From: msokolov at ivan dot Harhan dot ORG (Michael Sokolov)
- Date: Sun, 21 Jan 01 18:51:42 PST
Fergus Henderson <fjh@cs.mu.oz.au> wrote:
> Nevertheless, someone might implement a C standard library based on
> what the C standard says, without reading or caring about the BSD
> manual page for signal(). Your patch breaks gcc. Perhaps the breakage
> currently doesn't have any symptom, but it is still wrong.
Try the patch below instead.
--
Michael Sokolov
Public Service Agent
International Engineering and Science Task Force
1351 VINE AVE APT 27 Phone: +1-714-738-5409
FULLERTON CA 92833-4291 USA (home office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP)
2001-01-21 Michael Sokolov <msokolov@ivan.Harhan.ORG>
* libU77/alarm_.c: Separate the #ifdef KR_headers logic from the
G77_alarm_0 function definition. Check for SIG_ERR and provide our own
if missing.
Index: libU77/alarm_.c
===================================================================
RCS file: /cvs/gcc/egcs/libf2c/libU77/alarm_.c,v
retrieving revision 1.2
diff -p -r1.2 alarm_.c
*** alarm_.c 1999/09/04 15:09:18 1.2
--- alarm_.c 2001/01/22 02:47:22
*************** typedef RETSIGTYPE (*sig_type)();
*** 39,52 ****
#ifdef KR_headers
extern sig_type signal();
integer G77_alarm_0 (seconds, proc)
integer *seconds;
sig_type proc;
#else
- #include <signal.h>
- typedef int (*sig_proc)(int);
-
integer G77_alarm_0 (integer *seconds, sig_proc proc)
#endif
{
--- 39,58 ----
#ifdef KR_headers
extern sig_type signal();
+ #else
+ #include <signal.h>
+ typedef int (*sig_proc)(int);
+ #endif
+
+ #ifndef SIG_ERR
+ #define SIG_ERR ((sig_type) -1)
+ #endif
+ #ifdef KR_headers
integer G77_alarm_0 (seconds, proc)
integer *seconds;
sig_type proc;
#else
integer G77_alarm_0 (integer *seconds, sig_proc proc)
#endif
{