From: bluhm Date: Wed, 6 Oct 2021 12:43:14 +0000 (+0000) Subject: GCC 4.2.1 does not support nullptr, use traditional NULL. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=824adb5411e4389b29bae28eba5c2c2bbd147f34;p=openbsd GCC 4.2.1 does not support nullptr, use traditional NULL. Linker requires explicit libpthread. --- 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 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; }