[compiler-rt] 40ec592 - [NFC] Fix test build breakage on Darwin
Shu-Chun Weng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 22 14:18:22 PDT 2021
Author: Shu-Chun Weng
Date: 2021-07-22T14:18:13-07:00
New Revision: 40ec59227a1c954d4182f528943fc8f28cff2302
URL: https://github.com/llvm/llvm-project/commit/40ec59227a1c954d4182f528943fc8f28cff2302
DIFF: https://github.com/llvm/llvm-project/commit/40ec59227a1c954d4182f528943fc8f28cff2302.diff
LOG: [NFC] Fix test build breakage on Darwin
Added:
Modified:
compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp
index f5351b01ac00..e96717f3b267 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/signal.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -std=c++11 -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <climits>
@@ -49,21 +49,28 @@ void signal_action_handler(int, siginfo_t*, void*) {}
void test_signal_custom() {
for (int signum : std_signals) {
- sighandler_t ret = signal(signum, &signal_handler);
+ auto* ret = signal(signum, &signal_handler);
assert(ret != SIG_ERR);
}
+#ifdef SIGRTMIN
for (int signum = SIGRTMIN; signum <= SIGRTMAX; ++signum) {
- sighandler_t ret = signal(signum, &signal_handler);
+ auto* ret = signal(signum, &signal_handler);
assert(ret != SIG_ERR);
}
+#endif
for (int signum : no_change_act_signals) {
- sighandler_t ret = signal(signum, &signal_handler);
+ auto* ret = signal(signum, &signal_handler);
int err = errno;
assert(ret == SIG_ERR);
assert(err == EINVAL);
}
- for (int signum : { 0, SIGRTMAX + 1, INT_MAX}) {
- sighandler_t ret = signal(signum, &signal_handler);
+ for (int signum : {
+ 0,
+#ifdef SIGRTMAX
+ SIGRTMAX + 1,
+#endif
+ INT_MAX}) {
+ auto* ret = signal(signum, &signal_handler);
int err = errno;
assert(ret == SIG_ERR);
assert(err == EINVAL);
@@ -72,25 +79,32 @@ void test_signal_custom() {
void test_signal_ignore() {
for (int signum : std_signals) {
- sighandler_t ret = signal(signum, SIG_IGN);
+ auto* ret = signal(signum, SIG_IGN);
if (signum != SIGCHLD) {
// POSIX.1-1990 disallowed setting the action for SIGCHLD to SIG_IGN
// though POSIX.1-2001 and later allow this possibility.
assert(ret != SIG_ERR);
}
}
+#ifdef SIGRTMIN
for (int signum = SIGRTMIN; signum <= SIGRTMAX; ++signum) {
- sighandler_t ret = signal(signum, SIG_IGN);
+ auto* ret = signal(signum, SIG_IGN);
assert(ret != SIG_ERR);
}
+#endif
for (int signum : no_change_act_signals) {
- sighandler_t ret = signal(signum, SIG_IGN);
+ auto* ret = signal(signum, SIG_IGN);
int err = errno;
assert(ret == SIG_ERR);
assert(err == EINVAL);
}
- for (int signum : { 0, SIGRTMAX + 1, INT_MAX}) {
- sighandler_t ret = signal(signum, SIG_IGN);
+ for (int signum : {
+ 0,
+#ifdef SIGRTMAX
+ SIGRTMAX + 1,
+#endif
+ INT_MAX}) {
+ auto* ret = signal(signum, SIG_IGN);
int err = errno;
assert(ret == SIG_ERR);
assert(err == EINVAL);
@@ -99,15 +113,22 @@ void test_signal_ignore() {
void test_signal_default() {
for (int signum : std_signals) {
- sighandler_t ret = signal(signum, SIG_DFL);
+ auto* ret = signal(signum, SIG_DFL);
assert(ret != SIG_ERR);
}
+#ifdef SIGRTMIN
for (int signum = SIGRTMIN; signum <= SIGRTMAX; ++signum) {
- sighandler_t ret = signal(signum, SIG_DFL);
+ auto* ret = signal(signum, SIG_DFL);
assert(ret != SIG_ERR);
}
- for (int signum : { 0, SIGRTMAX + 1, INT_MAX}) {
- sighandler_t ret = signal(signum, SIG_DFL);
+#endif
+ for (int signum : {
+ 0,
+#ifdef SIGRTMAX
+ SIGRTMAX + 1,
+#endif
+ INT_MAX}) {
+ auto* ret = signal(signum, SIG_DFL);
int err = errno;
assert(ret == SIG_ERR);
assert(err == EINVAL);
@@ -125,17 +146,24 @@ void test_sigaction_custom() {
int ret = sigaction(signum, &act, &oldact);
assert(ret == 0);
}
+#ifdef SIGRTMIN
for (int signum = SIGRTMIN; signum <= SIGRTMAX; ++signum) {
int ret = sigaction(signum, &act, &oldact);
assert(ret == 0);
}
+#endif
for (int signum : no_change_act_signals) {
int ret = sigaction(signum, &act, &oldact);
int err = errno;
assert(ret == -1);
assert(err == EINVAL);
}
- for (int signum : { 0, SIGRTMAX + 1, INT_MAX}) {
+ for (int signum : {
+ 0,
+#ifdef SIGRTMAX
+ SIGRTMAX + 1,
+#endif
+ INT_MAX}) {
int ret = sigaction(signum, &act, &oldact);
int err = errno;
assert(ret == -1);
@@ -150,17 +178,24 @@ void test_sigaction_custom() {
int ret = sigaction(signum, &act, &oldact);
assert(ret == 0);
}
+#ifdef SIGRTMIN
for (int signum = SIGRTMIN; signum <= SIGRTMAX; ++signum) {
int ret = sigaction(signum, &act, &oldact);
assert(ret == 0);
}
+#endif
for (int signum : no_change_act_signals) {
int ret = sigaction(signum, &act, &oldact);
int err = errno;
assert(ret == -1);
assert(err == EINVAL);
}
- for (int signum : { 0, SIGRTMAX + 1, INT_MAX}) {
+ for (int signum : {
+ 0,
+#ifdef SIGRTMAX
+ SIGRTMAX + 1,
+#endif
+ INT_MAX}) {
int ret = sigaction(signum, &act, &oldact);
int err = errno;
assert(ret == -1);
@@ -183,17 +218,24 @@ void test_sigaction_ignore() {
assert(ret == 0);
}
}
+#ifdef SIGRTMIN
for (int signum = SIGRTMIN; signum <= SIGRTMAX; ++signum) {
int ret = sigaction(signum, &act, &oldact);
assert(ret == 0);
}
+#endif
for (int signum : no_change_act_signals) {
int ret = sigaction(signum, &act, &oldact);
int err = errno;
assert(ret == -1);
assert(err == EINVAL);
}
- for (int signum : { 0, SIGRTMAX + 1, INT_MAX}) {
+ for (int signum : {
+ 0,
+#ifdef SIGRTMAX
+ SIGRTMAX + 1,
+#endif
+ INT_MAX}) {
int ret = sigaction(signum, &act, &oldact);
int err = errno;
assert(ret == -1);
@@ -212,11 +254,18 @@ void test_sigaction_default() {
int ret = sigaction(signum, &act, &oldact);
assert(ret == 0);
}
+#ifdef SIGRTMIN
for (int signum = SIGRTMIN; signum <= SIGRTMAX; ++signum) {
int ret = sigaction(signum, &act, &oldact);
assert(ret == 0);
}
- for (int signum : { 0, SIGRTMAX + 1, INT_MAX}) {
+#endif
+ for (int signum : {
+ 0,
+#ifdef SIGRTMAX
+ SIGRTMAX + 1,
+#endif
+ INT_MAX}) {
int ret = sigaction(signum, &act, &oldact);
int err = errno;
assert(ret == -1);
More information about the llvm-commits
mailing list