diff --git a/AUTHORS.rst b/AUTHORS.rst index 04995b3e12..4646facb23 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -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 diff --git a/CHANGES.rst b/CHANGES.rst index 57b5a3d872..bc8f7060e6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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 ---------- diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 8608a53422..70de2ca3c1 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -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`` diff --git a/sphinx/util/cfamily.py b/sphinx/util/cfamily.py index 6071d90cf7..7e7bcc1a4e 100644 --- a/sphinx/util/cfamily.py +++ b/sphinx/util/cfamily.py @@ -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)