18c2ecf20Sopenharmony_ci.. include:: ../disclaimer-ita.rst
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci:Original: :ref:`Documentation/process/programming-language.rst <programming_language>`
48c2ecf20Sopenharmony_ci:Translator: Federico Vaga <federico.vaga@vaga.pv.it>
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci.. _it_programming_language:
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciLinguaggio di programmazione
98c2ecf20Sopenharmony_ci============================
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciIl kernel è scritto nel linguaggio di programmazione C [it-c-language]_.
128c2ecf20Sopenharmony_ciPiù precisamente, il kernel viene compilato con ``gcc`` [it-gcc]_ usando
138c2ecf20Sopenharmony_cil'opzione ``-std=gnu89`` [it-gcc-c-dialect-options]_: il dialetto GNU
148c2ecf20Sopenharmony_cidello standard ISO C90 (con l'aggiunta di alcune funzionalità da C99)
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciQuesto dialetto contiene diverse estensioni al linguaggio [it-gnu-extensions]_,
178c2ecf20Sopenharmony_cie molte di queste vengono usate sistematicamente dal kernel.
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciIl kernel offre un certo livello di supporto per la compilazione con ``clang``
208c2ecf20Sopenharmony_ci[it-clang]_ e ``icc`` [it-icc]_ su diverse architetture, tuttavia in questo momento
218c2ecf20Sopenharmony_ciil supporto non è completo e richiede delle patch aggiuntive.
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciAttributi
248c2ecf20Sopenharmony_ci---------
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciUna delle estensioni più comuni e usate nel kernel sono gli attributi
278c2ecf20Sopenharmony_ci[it-gcc-attribute-syntax]_. Gli attributi permettono di aggiungere una semantica,
288c2ecf20Sopenharmony_cidefinita dell'implementazione, alle entità del linguaggio (come le variabili,
298c2ecf20Sopenharmony_cile funzioni o i tipi) senza dover fare importanti modifiche sintattiche al
308c2ecf20Sopenharmony_cilinguaggio stesso (come l'aggiunta di nuove parole chiave) [it-n2049]_.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciIn alcuni casi, gli attributi sono opzionali (ovvero un compilatore che non
338c2ecf20Sopenharmony_cidovesse supportarli dovrebbe produrre comunque codice corretto, anche se
348c2ecf20Sopenharmony_cipiù lento o che non esegue controlli aggiuntivi durante la compilazione).
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciIl kernel definisce alcune pseudo parole chiave (per esempio ``__pure``)
378c2ecf20Sopenharmony_ciin alternativa alla sintassi GNU per gli attributi (per esempio
388c2ecf20Sopenharmony_ci``__attribute__((__pure__))``) allo scopo di mostrare quali funzionalità si
398c2ecf20Sopenharmony_cipossono usare e/o per accorciare il codice.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciPer maggiori informazioni consultate il file d'intestazione
428c2ecf20Sopenharmony_ci``include/linux/compiler_attributes.h``.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci.. [it-c-language] http://www.open-std.org/jtc1/sc22/wg14/www/standards
458c2ecf20Sopenharmony_ci.. [it-gcc] https://gcc.gnu.org
468c2ecf20Sopenharmony_ci.. [it-clang] https://clang.llvm.org
478c2ecf20Sopenharmony_ci.. [it-icc] https://software.intel.com/en-us/c-compilers
488c2ecf20Sopenharmony_ci.. [it-gcc-c-dialect-options] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
498c2ecf20Sopenharmony_ci.. [it-gnu-extensions] https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html
508c2ecf20Sopenharmony_ci.. [it-gcc-attribute-syntax] https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
518c2ecf20Sopenharmony_ci.. [it-n2049] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2049.pdf
52