diff options
author | Tom Rini <trini@konsulko.com> | 2024-02-12 15:22:05 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-02-12 15:22:05 -0500 |
commit | 73b5b47dd5b546d0b9106bcca54c72815380e6d3 (patch) | |
tree | 347bf71809965d00f7d709b175930e78f82ce710 /doc/develop/codingstyle.rst | |
parent | a5f877a0bd64af97dbc812c9a0a8d7d6a353d943 (diff) | |
parent | 2eb39c9adafb4210c6bcf0aed75a34493c098c8e (diff) |
Merge tag 'doc-2024-04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request doc-2024-04-rc2
Documentation:
* Fix and extend utf8_to_utf32_stream() documentation
* Fix rendering of OpenSBI logo in VisionFive 2 description
* Document imxrt1170-evk board
* codingstyle.rst: Clarify include section
UEFI:
* simplify error message in efi_disk_create_raw()
Diffstat (limited to 'doc/develop/codingstyle.rst')
-rw-r--r-- | doc/develop/codingstyle.rst | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/doc/develop/codingstyle.rst b/doc/develop/codingstyle.rst index b25bfbd271f..f6248cdcb1e 100644 --- a/doc/develop/codingstyle.rst +++ b/doc/develop/codingstyle.rst @@ -108,30 +108,29 @@ expected size, or that particular members appear at the right offset. Include files ------------- -You should follow this ordering in U-Boot. The common.h header (which is going -away at some point) should always be first, followed by other headers in order, -then headers with directories, then local files: +You should follow this ordering in U-Boot. In all cases, they should be listed +in alphabetical order. First comes headers which are located directly in our +top-level include diretory. This excludes the common.h header file which is to +be removed. Second are headers within subdirectories, Finally directory-local +includes should be listed. See this example: .. code-block:: C - #include <common.h> #include <bootstage.h> #include <dm.h> #include <others.h> #include <asm/...> - #include <arm/arch/...> + #include <asm/arch/...> #include <dm/device_compat.h> #include <linux/...> #include "local.h" -Within that order, sort your includes. - -It is important to include common.h first since it provides basic features used -by most files, e.g. CONFIG options. - For files that need to be compiled for the host (e.g. tools), you need to use -``#ifndef USE_HOSTCC`` to avoid including common.h since it includes a lot of -internal U-Boot things. See common/image.c for an example. +``#ifndef USE_HOSTCC`` to avoid including U-Boot specific include files. See +common/image.c for an example. + +If you encounter code which still uses <common.h> a patch to remove that and +replace it with any required include files directly is much appreciated. If your file uses driver model, include <dm.h> in the C file. Do not include dm.h in a header file. Try to use forward declarations (e.g. ``struct |