diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-10-06 12:43:15 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2021-10-06 12:43:15 +0000 |
commit | e61f7842ffb8c6b0413c386c13b75f4716ab8883 (patch) | |
tree | 9ccdaa052a933c5547e1930f302ee6e43956767c /regress/misc | |
parent | 817d2ef15a8c0e11944437b754913c6c24975dd7 (diff) |
GCC 4.2.1 does not support nullptr, use traditional NULL.
Linker requires explicit libpthread.
Diffstat (limited to 'regress/misc')
-rw-r--r-- | regress/misc/exceptions/threads/Makefile | 4 | ||||
-rw-r--r-- | regress/misc/exceptions/threads/exceptions.cc | 14 |
2 files changed, 10 insertions, 8 deletions
diff --git a/regress/misc/exceptions/threads/Makefile b/regress/misc/exceptions/threads/Makefile index aa9e2e6ffda..936f828a0fa 100644 --- a/regress/misc/exceptions/threads/Makefile +++ b/regress/misc/exceptions/threads/Makefile @@ -1,7 +1,9 @@ -# $OpenBSD: Makefile,v 1.2 2021/02/21 19:21:15 tb Exp $ +# $OpenBSD: Makefile,v 1.3 2021/10/06 12:43:14 bluhm Exp $ PROG= exceptions SRCS= exceptions.cc +LDADD= -lpthread +DPADD= ${LIBPTHREAD} REGRESS_TARGETS=runs diff --git a/regress/misc/exceptions/threads/exceptions.cc b/regress/misc/exceptions/threads/exceptions.cc index a29ac883d2a..7f3ea975c1f 100644 --- a/regress/misc/exceptions/threads/exceptions.cc +++ b/regress/misc/exceptions/threads/exceptions.cc @@ -1,4 +1,4 @@ -/* $OpenBSD: exceptions.cc,v 1.1 2021/02/20 19:05:28 otto Exp $ */ +/* $OpenBSD: exceptions.cc,v 1.2 2021/10/06 12:43:14 bluhm Exp $ */ /* * Written by Otto Moerbeek <otto@drijf.net> 2021 Public Domain */ @@ -13,7 +13,7 @@ a() { try { throw std::string("foo"); - } + } catch (const std::string& ex) { if (ex != "foo") errx(1, "foo"); @@ -30,7 +30,7 @@ void * c(void *) { b(); - return nullptr; + return NULL; } #define N 100 @@ -42,11 +42,11 @@ main() pthread_t p[N]; for (i = 0; i < N; i++) - if (pthread_create(&p[i], nullptr, c, nullptr) != 0) - err(1, nullptr); + if (pthread_create(&p[i], NULL, c, NULL) != 0) + err(1, NULL); for (i = 0; i < N; i++) - if (pthread_join(p[i], nullptr) != 0) - err(1, nullptr); + if (pthread_join(p[i], NULL) != 0) + err(1, NULL); std::cout << "."; return 0; } |