Skip to content

Conversation

@rsjbailey
Copy link
Contributor

…tom exceptions

Currently, on MSVC builds, we have a lot of warnings about the custom adm extensions being derived from std::exception, despite this being listed as a 'best practice' in the msvc documentation.

As these exceptions are defined in a header, this will not be an issue for direct consumers of libadm. We think this would only be an issue for transitive dependants if the direct dependent allows the exception definition to propogate out, and the ABI for std::exception changes, and the consumer is using a different version of the compiler than that with which is was built (or debug/release mismatch) - a combination which is fairly unlikely.

To err on the side of caution, this PR leaves the warnings enabled by default, but provides a cmake option that disables these warnings for this specific case. It also enables this option for CI builds, to avoid noise that might obscure more pertinent issues.

@rsjbailey rsjbailey force-pushed the optionally_silence_msvc_warnings branch from 550a077 to 1c5a4ad Compare September 13, 2022 12:11
target_link_libraries(adm PRIVATE $<BUILD_INTERFACE:rapidxml>)

if(ADM_DISABLE_MSVC_EXCEPTION_DLL_BOUNDARY_WARNINGS)
target_compile_options(adm PUBLIC $<$<CXX_COMPILER_ID:MSVC>:/DADM_DISABLE_MSVC_EXCEPTION_DLL_BOUNDARY_WARNINGS=1>)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please indent this, and maybe use target_compile_definitions? looks good otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants