* [PATCH] stdio.h: guard function macros with !__cplusplus
@ 2017-06-13 20:00 Yaakov Selkowitz
2017-06-13 20:01 ` [PATCH] Feature test macros overhaul: signal.h (part 3) Yaakov Selkowitz
2017-06-14 8:48 ` [PATCH] stdio.h: guard function macros with !__cplusplus Corinna Vinschen
0 siblings, 2 replies; 8+ messages in thread
From: Yaakov Selkowitz @ 2017-06-13 20:00 UTC (permalink / raw)
To: newlib
While POSIX allows these functions to also be defined as macros in C, in
C++ this is not allowed, and prevents these names (particularly feof) from
being used in a custom namespace.
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
newlib/libc/include/stdio.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 097b0f665..1c32423d3 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -718,6 +718,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
#define __sfileno(p) ((p)->_file)
+#ifndef __cplusplus
#ifndef _REENT_SMALL
#define feof(p) __sfeof(p)
#define ferror(p) __sferror(p)
@@ -740,6 +741,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
#define putc(x, fp) __sputc_r(_REENT, x, fp)
#endif /* lint */
#endif /* __CYGWIN__ */
+#endif /* __cplusplus */
#if __MISC_VISIBLE
/* fast always-buffered version, true iff error */
--
2.12.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Feature test macros overhaul: signal.h (part 3)
2017-06-13 20:00 [PATCH] stdio.h: guard function macros with !__cplusplus Yaakov Selkowitz
@ 2017-06-13 20:01 ` Yaakov Selkowitz
2017-06-15 9:48 ` Thomas Preudhomme
2017-06-14 8:48 ` [PATCH] stdio.h: guard function macros with !__cplusplus Corinna Vinschen
1 sibling, 1 reply; 8+ messages in thread
From: Yaakov Selkowitz @ 2017-06-13 20:01 UTC (permalink / raw)
To: newlib
Notably, sigaction and friends are POSIX, but the form of sigpause
currently provided is BSD.
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
newlib/libc/include/sys/signal.h | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index 8d1b53fce..a56f18a1b 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -152,13 +152,15 @@ typedef struct sigaltstack {
size_t ss_size; /* Stack size. */
} stack_t;
+#if __POSIX_VISIBLE
#define SIG_SETMASK 0 /* set mask with sigprocmask() */
#define SIG_BLOCK 1 /* set of signals to block */
#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
+#endif
-#if defined(_POSIX_THREADS)
+#if __POSIX_VISIBLE >= 199506
int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
#endif
@@ -168,10 +170,14 @@ int _EXFUN(_kill, (pid_t, int));
#endif /* _COMPILING_NEWLIB */
#endif /* __CYGWIN__ || __rtems__ */
+#if __POSIX_VISIBLE
int _EXFUN(kill, (pid_t, int));
+#endif
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4
int _EXFUN(killpg, (pid_t, int));
+#endif
+#if __POSIX_VISIBLE
int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
int _EXFUN(sigaddset, (sigset_t *, const int));
int _EXFUN(sigdelset, (sigset_t *, const int));
@@ -180,7 +186,7 @@ int _EXFUN(sigfillset, (sigset_t *));
int _EXFUN(sigemptyset, (sigset_t *));
int _EXFUN(sigpending, (sigset_t *));
int _EXFUN(sigsuspend, (const sigset_t *));
-int _EXFUN(sigpause, (int));
+int _EXFUN(sigwait, (const sigset_t *set, int *sig));
#if !defined(__CYGWIN__) && !defined(__rtems__)
/* These depend upon the type of sigset_t, which right now
@@ -192,17 +198,21 @@ int _EXFUN(sigpause, (int));
#define sigfillset(what) (*(what) = ~(0), 0)
#define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
#endif /* !__CYGWIN__ && !__rtems__ */
-#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 4 */
+#endif /* __POSIX_VISIBLE */
+
+#if __BSD_VISIBLE
+int _EXFUN(sigpause, (int));
+#endif
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
#endif
-#if defined(_POSIX_THREADS)
+#if __POSIX_VISIBLE >= 199506
int _EXFUN(pthread_kill, (pthread_t thread, int sig));
#endif
-#if defined(_POSIX_REALTIME_SIGNALS)
+#if __POSIX_VISIBLE >= 199309
/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
@@ -211,12 +221,10 @@ int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info));
int _EXFUN(sigtimedwait,
(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
);
-int _EXFUN(sigwait, (const sigset_t *set, int *sig));
-
/* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
-#endif /* defined(_POSIX_REALTIME_SIGNALS) */
+#endif /* __POSIX_VISIBLE >= 199309 */
#if defined(___AM29K__)
/* These all need to be defined for ANSI C, but I don't think they are
--
2.12.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] stdio.h: guard function macros with !__cplusplus
2017-06-13 20:00 [PATCH] stdio.h: guard function macros with !__cplusplus Yaakov Selkowitz
2017-06-13 20:01 ` [PATCH] Feature test macros overhaul: signal.h (part 3) Yaakov Selkowitz
@ 2017-06-14 8:48 ` Corinna Vinschen
1 sibling, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2017-06-14 8:48 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]
On Jun 13 15:00, Yaakov Selkowitz wrote:
> While POSIX allows these functions to also be defined as macros in C, in
> C++ this is not allowed, and prevents these names (particularly feof) from
> being used in a custom namespace.
>
> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
> ---
> newlib/libc/include/stdio.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
> index 097b0f665..1c32423d3 100644
> --- a/newlib/libc/include/stdio.h
> +++ b/newlib/libc/include/stdio.h
> @@ -718,6 +718,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
> #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
> #define __sfileno(p) ((p)->_file)
>
> +#ifndef __cplusplus
> #ifndef _REENT_SMALL
> #define feof(p) __sfeof(p)
> #define ferror(p) __sferror(p)
> @@ -740,6 +741,7 @@ _ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
> #define putc(x, fp) __sputc_r(_REENT, x, fp)
> #endif /* lint */
> #endif /* __CYGWIN__ */
> +#endif /* __cplusplus */
>
> #if __MISC_VISIBLE
> /* fast always-buffered version, true iff error */
> --
> 2.12.3
ACK to both patches.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Feature test macros overhaul: signal.h (part 3)
2017-06-13 20:01 ` [PATCH] Feature test macros overhaul: signal.h (part 3) Yaakov Selkowitz
@ 2017-06-15 9:48 ` Thomas Preudhomme
2017-06-15 12:52 ` Thomas Preudhomme
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Preudhomme @ 2017-06-15 9:48 UTC (permalink / raw)
To: newlib
Hi,
This patch makes lots of function using pthread_t type visible when
__POSIX_THREADS is not defined as long as __POSIX_VISIBLE is. However, the guard
in sys/_pthreadtypes.h is still checking against __POSIX_THREADS. This leads to
build failure on arm-none-eabi targets.
Best regards,
Thomas
On 13/06/17 21:00, Yaakov Selkowitz wrote:
> Notably, sigaction and friends are POSIX, but the form of sigpause
> currently provided is BSD.
>
> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
> ---
> newlib/libc/include/sys/signal.h | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
> index 8d1b53fce..a56f18a1b 100644
> --- a/newlib/libc/include/sys/signal.h
> +++ b/newlib/libc/include/sys/signal.h
> @@ -152,13 +152,15 @@ typedef struct sigaltstack {
> size_t ss_size; /* Stack size. */
> } stack_t;
>
> +#if __POSIX_VISIBLE
> #define SIG_SETMASK 0 /* set mask with sigprocmask() */
> #define SIG_BLOCK 1 /* set of signals to block */
> #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
>
> int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
> +#endif
>
> -#if defined(_POSIX_THREADS)
> +#if __POSIX_VISIBLE >= 199506
> int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
> #endif
>
> @@ -168,10 +170,14 @@ int _EXFUN(_kill, (pid_t, int));
> #endif /* _COMPILING_NEWLIB */
> #endif /* __CYGWIN__ || __rtems__ */
>
> +#if __POSIX_VISIBLE
> int _EXFUN(kill, (pid_t, int));
> +#endif
>
> #if __BSD_VISIBLE || __XSI_VISIBLE >= 4
> int _EXFUN(killpg, (pid_t, int));
> +#endif
> +#if __POSIX_VISIBLE
> int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
> int _EXFUN(sigaddset, (sigset_t *, const int));
> int _EXFUN(sigdelset, (sigset_t *, const int));
> @@ -180,7 +186,7 @@ int _EXFUN(sigfillset, (sigset_t *));
> int _EXFUN(sigemptyset, (sigset_t *));
> int _EXFUN(sigpending, (sigset_t *));
> int _EXFUN(sigsuspend, (const sigset_t *));
> -int _EXFUN(sigpause, (int));
> +int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>
> #if !defined(__CYGWIN__) && !defined(__rtems__)
> /* These depend upon the type of sigset_t, which right now
> @@ -192,17 +198,21 @@ int _EXFUN(sigpause, (int));
> #define sigfillset(what) (*(what) = ~(0), 0)
> #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
> #endif /* !__CYGWIN__ && !__rtems__ */
> -#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 4 */
> +#endif /* __POSIX_VISIBLE */
> +
> +#if __BSD_VISIBLE
> +int _EXFUN(sigpause, (int));
> +#endif
>
> #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
> int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
> #endif
>
> -#if defined(_POSIX_THREADS)
> +#if __POSIX_VISIBLE >= 199506
> int _EXFUN(pthread_kill, (pthread_t thread, int sig));
> #endif
>
> -#if defined(_POSIX_REALTIME_SIGNALS)
> +#if __POSIX_VISIBLE >= 199309
>
> /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
> NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
> @@ -211,12 +221,10 @@ int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info));
> int _EXFUN(sigtimedwait,
> (const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
> );
> -int _EXFUN(sigwait, (const sigset_t *set, int *sig));
> -
> /* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
> int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
>
> -#endif /* defined(_POSIX_REALTIME_SIGNALS) */
> +#endif /* __POSIX_VISIBLE >= 199309 */
>
> #if defined(___AM29K__)
> /* These all need to be defined for ANSI C, but I don't think they are
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Feature test macros overhaul: signal.h (part 3)
2017-06-15 9:48 ` Thomas Preudhomme
@ 2017-06-15 12:52 ` Thomas Preudhomme
2017-06-15 14:20 ` Thomas Preudhomme
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Preudhomme @ 2017-06-15 12:52 UTC (permalink / raw)
To: newlib
Actually siginfo_t is also a problem due to sigwaitinfo and sigtimedwait using
it, yet it's not defined.
Best regards,
Thomas
On 15/06/17 10:48, Thomas Preudhomme wrote:
> Hi,
>
> This patch makes lots of function using pthread_t type visible when
> __POSIX_THREADS is not defined as long as __POSIX_VISIBLE is. However, the guard
> in sys/_pthreadtypes.h is still checking against __POSIX_THREADS. This leads to
> build failure on arm-none-eabi targets.
>
> Best regards,
>
> Thomas
>
> On 13/06/17 21:00, Yaakov Selkowitz wrote:
>> Notably, sigaction and friends are POSIX, but the form of sigpause
>> currently provided is BSD.
>>
>> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
>> ---
>> newlib/libc/include/sys/signal.h | 24 ++++++++++++++++--------
>> 1 file changed, 16 insertions(+), 8 deletions(-)
>>
>> diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
>> index 8d1b53fce..a56f18a1b 100644
>> --- a/newlib/libc/include/sys/signal.h
>> +++ b/newlib/libc/include/sys/signal.h
>> @@ -152,13 +152,15 @@ typedef struct sigaltstack {
>> size_t ss_size; /* Stack size. */
>> } stack_t;
>>
>> +#if __POSIX_VISIBLE
>> #define SIG_SETMASK 0 /* set mask with sigprocmask() */
>> #define SIG_BLOCK 1 /* set of signals to block */
>> #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
>>
>> int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
>> +#endif
>>
>> -#if defined(_POSIX_THREADS)
>> +#if __POSIX_VISIBLE >= 199506
>> int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
>> #endif
>>
>> @@ -168,10 +170,14 @@ int _EXFUN(_kill, (pid_t, int));
>> #endif /* _COMPILING_NEWLIB */
>> #endif /* __CYGWIN__ || __rtems__ */
>>
>> +#if __POSIX_VISIBLE
>> int _EXFUN(kill, (pid_t, int));
>> +#endif
>>
>> #if __BSD_VISIBLE || __XSI_VISIBLE >= 4
>> int _EXFUN(killpg, (pid_t, int));
>> +#endif
>> +#if __POSIX_VISIBLE
>> int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
>> int _EXFUN(sigaddset, (sigset_t *, const int));
>> int _EXFUN(sigdelset, (sigset_t *, const int));
>> @@ -180,7 +186,7 @@ int _EXFUN(sigfillset, (sigset_t *));
>> int _EXFUN(sigemptyset, (sigset_t *));
>> int _EXFUN(sigpending, (sigset_t *));
>> int _EXFUN(sigsuspend, (const sigset_t *));
>> -int _EXFUN(sigpause, (int));
>> +int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>>
>> #if !defined(__CYGWIN__) && !defined(__rtems__)
>> /* These depend upon the type of sigset_t, which right now
>> @@ -192,17 +198,21 @@ int _EXFUN(sigpause, (int));
>> #define sigfillset(what) (*(what) = ~(0), 0)
>> #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
>> #endif /* !__CYGWIN__ && !__rtems__ */
>> -#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 4 */
>> +#endif /* __POSIX_VISIBLE */
>> +
>> +#if __BSD_VISIBLE
>> +int _EXFUN(sigpause, (int));
>> +#endif
>>
>> #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
>> int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
>> #endif
>>
>> -#if defined(_POSIX_THREADS)
>> +#if __POSIX_VISIBLE >= 199506
>> int _EXFUN(pthread_kill, (pthread_t thread, int sig));
>> #endif
>>
>> -#if defined(_POSIX_REALTIME_SIGNALS)
>> +#if __POSIX_VISIBLE >= 199309
>>
>> /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
>> NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
>> @@ -211,12 +221,10 @@ int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t
>> *info));
>> int _EXFUN(sigtimedwait,
>> (const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
>> );
>> -int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>> -
>> /* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
>> int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
>>
>> -#endif /* defined(_POSIX_REALTIME_SIGNALS) */
>> +#endif /* __POSIX_VISIBLE >= 199309 */
>>
>> #if defined(___AM29K__)
>> /* These all need to be defined for ANSI C, but I don't think they are
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Feature test macros overhaul: signal.h (part 3)
2017-06-15 12:52 ` Thomas Preudhomme
@ 2017-06-15 14:20 ` Thomas Preudhomme
2017-06-19 8:29 ` Thomas Preudhomme
2017-06-19 11:02 ` Corinna Vinschen
0 siblings, 2 replies; 8+ messages in thread
From: Thomas Preudhomme @ 2017-06-15 14:20 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 4862 bytes --]
Please find attached a proposed git-format patch fixing both these issues:
Commit 8a3b3bb4d7224d419cc1a4af60ccf7e70edc876b changed the guard on
some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
some use of siginfo_t and pthread_t became visible under configurations
where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
because the definition of those types are still unavailable.
This commit make those type definition visible for __POSIX_VISIBLE
configurations. This requires moving the siginfo_t definition out of the
RTEMS specific definitions in sys/signal.h while still guarding it
against cygwin case.
Best regards,
Thomas
On 15/06/17 13:52, Thomas Preudhomme wrote:
> Actually siginfo_t is also a problem due to sigwaitinfo and sigtimedwait using
> it, yet it's not defined.
>
> Best regards,
>
> Thomas
>
> On 15/06/17 10:48, Thomas Preudhomme wrote:
>> Hi,
>>
>> This patch makes lots of function using pthread_t type visible when
>> __POSIX_THREADS is not defined as long as __POSIX_VISIBLE is. However, the guard
>> in sys/_pthreadtypes.h is still checking against __POSIX_THREADS. This leads to
>> build failure on arm-none-eabi targets.
>>
>> Best regards,
>>
>> Thomas
>>
>> On 13/06/17 21:00, Yaakov Selkowitz wrote:
>>> Notably, sigaction and friends are POSIX, but the form of sigpause
>>> currently provided is BSD.
>>>
>>> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
>>> ---
>>> newlib/libc/include/sys/signal.h | 24 ++++++++++++++++--------
>>> 1 file changed, 16 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
>>> index 8d1b53fce..a56f18a1b 100644
>>> --- a/newlib/libc/include/sys/signal.h
>>> +++ b/newlib/libc/include/sys/signal.h
>>> @@ -152,13 +152,15 @@ typedef struct sigaltstack {
>>> size_t ss_size; /* Stack size. */
>>> } stack_t;
>>>
>>> +#if __POSIX_VISIBLE
>>> #define SIG_SETMASK 0 /* set mask with sigprocmask() */
>>> #define SIG_BLOCK 1 /* set of signals to block */
>>> #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
>>>
>>> int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
>>> +#endif
>>>
>>> -#if defined(_POSIX_THREADS)
>>> +#if __POSIX_VISIBLE >= 199506
>>> int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
>>> #endif
>>>
>>> @@ -168,10 +170,14 @@ int _EXFUN(_kill, (pid_t, int));
>>> #endif /* _COMPILING_NEWLIB */
>>> #endif /* __CYGWIN__ || __rtems__ */
>>>
>>> +#if __POSIX_VISIBLE
>>> int _EXFUN(kill, (pid_t, int));
>>> +#endif
>>>
>>> #if __BSD_VISIBLE || __XSI_VISIBLE >= 4
>>> int _EXFUN(killpg, (pid_t, int));
>>> +#endif
>>> +#if __POSIX_VISIBLE
>>> int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
>>> int _EXFUN(sigaddset, (sigset_t *, const int));
>>> int _EXFUN(sigdelset, (sigset_t *, const int));
>>> @@ -180,7 +186,7 @@ int _EXFUN(sigfillset, (sigset_t *));
>>> int _EXFUN(sigemptyset, (sigset_t *));
>>> int _EXFUN(sigpending, (sigset_t *));
>>> int _EXFUN(sigsuspend, (const sigset_t *));
>>> -int _EXFUN(sigpause, (int));
>>> +int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>>>
>>> #if !defined(__CYGWIN__) && !defined(__rtems__)
>>> /* These depend upon the type of sigset_t, which right now
>>> @@ -192,17 +198,21 @@ int _EXFUN(sigpause, (int));
>>> #define sigfillset(what) (*(what) = ~(0), 0)
>>> #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
>>> #endif /* !__CYGWIN__ && !__rtems__ */
>>> -#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 4 */
>>> +#endif /* __POSIX_VISIBLE */
>>> +
>>> +#if __BSD_VISIBLE
>>> +int _EXFUN(sigpause, (int));
>>> +#endif
>>>
>>> #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
>>> int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
>>> #endif
>>>
>>> -#if defined(_POSIX_THREADS)
>>> +#if __POSIX_VISIBLE >= 199506
>>> int _EXFUN(pthread_kill, (pthread_t thread, int sig));
>>> #endif
>>>
>>> -#if defined(_POSIX_REALTIME_SIGNALS)
>>> +#if __POSIX_VISIBLE >= 199309
>>>
>>> /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
>>> NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
>>> @@ -211,12 +221,10 @@ int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t
>>> *info));
>>> int _EXFUN(sigtimedwait,
>>> (const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
>>> );
>>> -int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>>> -
>>> /* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
>>> int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
>>>
>>> -#endif /* defined(_POSIX_REALTIME_SIGNALS) */
>>> +#endif /* __POSIX_VISIBLE >= 199309 */
>>>
>>> #if defined(___AM29K__)
>>> /* These all need to be defined for ANSI C, but I don't think they are
>>>
[-- Attachment #2: 0001-Fix-guard-for-siginfo_t-and-pthread_t-definition.patch --]
[-- Type: text/x-patch, Size: 3075 bytes --]
From 4e52fd754c2ed00f7cae12f9cdb5787145e95a1d Mon Sep 17 00:00:00 2001
From: Thomas Preud'homme <thomas.preudhomme@arm.com>
Date: Thu, 15 Jun 2017 14:09:39 +0100
Subject: [PATCH] Fix guard for siginfo_t and pthread_t definition
Commit 8a3b3bb4d7224d419cc1a4af60ccf7e70edc876b changed the guard on
some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
some use of siginfo_t and pthread_t became visible under configurations
where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
because the definition of those types are still unavailable.
This commit make those type definition visible for __POSIX_VISIBLE
configurations. This requires moving the siginfo_t definition out of the
RTEMS specific definitions in sys/signal.h while still guarding it
against cygwin case.
---
newlib/libc/include/sys/_pthreadtypes.h | 4 ++--
newlib/libc/include/sys/signal.h | 16 ++++++++++------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/newlib/libc/include/sys/_pthreadtypes.h b/newlib/libc/include/sys/_pthreadtypes.h
index b29f50c..75e9e1c 100644
--- a/newlib/libc/include/sys/_pthreadtypes.h
+++ b/newlib/libc/include/sys/_pthreadtypes.h
@@ -18,7 +18,7 @@
#ifndef _SYS__PTHREADTYPES_H_
#define _SYS__PTHREADTYPES_H_
-#if defined(_POSIX_THREADS)
+#if defined(_POSIX_THREADS) || __POSIX_VISIBLE >= 199506
#include <sys/sched.h>
@@ -195,7 +195,7 @@ typedef struct {
} pthread_once_t; /* dynamic package initialization */
#define _PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
-#endif /* defined(_POSIX_THREADS) */
+#endif /* defined(_POSIX_THREADS) || __POSIX_VISIBLE >= 199506 */
/* POSIX Barrier Types */
diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index da064cd..ab35718 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -18,9 +18,11 @@ extern "C" {
typedef __sigset_t sigset_t;
#endif
-#if defined(__rtems__)
+#if defined(__CYGWIN__)
+#include <cygwin/signal.h>
+#else
-#if defined(_POSIX_REALTIME_SIGNALS)
+#if defined(_POSIX_REALTIME_SIGNALS) || __POSIX_VISIBLE >= 199309
/* sigev_notify values
NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */
@@ -68,7 +70,9 @@ typedef struct {
int si_code; /* Cause of the signal */
union sigval si_value; /* Signal value */
} siginfo_t;
-#endif
+#endif /* defined(_POSIX_REALTIME_SIGNALS) || __POSIX_VISIBLE >= 199309 */
+
+#if defined(__rtems__)
/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
@@ -108,9 +112,8 @@ struct sigaction {
#define sa_sigaction _signal_handlers._sigaction
#endif
-#elif defined(__CYGWIN__)
-#include <cygwin/signal.h>
-#else
+#else /* defined(__rtems__) */
+
#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */
typedef void (*_sig_func_ptr)(int);
@@ -122,6 +125,7 @@ struct sigaction
int sa_flags;
};
#endif /* defined(__rtems__) */
+#endif /* defined(__CYGWIN__) */
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
/*
--
1.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Feature test macros overhaul: signal.h (part 3)
2017-06-15 14:20 ` Thomas Preudhomme
@ 2017-06-19 8:29 ` Thomas Preudhomme
2017-06-19 11:02 ` Corinna Vinschen
1 sibling, 0 replies; 8+ messages in thread
From: Thomas Preudhomme @ 2017-06-19 8:29 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 5086 bytes --]
Ping?
Best regards,
Thomas
On 15/06/17 15:20, Thomas Preudhomme wrote:
> Please find attached a proposed git-format patch fixing both these issues:
>
> Commit 8a3b3bb4d7224d419cc1a4af60ccf7e70edc876b changed the guard on
> some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
> some use of siginfo_t and pthread_t became visible under configurations
> where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
> because the definition of those types are still unavailable.
>
> This commit make those type definition visible for __POSIX_VISIBLE
> configurations. This requires moving the siginfo_t definition out of the
> RTEMS specific definitions in sys/signal.h while still guarding it
> against cygwin case.
>
> Best regards,
>
> Thomas
>
> On 15/06/17 13:52, Thomas Preudhomme wrote:
>> Actually siginfo_t is also a problem due to sigwaitinfo and sigtimedwait using
>> it, yet it's not defined.
>>
>> Best regards,
>>
>> Thomas
>>
>> On 15/06/17 10:48, Thomas Preudhomme wrote:
>>> Hi,
>>>
>>> This patch makes lots of function using pthread_t type visible when
>>> __POSIX_THREADS is not defined as long as __POSIX_VISIBLE is. However, the guard
>>> in sys/_pthreadtypes.h is still checking against __POSIX_THREADS. This leads to
>>> build failure on arm-none-eabi targets.
>>>
>>> Best regards,
>>>
>>> Thomas
>>>
>>> On 13/06/17 21:00, Yaakov Selkowitz wrote:
>>>> Notably, sigaction and friends are POSIX, but the form of sigpause
>>>> currently provided is BSD.
>>>>
>>>> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
>>>> ---
>>>> newlib/libc/include/sys/signal.h | 24 ++++++++++++++++--------
>>>> 1 file changed, 16 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/newlib/libc/include/sys/signal.h
>>>> b/newlib/libc/include/sys/signal.h
>>>> index 8d1b53fce..a56f18a1b 100644
>>>> --- a/newlib/libc/include/sys/signal.h
>>>> +++ b/newlib/libc/include/sys/signal.h
>>>> @@ -152,13 +152,15 @@ typedef struct sigaltstack {
>>>> size_t ss_size; /* Stack size. */
>>>> } stack_t;
>>>>
>>>> +#if __POSIX_VISIBLE
>>>> #define SIG_SETMASK 0 /* set mask with sigprocmask() */
>>>> #define SIG_BLOCK 1 /* set of signals to block */
>>>> #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
>>>>
>>>> int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
>>>> +#endif
>>>>
>>>> -#if defined(_POSIX_THREADS)
>>>> +#if __POSIX_VISIBLE >= 199506
>>>> int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
>>>> #endif
>>>>
>>>> @@ -168,10 +170,14 @@ int _EXFUN(_kill, (pid_t, int));
>>>> #endif /* _COMPILING_NEWLIB */
>>>> #endif /* __CYGWIN__ || __rtems__ */
>>>>
>>>> +#if __POSIX_VISIBLE
>>>> int _EXFUN(kill, (pid_t, int));
>>>> +#endif
>>>>
>>>> #if __BSD_VISIBLE || __XSI_VISIBLE >= 4
>>>> int _EXFUN(killpg, (pid_t, int));
>>>> +#endif
>>>> +#if __POSIX_VISIBLE
>>>> int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
>>>> int _EXFUN(sigaddset, (sigset_t *, const int));
>>>> int _EXFUN(sigdelset, (sigset_t *, const int));
>>>> @@ -180,7 +186,7 @@ int _EXFUN(sigfillset, (sigset_t *));
>>>> int _EXFUN(sigemptyset, (sigset_t *));
>>>> int _EXFUN(sigpending, (sigset_t *));
>>>> int _EXFUN(sigsuspend, (const sigset_t *));
>>>> -int _EXFUN(sigpause, (int));
>>>> +int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>>>>
>>>> #if !defined(__CYGWIN__) && !defined(__rtems__)
>>>> /* These depend upon the type of sigset_t, which right now
>>>> @@ -192,17 +198,21 @@ int _EXFUN(sigpause, (int));
>>>> #define sigfillset(what) (*(what) = ~(0), 0)
>>>> #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
>>>> #endif /* !__CYGWIN__ && !__rtems__ */
>>>> -#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 4 */
>>>> +#endif /* __POSIX_VISIBLE */
>>>> +
>>>> +#if __BSD_VISIBLE
>>>> +int _EXFUN(sigpause, (int));
>>>> +#endif
>>>>
>>>> #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
>>>> int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
>>>> #endif
>>>>
>>>> -#if defined(_POSIX_THREADS)
>>>> +#if __POSIX_VISIBLE >= 199506
>>>> int _EXFUN(pthread_kill, (pthread_t thread, int sig));
>>>> #endif
>>>>
>>>> -#if defined(_POSIX_REALTIME_SIGNALS)
>>>> +#if __POSIX_VISIBLE >= 199309
>>>>
>>>> /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
>>>> NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
>>>> @@ -211,12 +221,10 @@ int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t
>>>> *info));
>>>> int _EXFUN(sigtimedwait,
>>>> (const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
>>>> );
>>>> -int _EXFUN(sigwait, (const sigset_t *set, int *sig));
>>>> -
>>>> /* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
>>>> int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
>>>>
>>>> -#endif /* defined(_POSIX_REALTIME_SIGNALS) */
>>>> +#endif /* __POSIX_VISIBLE >= 199309 */
>>>>
>>>> #if defined(___AM29K__)
>>>> /* These all need to be defined for ANSI C, but I don't think they are
>>>>
[-- Attachment #2: 0001-Fix-guard-for-siginfo_t-and-pthread_t-definition.patch --]
[-- Type: text/x-patch, Size: 3075 bytes --]
From 4e52fd754c2ed00f7cae12f9cdb5787145e95a1d Mon Sep 17 00:00:00 2001
From: Thomas Preud'homme <thomas.preudhomme@arm.com>
Date: Thu, 15 Jun 2017 14:09:39 +0100
Subject: [PATCH] Fix guard for siginfo_t and pthread_t definition
Commit 8a3b3bb4d7224d419cc1a4af60ccf7e70edc876b changed the guard on
some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
some use of siginfo_t and pthread_t became visible under configurations
where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
because the definition of those types are still unavailable.
This commit make those type definition visible for __POSIX_VISIBLE
configurations. This requires moving the siginfo_t definition out of the
RTEMS specific definitions in sys/signal.h while still guarding it
against cygwin case.
---
newlib/libc/include/sys/_pthreadtypes.h | 4 ++--
newlib/libc/include/sys/signal.h | 16 ++++++++++------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/newlib/libc/include/sys/_pthreadtypes.h b/newlib/libc/include/sys/_pthreadtypes.h
index b29f50c..75e9e1c 100644
--- a/newlib/libc/include/sys/_pthreadtypes.h
+++ b/newlib/libc/include/sys/_pthreadtypes.h
@@ -18,7 +18,7 @@
#ifndef _SYS__PTHREADTYPES_H_
#define _SYS__PTHREADTYPES_H_
-#if defined(_POSIX_THREADS)
+#if defined(_POSIX_THREADS) || __POSIX_VISIBLE >= 199506
#include <sys/sched.h>
@@ -195,7 +195,7 @@ typedef struct {
} pthread_once_t; /* dynamic package initialization */
#define _PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
-#endif /* defined(_POSIX_THREADS) */
+#endif /* defined(_POSIX_THREADS) || __POSIX_VISIBLE >= 199506 */
/* POSIX Barrier Types */
diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index da064cd..ab35718 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -18,9 +18,11 @@ extern "C" {
typedef __sigset_t sigset_t;
#endif
-#if defined(__rtems__)
+#if defined(__CYGWIN__)
+#include <cygwin/signal.h>
+#else
-#if defined(_POSIX_REALTIME_SIGNALS)
+#if defined(_POSIX_REALTIME_SIGNALS) || __POSIX_VISIBLE >= 199309
/* sigev_notify values
NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */
@@ -68,7 +70,9 @@ typedef struct {
int si_code; /* Cause of the signal */
union sigval si_value; /* Signal value */
} siginfo_t;
-#endif
+#endif /* defined(_POSIX_REALTIME_SIGNALS) || __POSIX_VISIBLE >= 199309 */
+
+#if defined(__rtems__)
/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
@@ -108,9 +112,8 @@ struct sigaction {
#define sa_sigaction _signal_handlers._sigaction
#endif
-#elif defined(__CYGWIN__)
-#include <cygwin/signal.h>
-#else
+#else /* defined(__rtems__) */
+
#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */
typedef void (*_sig_func_ptr)(int);
@@ -122,6 +125,7 @@ struct sigaction
int sa_flags;
};
#endif /* defined(__rtems__) */
+#endif /* defined(__CYGWIN__) */
#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809
/*
--
1.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Feature test macros overhaul: signal.h (part 3)
2017-06-15 14:20 ` Thomas Preudhomme
2017-06-19 8:29 ` Thomas Preudhomme
@ 2017-06-19 11:02 ` Corinna Vinschen
1 sibling, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2017-06-19 11:02 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 816 bytes --]
On Jun 15 15:20, Thomas Preudhomme wrote:
> Please find attached a proposed git-format patch fixing both these issues:
>
> Commit 8a3b3bb4d7224d419cc1a4af60ccf7e70edc876b changed the guard on
> some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence,
> some use of siginfo_t and pthread_t became visible under configurations
> where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails
> because the definition of those types are still unavailable.
>
> This commit make those type definition visible for __POSIX_VISIBLE
> configurations. This requires moving the siginfo_t definition out of the
> RTEMS specific definitions in sys/signal.h while still guarding it
> against cygwin case.
Pushed.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-06-19 11:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-13 20:00 [PATCH] stdio.h: guard function macros with !__cplusplus Yaakov Selkowitz
2017-06-13 20:01 ` [PATCH] Feature test macros overhaul: signal.h (part 3) Yaakov Selkowitz
2017-06-15 9:48 ` Thomas Preudhomme
2017-06-15 12:52 ` Thomas Preudhomme
2017-06-15 14:20 ` Thomas Preudhomme
2017-06-19 8:29 ` Thomas Preudhomme
2017-06-19 11:02 ` Corinna Vinschen
2017-06-14 8:48 ` [PATCH] stdio.h: guard function macros with !__cplusplus Corinna Vinschen
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).