Permit filtering warnings generated during source code parsing (#13894)

Co-authored-by: Valentin Heinisch <valentin.heinisch@vector.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-11-30 10:08:15 +00:00
1 parent 2d0a416c9b
commit a22dfabe03
4 files changed
+10 -1

No files matched your search

+1
View File
@@ -117,6 +117,7 @@ Contributors
* Thomas Waldmann -- apidoc module fixes
* Till Hoffmann -- doctest option to exit after first failed test
* Tim Hoffmann -- theme improvements
* Valentin Heinisch -- warning types improvement
* Victor Wheeler -- documentation improvements
* Vince Salvino -- JavaScript search improvements
* Will Maier -- directory HTML builder
+3
View File
@@ -102,6 +102,9 @@ Features added
Patch by Matthias Geier.
* #14029: intersphinx: Fix error in format string interpolation.
Patch by Matthieu de Cibeins.
* #13894: Add ``source_code_parser`` type to :confval:`suppress_warnings`
for grouping issues related to the C and C++ parsers.
Patch by Valentin H.
Bugs fixed
----------
+2
View File
@@ -1402,6 +1402,8 @@ Options for warning control
* ``ref.python``
* ``ref.ref``
* ``ref.term``
* ``source_code_parser.c``
* ``source_code_parser.cpp``
* ``toc.circular``
* ``toc.duplicate_entry``
* ``toc.empty_glob``
+4 -1
View File
@@ -356,7 +356,10 @@ class BaseParser:
raise self._make_multi_error(errors, '')
def warn(self, msg: str) -> None:
logger.warning(msg, location=self.location)
subtype = 'c' if self.language == 'C' else 'cpp'
logger.warning(
msg, location=self.location, type='source_code_parser', subtype=subtype
)
def match(self, regex: re.Pattern[str]) -> bool:
match = regex.match(self.definition, self.pos)