public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH, boehm-gc: silence os_dep.c warnings
@ 2009-11-27  2:42 Ben Elliston
  2009-11-27  9:39 ` Andrew Haley
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Elliston @ 2009-11-27  2:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: java

GNU/Linux systems warn about the BSD signal functions like sigsetmask:

  warning: ‘sigsetmask’ is deprecated (declared at /usr/include/signal.h:199)

This patch rearranges some of the code in boehm-gc/os_dep.c so that
modern systems providing the POSIX signals API are used in preference to
the BSD API.  This is important on systems like GNU/Linux where both
APIs are provided.

As autoconf tests are not used in boehm-gc, I have followed the style of
tests already used in this file.  Bootstrapping is underway on
x86_64-linux-gnu.  Okay for the trunk?

Ben


2009-11-27  Ben Elliston  <bje@au.ibm.com>

	* os_dep.c: Use the POSIX signal API in preference to the BSD API.
	Generate a compilation error if neither the POSIX nor BSD APIs can
	be detected.

Index: os_dep.c
===================================================================
--- os_dep.c	(revision 154694)
+++ os_dep.c	(working copy)
@@ -501,7 +501,13 @@ void GC_enable_signals(void)
       && !defined(MACOS) && !defined(DJGPP) && !defined(DOS4GW) \
       && !defined(NOSYS) && !defined(ECOS)
 
-#   if defined(sigmask) && !defined(UTS4) && !defined(HURD)
+#   if defined(SIG_BLOCK)
+	/* Use POSIX/SYSV interface */
+#	define SIGSET_T sigset_t
+#	define SIG_DEL(set, signal) sigdelset(&(set), (signal))
+#	define SIG_FILL(set) sigfillset(&set)
+#	define SIGSETMASK(old, new) sigprocmask(SIG_SETMASK, &(new), &(old))
+#   elif defined(sigmask) && !defined(UTS4) && !defined(HURD)
 	/* Use the traditional BSD interface */
 #	define SIGSET_T int
 #	define SIG_DEL(set, signal) (set) &= ~(sigmask(signal))
@@ -511,11 +517,7 @@ void GC_enable_signals(void)
     	  /* a signal 32.						*/
 #	define SIGSETMASK(old, new) (old) = sigsetmask(new)
 #   else
-	/* Use POSIX/SYSV interface	*/
-#	define SIGSET_T sigset_t
-#	define SIG_DEL(set, signal) sigdelset(&(set), (signal))
-#	define SIG_FILL(set) sigfillset(&set)
-#	define SIGSETMASK(old, new) sigprocmask(SIG_SETMASK, &(new), &(old))
+#       error undetectable signal API
 #   endif
 


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

* Re: PATCH, boehm-gc: silence os_dep.c warnings
  2009-11-27  2:42 PATCH, boehm-gc: silence os_dep.c warnings Ben Elliston
@ 2009-11-27  9:39 ` Andrew Haley
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2009-11-27  9:39 UTC (permalink / raw)
  To: Ben Elliston; +Cc: gcc-patches, java

Ben Elliston wrote:
> GNU/Linux systems warn about the BSD signal functions like sigsetmask:
> 
>   warning: ‘sigsetmask’ is deprecated (declared at /usr/include/signal.h:199)
> 
> This patch rearranges some of the code in boehm-gc/os_dep.c so that
> modern systems providing the POSIX signals API are used in preference to
> the BSD API.  This is important on systems like GNU/Linux where both
> APIs are provided.
> 
> As autoconf tests are not used in boehm-gc, I have followed the style of
> tests already used in this file.  Bootstrapping is underway on
> x86_64-linux-gnu.  Okay for the trunk?
> 
> Ben
> 
> 
> 2009-11-27  Ben Elliston  <bje@au.ibm.com>
> 
> 	* os_dep.c: Use the POSIX signal API in preference to the BSD API.
> 	Generate a compilation error if neither the POSIX nor BSD APIs can
> 	be detected.

OK.

Andrew.

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

end of thread, other threads:[~2009-11-27  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-27  2:42 PATCH, boehm-gc: silence os_dep.c warnings Ben Elliston
2009-11-27  9:39 ` Andrew Haley

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