When building a testdir with C++ tests on MSVC 14, I see this error: source='../../gltests/test-pthread-c++.cc' object='test-pthread-c++.obj' libtool=no \ DEPDIR=.deps depmode=msvc7 /bin/sh ../../build-aux/depcomp \ /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc64/include -MD -c -o test-pthread-c++.obj `cygpath -w '../../gltests/test-pthread-c++.cc'` test-pthread-c++.cc ../gllib\pthread.h(1201): error C3829: standard attribute 'noreturn' may only be applied to functions make[4]: *** [Makefile:9886: test-pthread-c++.obj] Error 2
This patch fixes it. 2019-12-11 Bruno Haible <br...@clisp.org> pthread-thread: Fix compilation error in C++ mode on MSVC. * lib/pthread.in.h (pthread_exit): Don't use _Noreturn in the _GL_CXXALIAS_RPL invocation. diff --git a/lib/pthread.in.h b/lib/pthread.in.h index a70d023..a6fb3d9 100644 --- a/lib/pthread.in.h +++ b/lib/pthread.in.h @@ -684,7 +684,7 @@ _GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - " # define pthread_exit rpl_pthread_exit # endif _GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value)); -_GL_CXXALIAS_RPL (pthread_exit, _Noreturn void, (void *value)); +_GL_CXXALIAS_RPL (pthread_exit, void, (void *value)); # else # if !@HAVE_PTHREAD_EXIT@ _GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value));