Module Name: src Committed By: joerg Date: Sat Jul 31 00:04:43 UTC 2010
Modified Files: src/include: signal.h src/lib/libc/gen: sigsetops.c src/sys/sys: cdefs.h Log Message: Define a new __c99inline macro for compilers known to implement the C99 behavior. This unbreaks GCC 4.4's libgfortran build with the old signal.h logic, because GCC decided to put the body for the sigsetop functions in multiple objects. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/include/signal.h cvs rdiff -u -r1.15 -r1.16 src/lib/libc/gen/sigsetops.c cvs rdiff -u -r1.78 -r1.79 src/sys/sys/cdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/include/signal.h diff -u src/include/signal.h:1.52 src/include/signal.h:1.53 --- src/include/signal.h:1.52 Tue May 4 09:07:11 2010 +++ src/include/signal.h Sat Jul 31 00:04:42 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: signal.h,v 1.52 2010/05/04 09:07:11 plunky Exp $ */ +/* $NetBSD: signal.h,v 1.53 2010/07/31 00:04:42 joerg Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -87,7 +87,12 @@ __RENAME(__sigprocmask14); int sigsuspend(const sigset_t *) __RENAME(__sigsuspend14); -#if (defined(__GNUC__) && defined(__STDC__)) || defined(_SIGINLINE) +#if defined(__c99inline) || defined(__SIGSETOPS_BODY) + +#if defined(__SIGSETOPS_BODY) +#undef __c99inline +#define __c99inline +#endif /* note: this appears in both errno.h and signal.h */ #ifndef __errno @@ -100,15 +105,7 @@ #define ___errno (*__errno()) #endif -#ifndef _SIGINLINE -#if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) -#define _SIGINLINE extern __inline -#else -#define _SIGINLINE __inline -#endif -#endif - -_SIGINLINE int +__c99inline int sigaddset(sigset_t *set, int signo) { if (signo <= 0 || signo >= _NSIG) { @@ -119,7 +116,7 @@ return (0); } -_SIGINLINE int +__c99inline int sigdelset(sigset_t *set, int signo) { if (signo <= 0 || signo >= _NSIG) { @@ -130,7 +127,7 @@ return (0); } -_SIGINLINE int +__c99inline int sigismember(const sigset_t *set, int signo) { if (signo <= 0 || signo >= _NSIG) { @@ -140,20 +137,20 @@ return (__sigismember(set, signo)); } -_SIGINLINE int +__c99inline int sigemptyset(sigset_t *set) { __sigemptyset(set); return (0); } -_SIGINLINE int +__c99inline int sigfillset(sigset_t *set) { __sigfillset(set); return (0); } -#endif /* (__GNUC__ && __STDC__) || _SIGINLINE */ +#endif /* __c99inline */ #endif /* !__LIBC12_SOURCE__ */ /* Index: src/lib/libc/gen/sigsetops.c diff -u src/lib/libc/gen/sigsetops.c:1.15 src/lib/libc/gen/sigsetops.c:1.16 --- src/lib/libc/gen/sigsetops.c:1.15 Tue Sep 13 01:44:09 2005 +++ src/lib/libc/gen/sigsetops.c Sat Jul 31 00:04:43 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sigsetops.c,v 1.15 2005/09/13 01:44:09 christos Exp $ */ +/* $NetBSD: sigsetops.c,v 1.16 2010/07/31 00:04:43 joerg Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -36,11 +36,11 @@ #if 0 static char sccsid[] = "@(#)sigsetops.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: sigsetops.c,v 1.15 2005/09/13 01:44:09 christos Exp $"); +__RCSID("$NetBSD: sigsetops.c,v 1.16 2010/07/31 00:04:43 joerg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ -#define _SIGINLINE +#define __SIGSETOPS_BODY #include <errno.h> #include <signal.h> Index: src/sys/sys/cdefs.h diff -u src/sys/sys/cdefs.h:1.78 src/sys/sys/cdefs.h:1.79 --- src/sys/sys/cdefs.h:1.78 Fri Oct 2 21:05:28 2009 +++ src/sys/sys/cdefs.h Sat Jul 31 00:04:43 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cdefs.h,v 1.78 2009/10/02 21:05:28 christos Exp $ */ +/* $NetBSD: cdefs.h,v 1.79 2010/07/31 00:04:43 joerg Exp $ */ /* * Copyright (c) 1991, 1993 @@ -228,6 +228,23 @@ #define __used __unused #endif +/* + * Non-static C99 inline functions are optional bodies. They don't + * create global symbols if not used, but can be replaced if desirable. + * This differs from the behavior of GCC before version 4.3. The nearest + * equivalent for older GCC is `extern inline'. For newer GCC, use the + * gnu_inline attribute additionally to get the old behavior. + * + * For C99 compilers other than GCC, the C99 behavior is expected. + */ +#if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__) +#define __c99inline extern __attribute__((__gnu_inline__)) __inline +#elif defined(__GNUC__) +#define __c99inline extern __inline +#elif defined(__STDC_VERSION__) +#define __c99inline __inline +#endif + #if defined(__lint__) #define __packed __packed #define __aligned(x) /* delete */