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.
This commit is contained in:
joerg 2010-07-31 00:04:42 +00:00
parent 9749b7715b
commit 44b309378f
3 changed files with 34 additions and 20 deletions

View File

@ -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 @@ int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict)
__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 @@ int *__errno(void);
#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 @@ sigaddset(sigset_t *set, int signo)
return (0);
}
_SIGINLINE int
__c99inline int
sigdelset(sigset_t *set, int signo)
{
if (signo <= 0 || signo >= _NSIG) {
@ -130,7 +127,7 @@ sigdelset(sigset_t *set, int signo)
return (0);
}
_SIGINLINE int
__c99inline int
sigismember(const sigset_t *set, int signo)
{
if (signo <= 0 || signo >= _NSIG) {
@ -140,20 +137,20 @@ sigismember(const sigset_t *set, int signo)
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__ */
/*

View File

@ -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>

View File

@ -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 */