summaryrefslogtreecommitdiff
path: root/Documentation/contributing/coding_style.md
AgeCommit message (Collapse)Author
2024-01-21Documentation: Fix trivial typo in the "Coding Style" chapterTillmann Severin
This should not have any impact on produced binaries. Due to the simplicity, the patch has not been tested. Change-Id: Ic52f2be6a91aa3534d222f08733d1ba8bc1265a9 Signed-off-by: Tillmann Severin <tillmann.severin@mailbox.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80140 Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2023-09-01Documentation: Update coding_style.md with refactoring sectionMartin Roth
The rule being added to the refactoring section is already present in the "coding style" section of the guide, but is currently easy to miss. Adding it to its own section makes it a little more plain and makes it more strongly worded. Update a couple of other areas: - Make kernel specific phrasing better aligned with coreboot. - Remove duplicate "try to match" phrase in coding style section. - Remove section on Data structures - it doesn't apply to coreboot. - Update text to make it clearer and more coreboot-centric. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: Ic3508529f639ea0609d2ea2032cc52407e9543e5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/71067 Reviewed-by: Varshit Pandya <pandyavarshit@gmail.com> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
2022-12-28coding_style: Add more guidelines on error handling, die() and assert()Julius Werner
This patch adds a new section to the coding style which codifies existing practices about how to handle errors and how to use the die() and assert() macros. Also clean up some references to Linux-specific facilities that do not exist in coreboot in the adjacent function return type guidelines, and add a small blurb of documentation to the definition of the assert() macro itself. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ice37ed9f995a56d69476e95a352209041b337284 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70775 Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
2022-12-20doc/contributing/coding_style: change example to use __fallthroughFelix Held
While the fall through comment is sufficient for gcc to notice that the fall-through is intentional, clang requires a special attribute which also works for gcc. Update the documentation to use this attribute instead of the comment. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I08dbac8ff1f9e04770a03fb74fabf0d397b50989 Reviewed-on: https://review.coreboot.org/c/coreboot/+/71102 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-16contributing/coding_style.md: Add missing ">"Elyes Haouas
Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I2f2cd20139f4cdb7ba665e9e49a03faea1ac085b Reviewed-on: https://review.coreboot.org/c/coreboot/+/67658 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-07-20Documentation: Fix broken linkLijian Zhao
Link to Linux kernel coding style changed, fix it. Change-Id: I9792d360d301b93c255306488c90375c6cc882c4 Signed-off-by: Lance Zhao <lance.zhao@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/65959 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: John Zhao <john.zhao@intel.com> Reviewed-by: Bora Guvendik <bora.guvendik@intel.com>
2022-04-20docs/coding_style: Clarify use of GCC extensionsJulius Werner
This patch adds a section to the coding style that explicitly clarifies the use of GCC extensions in coreboot (which has been long-standing practice anyway), and expressly allows their use. See the mailing list discussion for more details: https://mail.coreboot.org/hyperkitty/list/coreboot@coreboot.org/thread/3C2QWAZ5RJ6ME5KXMEOGB5GW62UTXCLS/ Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I0d0eb90d6729fefeb131cdd573ad51f1884afe11 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63660 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Krystian Hebel <krystian.hebel@3mdeb.com> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2022-03-14Documentation: Fix broken linksMartin Roth
This change mostly changes links that were identified as broken by the 'website_scans' jenkins job. There were some links that seem to be up at times, but that are identified by link-checker as broken because of SSL issues. At least one other link was changed to point to archive.org so that it doesn't break at some point in the future. We should probably try to make sure that everything is archived there and point to those versions when possible. There are still lots more links to do. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: I36868ddf6113e18fa6841427dd635c75445b7bef Reviewed-on: https://review.coreboot.org/c/coreboot/+/62672 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
2021-10-17Documentation: Improve preamble of coding stylePatrick Georgi
The coding style doc isn't short, so scrap that, and it's specific to the C parts of our tree, so add that. Change-Id: Ib1ef7c1a96ff40f0cfbae7d22a47a95128981eb8 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58381 Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-10-05Documentation: Fix spelling errorsMartin Roth
These issues were found and fixed by codespell, a useful tool for finding spelling errors. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: If2a8e97911420c19e9365d5c28810b998f2c2ac8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58078 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-03-26Documentation/coding_style: Issues not mentioned and cleanup patchesJulius Werner
This patch adds a bit of a "preamble" to the coding style to provide guideance on how it should be applied and how style questions that aren't mentioned should be handled. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I88efd5f1006bd1fd82cea14ea65422d9958dc197 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50966 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-03-22Documentation/coding_style: Add more details on include-orderingJulius Werner
This patch is trying to address some of the concerns raised in CB:50247 after the patch had landed. The preference for alphabetized headers was just supposed to discourage leaving headers completely unordered, and wasn't intended to disallow other intentional include orderings such as grouping local includes after system ones or specific ordering constraints that exist for technical reasons. This patch adds a few more sentences to try to clarify that. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I6825f4a57613fabb88a00ae46679b4774ef7110b Reviewed-on: https://review.coreboot.org/c/coreboot/+/51553 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-02-22Documentation: move `coding_style.md` inside contributing/Alexey Vazhnov
Keep less files in the root directory. Change-Id: I9eebd0b0826181340ead41af5284362d1cca09d7 Signed-off-by: Alexey Vazhnov <vazhnov@boot-keys.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50852 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>