aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Documentation/translations/it_IT/process/coding-style.rst
diff options
context:
space:
mode:
authorFederico Vaga <federico.vaga@vaga.pv.it>2022-07-02 23:08:20 +0200
committerJonathan Corbet <corbet@lwn.net>2022-07-28 09:34:27 -0600
commitda1d9caf95def6f0320819cf941c9fd1069ba9e1 (patch)
treeaa59521036c2a301d0ff5ae84363857ea81c507b /Documentation/translations/it_IT/process/coding-style.rst
parentdocs: Remove spurious tag from admin-guide/mm/overcommit-accounting.rst (diff)
downloadwireguard-linux-da1d9caf95def6f0320819cf941c9fd1069ba9e1.tar.xz
wireguard-linux-da1d9caf95def6f0320819cf941c9fd1069ba9e1.zip
doc:it_IT: align Italian documentation
Translation for the following patches commit df05c0e9496c ("Documentation: Raise the minimum supported version of LLVM to 11.0.0") commit 333b11e541fe ("Documentation: Add minimum pahole version") commit 6d6a8d6a4ed0 ("docs: Update Sphinx requirements") commit 76ae847497bc ("Documentation: raise minimum supported version of GCC to 5.1") commit 59c6a716b14b ("Documentation/process/maintainer-pgp-guide: Replace broken link to PGP path finder") commit 85eafc63d032 ("docs: update file link location") commit 869f496e1aa6 ("docs: process: submitting-patches: Clarify the Reported-by usage") commit 6c5ccd24ff17 ("Remove mentions of the Trivial Patch Monkey") commit aa9b5e0df226 ("Documentation/process: fix self reference") commit b96ff02ab2be ("Documentation/process: fix a cross reference") commit 1f57bd42b77c ("docs: submitting-patches: make section about the Link: tag more explicit") commit a9d85efb25fb ("docs: use the lore redirector everywhere") commit 31c9d7c82975 ("Documentation/process: Add tip tree handbook") commit 604370e106cc ("Documentation/process: Add maintainer handbooks section") commit bf33a9d42d0c ("docs: 5.Posting.rst: describe Fixes: and Link: tags") commit c04639a7d2fb ("coding-style.rst: trivial: fix location of driver model macros") commit d5b421fe0282 ("docs: Explain the desired position of function attributes") commit 3577cdb23b8f ("docs: deprecated.rst: Clarify open-coded arithmetic with literals") commit db67eb748e7a ("docs: discourage use of list tables") commit 0e805b118662 ("docs: address some text issues with css/theme support") commit 135707d3765e ("docs: allow to pass extra DOCS_CSS themes via make") commit fe450eeb4e6f ("Documentation: in_irq() cleanup") commit 10855b45a428 ("docs: fix typo in Documentation/kernel-hacking/locking.rst") commit bc67f1c454fb ("docs: futex: Fix kernel-doc references") commit abf36fe0be7d ("docs: kernel-hacking: Remove inappropriate text") commit f35cf1a59e9a ("Documentation: kernel-hacking: minor edits for style") commit f35cf1a59e9a ("Documentation: kernel-hacking: minor edits for style") commit 980c3799c500 ("Documentation: kernel-doc: Promote two chapter headings to page title") commit e1be43d9b5d0 ("overflow: Implement size_t saturating arithmetic helpers") commit 615f3eea0d5f ("Documentation: add note block surrounding security patch note") commit 587d39b260c4 ("Documentation: add link to stable release candidate tree") commit 555d44932c67 ("Documentation: update stable tree link") commit 88d99e870143 ("Documentation: update stable review cycle documentation") commit 0c603a5c704f ("Documentation/process: mention patch changelog in review process") commit 6d5aa418b3bd ("docs: submitting-patches: Fix crossref to 'The canonical patch format'") commit f1a693994b1c ("Documentation/process: use scripts/get_maintainer.pl on patches") commit 69ef0920bdd3 ("Docs: Add cpio requirement to changes.rst") commit 5a5866c28b43 ("Docs: Replace version by 'current' in changes.rst") commit 9b5a7f4a2a8d ("x86/configs: Add x86 debugging Kconfig fragment plus docs") commit f1a693994b1c ("Documentation/process: use scripts/get_maintainer.pl on patches") commit e8c07082a810 ("Kbuild: move to -std=gnu11") Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it> Link: https://lore.kernel.org/r/20220702210820.13118-1-federico.vaga@vaga.pv.it Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/translations/it_IT/process/coding-style.rst')
-rw-r--r--Documentation/translations/it_IT/process/coding-style.rst42
1 files changed, 40 insertions, 2 deletions
diff --git a/Documentation/translations/it_IT/process/coding-style.rst b/Documentation/translations/it_IT/process/coding-style.rst
index ecc74ba50d3e..a393ee4182af 100644
--- a/Documentation/translations/it_IT/process/coding-style.rst
+++ b/Documentation/translations/it_IT/process/coding-style.rst
@@ -466,14 +466,52 @@ la riga della parentesi graffa di chiusura. Ad esempio:
}
EXPORT_SYMBOL(system_is_up);
+6.1) Prototipi di funzione
+**************************
+
Nei prototipi di funzione, includete i nomi dei parametri e i loro tipi.
Nonostante questo non sia richiesto dal linguaggio C, in Linux viene preferito
perché è un modo semplice per aggiungere informazioni importanti per il
lettore.
-Non usate la parola chiave ``extern`` coi prototipi di funzione perché
+Non usate la parola chiave ``extern`` con le dichiarazioni di funzione perché
rende le righe più lunghe e non è strettamente necessario.
+Quando scrivete i prototipi di funzione mantenete `l'ordine degli elementi <https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/>`_.
+
+Prendiamo questa dichiarazione di funzione come esempio::
+
+ __init void * __must_check action(enum magic value, size_t size, u8 count,
+ char *fmt, ...) __printf(4, 5) __malloc;
+
+L'ordine suggerito per gli elementi di un prototipo di funzione è il seguente:
+
+- classe d'archiviazione (in questo caso ``static __always_inline``. Da notare
+ che ``__always_inline`` è tecnicamente un attributo ma che viene trattato come
+ ``inline``)
+- attributi della classe di archiviazione (in questo caso ``__init``, in altre
+ parole la sezione, ma anche cose tipo ``__cold``)
+- il tipo di ritorno (in questo caso, ``void *``)
+- attributi per il valore di ritorno (in questo caso, ``__must_check``)
+- il nome della funzione (in questo caso, ``action``)
+- i parametri della funzione(in questo caso,
+ ``(enum magic value, size_t size, u8 count, char *fmt, ...)``,
+ da notare che va messo anche il nome del parametro)
+- attributi dei parametri (in questo caso, ``__printf(4, 5)``)
+- attributi per il comportamento della funzione (in questo caso, ``__malloc_``)
+
+Notate che per la **definizione** di una funzione (il altre parole il corpo
+della funzione), il compilatore non permette di usare gli attributi per i
+parametri dopo i parametri. In questi casi, devono essere messi dopo gli
+attributi della classe d'archiviazione (notate che la posizione di
+``__printf(4,5)`` cambia rispetto alla **dichiarazione**)::
+
+ static __always_inline __init __printf(4, 5) void * __must_check action(enum magic value,
+ size_t size, u8 count, char *fmt, ...) __malloc
+ {
+ ...
+ }*)**``)**``)``)``*)``)``)``)``*``)``)``)*)
+
7) Centralizzare il ritorno delle funzioni
------------------------------------------
@@ -855,7 +893,7 @@ I messaggi del kernel non devono terminare con un punto fermo.
Scrivere i numeri fra parentesi (%d) non migliora alcunché e per questo
dovrebbero essere evitati.
-Ci sono alcune macro per la diagnostica in <linux/device.h> che dovreste
+Ci sono alcune macro per la diagnostica in <linux/dev_printk.h> che dovreste
usare per assicurarvi che i messaggi vengano associati correttamente ai
dispositivi e ai driver, e che siano etichettati correttamente: dev_err(),
dev_warn(), dev_info(), e così via. Per messaggi che non sono associati ad