[lkml]   [2018]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v4 12/13] Compiler Attributes: add Doc/process/programming-language.rst
Cc: Jonathan Corbet <>
Cc: Rasmus Villemoes <>
Cc: Luc Van Oostenryck <>
Cc: Eli Friedman <>
Cc: Christopher Li <>
Cc: Kees Cook <>
Cc: Ingo Molnar <>
Cc: Geert Uytterhoeven <>
Cc: Arnd Bergmann <>
Cc: Greg Kroah-Hartman <>
Cc: Masahiro Yamada <>
Cc: Joe Perches <>
Cc: Dominique Martinet <>
Cc: Nick Desaulniers <>
Cc: Linus Torvalds <>
Signed-off-by: Miguel Ojeda <>
Documentation/process/index.rst | 1 +
.../process/programming-language.rst | 45 +++++++++++++++++++
2 files changed, 46 insertions(+)
create mode 100644 Documentation/process/programming-language.rst

diff --git a/Documentation/process/index.rst b/Documentation/process/index.rst
index 37bd0628b6ee..c56f24a22d2a 100644
--- a/Documentation/process/index.rst
+++ b/Documentation/process/index.rst
@@ -23,6 +23,7 @@ Below are the essential guides that every developer should read.
+ programming-language
diff --git a/Documentation/process/programming-language.rst b/Documentation/process/programming-language.rst
new file mode 100644
index 000000000000..e5f5f065dc24
--- /dev/null
+++ b/Documentation/process/programming-language.rst
@@ -0,0 +1,45 @@
+.. _programming_language:
+Programming Language
+The kernel is written in the C programming language [c-language]_.
+More precisely, the kernel is typically compiled with ``gcc`` [gcc]_
+under ``-std=gnu89`` [gcc-c-dialect-options]_: the GNU dialect of ISO C90
+(including some C99 features).
+This dialect contains many extensions to the language [gnu-extensions]_,
+and many of them are used within the kernel as a matter of course.
+There is some support for compiling the kernel with ``clang`` [clang]_
+and ``icc`` [icc]_ for several of the architectures, although at the time
+of writing it is not completed, requiring third-party patches.
+One of the common extensions used throughout the kernel are attributes
+[gcc-attribute-syntax]_. Attributes allow to introduce
+implementation-defined semantics to language entities (like variables,
+functions or types) without having to make significant syntactic changes
+to the language (e.g. adding a new keyword) [n2049]_.
+In some cases, attributes are optional (i.e. a compiler not supporting them
+should still produce proper code, even if it is slower or does not perform
+as many compile-time checks/diagnostics).
+The kernel defines pseudo-keywords (e.g. ``__pure``) instead of using
+directly the GNU attribute syntax (e.g. ``__attribute__((__pure__))``)
+in order to feature detect which ones can be used and/or to shorten the code.
+Please refer to ``include/linux/compiler_attributes.h`` for more information.
+.. [c-language]
+.. [gcc]
+.. [clang]
+.. [icc]
+.. [gcc-c-dialect-options]
+.. [gnu-extensions]
+.. [gcc-attribute-syntax]
+.. [n2049]
 \ /
  Last update: 2018-09-08 23:26    [W:0.122 / U:1.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site