diff --git a/AUTHORS.rst b/AUTHORS.rst index ea363fd118f..892ae9471fc 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -113,6 +113,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 792f6ce2201..43bffd04001 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -68,6 +68,9 @@ Features added Patch by Jean-François B. * #13508: Initial support for :pep:`695` type aliases. Patch by Martin Matouš, Jeremy Maitin-Shepard, and Adam Turner. +* #13894: Add ``source_parser`` type to :confval:`suppress_warnings` for grouping + issues related to the ``c`` and ``cpp`` source parsers. + Patch by Valentin H. Bugs fixed ---------- diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index ff903fa4f6c..ced4cc5fbd5 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_parser.c`` + * ``source_parser.cpp`` * ``toc.circular`` * ``toc.duplicate_entry`` * ``toc.empty_glob`` diff --git a/sphinx/util/cfamily.py b/sphinx/util/cfamily.py index 6071d90cf74..9d1f300d497 100644 --- a/sphinx/util/cfamily.py +++ b/sphinx/util/cfamily.py @@ -356,7 +356,10 @@ def fail(self, msg: str) -> NoReturn: 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_parser', subtype=subtype + ) def match(self, regex: re.Pattern[str]) -> bool: match = regex.match(self.definition, self.pos)