Support nested #pragma GCC suppress_coverage
Nested #pragma GCC suppress_coverage directives are now supported without warnings.
The compiler now supports nesting #pragma GCC suppress_coverage directives. Previously, nested directives triggered a warning, but this has been removed to accommodate legitimate use cases such as custom assert macros within code that is already suppressed for coverage. This change allows for more flexible control over which code regions are excluded from coverage reporting.
In Details
The warning emitted by handle_pragma_suppress_coverage for nested begin directives has been removed. The suppress_coverage_begin function in profile.cc now unconditionally pushes a new range, and suppress_coverage_end searches for the last unclosed item. This change simplifies handling of scenarios like macro expansions that effectively nest suppression pragmas, such as custom assert macros or recursive preprocessor expansions, without generating spurious warnings.
- #pragma GCC suppress_coverage
- A GCC-specific pragma directive used to exclude specific code regions from code coverage analysis.
- code coverage
- A metric that measures which lines of source code are executed during testing.
- nesting
- The practice of placing one construct inside another of the same type. In this context, it means placing one suppress_coverage pragma inside another.
- macro expansion
- The process by which a preprocessor replaces a macro invocation with its defined body.