Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
Deprecation Severity Controls

Drake provides mechanisms to control the severity of deprecated API usage at both compile time and at runtime.

Compile time

To promote compile-time deprecation warnings to errors, build with -Werror=deprecated-declarations. To silence them, define the preprocessor symbol DRAKE_DEPRECATION_IS_SILENT.

Bazel (add to .bazelrc):

build --copt=-Werror=deprecated-declarations # promote to error
# or:
build --copt=-DDRAKE_DEPRECATION_IS_SILENT # silence

CMake:

add_compile_options(-Werror=deprecated-declarations) # promote to error
# or:
add_compile_definitions(DRAKE_DEPRECATION_IS_SILENT) # silence

Runtime

Runtime deprecation warnings can be controlled via the DRAKE_DEPRECATION_RUNTIME_SEVERITY environment variable:

  • "error" — deprecation warnings are thrown as exceptions instead of logged.
  • "ignore" — deprecation warnings are silently discarded.
  • unset — deprecation warnings are logged normally.

Setting the variable to an unrecognized value causes a one-time warning and falls back to the default behavior.

This setting governs all Python deprecation warnings, and a small percentage of C++ deprecation warnings that cannot be expressed at compile-time.