bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#70935: Support C++17 compilers in the C++ tests


From: Bruno Haible
Subject: bug#70935: Support C++17 compilers in the C++ tests
Date: Tue, 14 May 2024 14:05:25 +0200

Hi,

Running the libtool tests on Ubuntu 22.04, I saw this test output:

  Constructors.

  142: C++ static constructors                         ok
  143: C++ exception handling                          skipped 
(exceptions.at:361)

It sounds odd that a C++ test gets skipped when a perfectly fine C++ compiler
is present. So I investigated...

The log file of the respective test is:

--------------------------------------------------------------------------------
#                             -*- compilation -*-
143. exceptions.at:24: testing C++ exception handling ...
./exceptions.at:33: case $LIBLTDL in #(
 */_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
esac
stdout:
./exceptions.at:361: $CXX $CPPFLAGS $CXXFLAGS -DUSING_COMMON_DLL 
-DUSING_MODULE_DLL -DUSING_LIB_DLL -c main.cpp || exit 77
stderr:
In file included from main.cpp:7:
lib.h:30:26: error: ISO C++17 does not allow dynamic exception specifications
   30 | int LIB_IMPEXP libfoo () throw (libexc);
      |                          ^~~~~
In file included from main.cpp:8:
module.h:17:40: error: ISO C++17 does not allow dynamic exception specifications
   17 | extern "C" int MODULE_IMPEXP modfoo () throw (modexc);
      |                                        ^~~~~
main.cpp:22:16: error: ISO C++17 does not allow dynamic exception specifications
   22 | int foo (void) throw (exc)
      |                ^~~~~
stdout:
143. exceptions.at:24: 143. C++ exception handling (exceptions.at:24): skipped 
(exceptions.at:361)
--------------------------------------------------------------------------------

The problem is apparently that the test uses old syntax that was deprecated
in C++11 and removed in C++17 [1]. The new syntax is described in [2].

The attached patch fixes it.

[1] https://en.cppreference.com/w/cpp/language/except_spec
[2] https://en.cppreference.com/w/cpp/language/noexcept_spec

Attachment: 0001-Support-C-17-compilers-in-the-C-tests.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]