Discussion:
[PATCH] Drop non-reserved parameter names from sys/signal.h
Andy Koppe
2018-08-29 13:36:35 UTC
Permalink
Hi,

Standard headers shouldn't use non-reserved identifiers as parameter
names in function declarations, because programs could in theory
define macros with such names before including a header, which can
result in syntax errors. The patch below drops parameter names such as
"value" and "set" from libc/include/sys/signal.h (which is included by
the standard signal.h).

Kind regards,
Andy


diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index 7d0c59437..45cc0366c 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -161,11 +161,11 @@ typedef struct sigaltstack {
#define SIG_BLOCK 1 /* set of signals to block */
#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */

-int sigprocmask (int how, const sigset_t *set, sigset_t *oset);
+int sigprocmask (int, const sigset_t *, sigset_t *);
#endif

#if __POSIX_VISIBLE >= 199506
-int pthread_sigmask (int how, const sigset_t *set, sigset_t *oset);
+int pthread_sigmask (int, const sigset_t *, sigset_t *);
#endif

#ifdef _COMPILING_NEWLIB
@@ -188,7 +188,7 @@ int sigfillset (sigset_t *);
int sigemptyset (sigset_t *);
int sigpending (sigset_t *);
int sigsuspend (const sigset_t *);
-int sigwait (const sigset_t *set, int *sig);
+int sigwait (const sigset_t *, int *);

#if !defined(__CYGWIN__) && !defined(__rtems__)
/* These depend upon the type of sigset_t, which right now
@@ -223,7 +223,7 @@ int sigaltstack (const stack_t *__restrict,
stack_t *__restrict);
#endif

#if __POSIX_VISIBLE >= 199506
-int pthread_kill (pthread_t thread, int sig);
+int pthread_kill (pthread_t, int);
#endif

#if __POSIX_VISIBLE >= 199309
@@ -231,11 +231,10 @@ int pthread_kill (pthread_t thread, int sig);
/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
NOTE: P1003.1c/D10, p. 39 adds sigwait(). */

-int sigwaitinfo (const sigset_t *set, siginfo_t *info);
-int sigtimedwait (const sigset_t *set, siginfo_t *info,
- const struct timespec *timeout);
+int sigwaitinfo (const sigset_t *, siginfo_t *);
+int sigtimedwait (const sigset_t *, siginfo_t *, const struct timespec *);
/* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
-int sigqueue (pid_t pid, int signo, const union sigval value);
+int sigqueue (pid_t, int, const union sigval);

#endif /* __POSIX_VISIBLE >= 199309 */
Corinna Vinschen
2018-08-29 14:10:30 UTC
Permalink
Post by Andy Koppe
Hi,
Standard headers shouldn't use non-reserved identifiers as parameter
names in function declarations, because programs could in theory
define macros with such names before including a header, which can
result in syntax errors. The patch below drops parameter names such as
"value" and "set" from libc/include/sys/signal.h (which is included by
the standard signal.h).
The patch doesn't apply cleanly (MUA breaking it?). If in doubt,
please attach it to your mail.


Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Andy Koppe
2018-08-29 14:14:55 UTC
Permalink
Sorry. Patch attached.
Post by Corinna Vinschen
Post by Andy Koppe
Hi,
Standard headers shouldn't use non-reserved identifiers as parameter
names in function declarations, because programs could in theory
define macros with such names before including a header, which can
result in syntax errors. The patch below drops parameter names such as
"value" and "set" from libc/include/sys/signal.h (which is included by
the standard signal.h).
The patch doesn't apply cleanly (MUA breaking it?). If in doubt,
please attach it to your mail.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Corinna Vinschen
2018-08-29 14:24:00 UTC
Permalink
Post by Andy Koppe
Sorry. Patch attached.
Thanks, but... can you please attach it in `git format-patch' format?

Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Andy Koppe
2018-08-29 14:51:38 UTC
Permalink
Post by Corinna Vinschen
Post by Andy Koppe
Sorry. Patch attached.
Thanks, but... can you please attach it in `git format-patch' format?
Please find an attempt attached.
Corinna Vinschen
2018-08-29 15:59:33 UTC
Permalink
Post by Andy Koppe
Post by Corinna Vinschen
Post by Andy Koppe
Sorry. Patch attached.
Thanks, but... can you please attach it in `git format-patch' format?
Please find an attempt attached.
Pushed.


Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Loading...