After upgrading to 1.29.0, building with -fno-exceptions fails with the following errors:
[ 50%] Building CXX object sdk/src/configuration/CMakeFiles/opentelemetry_configuration_core.dir/document_node.cc.o
/home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.29.0/sdk/src/configuration/document_node.cc: In member function ‘std::string opentelemetry::v1::sdk::configuration::DocumentNode::DoOneSubstitution(const std::string&) const’:
/home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.29.0/sdk/src/configuration/document_node.cc:116:53: error: exception handling disabled, use ‘-fexceptions’ to enable
116 | throw InvalidSchemaException(Location(), message);
| ^
/home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.29.0/sdk/src/configuration/document_node.cc: In member function ‘int64_t opentelemetry::v1::sdk::configuration::DocumentNode::SignedIntegerFromString(const std::string&) const’:
/home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.29.0/sdk/src/configuration/document_node.cc:269:3: error: ‘...’ handler must be the last handler for its try block [-fpermissive]
269 | catch (const std::invalid_argument &)
| ^~~~~
/home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.29.0/sdk/src/configuration/document_node.cc: In member function ‘bool opentelemetry::v1::sdk::configuration::DocumentNode::BooleanFromString(const std::string&) const’:
/home/runner/work/cmake-toolset/cmake-toolset/test/third_party/packages/opentelemetry-cpp-v1.29.0/sdk/src/configuration/document_node.cc:238:1: warning: control reaches end of non-void function [-Wreturn-type]
238 | }
| ^
gmake[2]: *** [sdk/src/configuration/CMakeFiles/opentelemetry_configuration_core.dir/build.make:79: sdk/src/configuration/CMakeFiles/opentelemetry_configuration_core.dir/document_node.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:923: sdk/src/configuration/CMakeFiles/opentelemetry_configuration_core.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
'/usr/local/bin/cmake' '--build' '.' '--verbose'
Change Dir: '/home/runner/work/cmake-toolset/cmake-toolset/test/build_jobs_dir/_deps/opentelemetry_cpp-v1.29.0/linux-x86_64-gnu-13'
It looks like much of the code in the configuration module isn't guarded by OPENTELEMETRY_HAVE_EXCEPTIONS. Are exceptions now a hard requirement, or can I raise to a PR fixing this?
If a fix is welcome, I can see a few possible approaches:
- Replace all
throw XXXException statements with std::abort() when exceptions are disabled.
- Disable the configuration module entirely when exceptions are disabled.
- Rework the configuration APIs that currently throw so they report failures to the caller (e.g., via a status/result type), and log the original exception message to the global logger.It may changes a lot of APIs.
Which approach would you prefer? I'm happy to put together a PR once we agree on the direction.
After upgrading to 1.29.0, building with
-fno-exceptionsfails with the following errors:It looks like much of the code in the configuration module isn't guarded by
OPENTELEMETRY_HAVE_EXCEPTIONS. Are exceptions now a hard requirement, or can I raise to a PR fixing this?If a fix is welcome, I can see a few possible approaches:
throw XXXExceptionstatements withstd::abort()when exceptions are disabled.Which approach would you prefer? I'm happy to put together a PR once we agree on the direction.