summaryrefslogtreecommitdiffstats
path: root/Documentation/conf.py
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-09-28 09:42:44 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-10-15 07:49:45 +0200
commitb34b86d7a418f38c0b2e6eee1c03f81dfcee099a (patch)
treeeeb0d2436abefe69367588cba0c81af59c61bf2c /Documentation/conf.py
parentdocs: basics.rst: avoid duplicated C function declaration (diff)
downloadlinux-b34b86d7a418f38c0b2e6eee1c03f81dfcee099a.tar.xz
linux-b34b86d7a418f38c0b2e6eee1c03f81dfcee099a.zip
docs: conf.py: fix c:function support with Sphinx 3.x
Sphinx C parser for the C domain is now more pedantic when trying to identify the function types. That prevents scope macros to be used as type defines. Yet, since 3.0.2, it is possible to provide it a list of such macros. Add them, in order to solve several Sphinx 3.x warnings. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'Documentation/conf.py')
-rw-r--r--Documentation/conf.py65
1 files changed, 62 insertions, 3 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 0a102d57437d..e1b16556e378 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -47,9 +47,68 @@ extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
#
if major >= 3:
sys.stderr.write('''WARNING: The kernel documentation build process
- does not work correctly with Sphinx v3.0 and above. Expect errors
- in the generated output.
- ''')
+ does not work correctly with Sphinx v3.0 and above. Expect errors
+ in the generated output.
+ ''')
+ if minor > 0 or patch >= 2:
+ # Sphinx c function parser is more pedantic with regards to type
+ # checking. Due to that, having macros at c:function cause problems.
+ # Those needed to be scaped by using c_id_attributes[] array
+ c_id_attributes = [
+ # GCC Compiler types not parsed by Sphinx:
+ "__restrict__",
+
+ # include/linux/compiler_types.h:
+ "__iomem",
+ "__kernel",
+ "noinstr",
+ "notrace",
+ "__percpu",
+ "__rcu",
+ "__user",
+
+ # include/linux/compiler_attributes.h:
+ "__alias",
+ "__aligned",
+ "__aligned_largest",
+ "__always_inline",
+ "__assume_aligned",
+ "__cold",
+ "__attribute_const__",
+ "__copy",
+ "__pure",
+ "__designated_init",
+ "__visible",
+ "__printf",
+ "__scanf",
+ "__gnu_inline",
+ "__malloc",
+ "__mode",
+ "__no_caller_saved_registers",
+ "__noclone",
+ "__nonstring",
+ "__noreturn",
+ "__packed",
+ "__pure",
+ "__section",
+ "__always_unused",
+ "__maybe_unused",
+ "__used",
+ "__weak",
+ "noinline",
+
+ # include/linux/memblock.h:
+ "__init_memblock",
+ "__meminit",
+
+ # include/linux/init.h:
+ "__init",
+ "__ref",
+
+ # include/linux/linkage.h:
+ "asmlinkage",
+ ]
+
else:
extensions.append('cdomain')