Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: automarkup.py: Fix regexes to solve sphinx 3 warnings

With the transition to Sphinx 3, new warnings were generated by
automarkup, exposing bugs in the regexes.

The warnings were caused by the expressions matching words in the
translated versions of the documentation, since any unicode character
was matched.

Fix the regular expression by making the C regexes use ASCII and
ensuring the expressions only match the beginning of words,
in order to avoid warnings like this:

WARNING: Unparseable C cross-reference: '调用debugfs_rename'

That's probably due to the lack of using spaces between words
on Chinese.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Nícolas F. R. A. Prado and committed by
Mauro Carvalho Chehab
f66e47f9 06dc65b0

+4 -3
+4 -3
Documentation/sphinx/automarkup.py
··· 22 22 # :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last 23 23 # bit tries to restrict matches to things that won't create trouble. 24 24 # 25 - RE_function = re.compile(r'(([\w_][\w\d_]+)\(\))') 25 + RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=re.ASCII) 26 26 27 27 # 28 28 # Sphinx 2 uses the same :c:type role for struct, union, enum and typedef 29 29 # 30 - RE_generic_type = re.compile(r'(struct|union|enum|typedef)\s+([\w_][\w\d_]+)') 30 + RE_generic_type = re.compile(r'\b(struct|union|enum|typedef)\s+([a-zA-Z_]\w+)', 31 + flags=re.ASCII) 31 32 32 33 # 33 34 # Sphinx 3 uses a different C role for each one of struct, union, enum and ··· 43 42 # Detects a reference to a documentation page of the form Documentation/... with 44 43 # an optional extension 45 44 # 46 - RE_doc = re.compile(r'Documentation(/[\w\-_/]+)(\.\w+)*') 45 + RE_doc = re.compile(r'\bDocumentation(/[\w\-_/]+)(\.\w+)*') 47 46 48 47 # 49 48 # Many places in the docs refer to common system calls. It is