[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/9] docs/devel: make a statement about includes
From: |
Alex Bennée |
Subject: |
[PATCH 7/9] docs/devel: make a statement about includes |
Date: |
Thu, 20 Apr 2023 16:57:21 +0100 |
While not explicitly disallowing header macro abuse (because that
would make us hypocrites) lets at least address some things to think
about.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
docs/devel/style.rst | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/docs/devel/style.rst b/docs/devel/style.rst
index 68aa776930..5bc6f2f095 100644
--- a/docs/devel/style.rst
+++ b/docs/devel/style.rst
@@ -300,6 +300,20 @@ putting those into qemu/typedefs.h instead of including
the header.
Cyclic inclusion is forbidden.
+Generative Includes
+-------------------
+
+QEMU makes fairly extensive use of the macro pre-processor to
+instantiate multiple similar functions. While such abuse of the macro
+processor isn't discouraged it can make debugging and code navigation
+harder. You should consider carefully if the same effect can be
+achieved by making it easy for the compiler to constant fold or using
+python scripting to generate grep friendly code.
+
+If you do use template header files they should be named with the
+``.c.inc`` or ``.h.inc`` suffix to make it clear they are being
+included for expansion.
+
C types
=======
--
2.39.2
- [PATCH 0/9] docs: various (style, punctuation and typo fixes), Alex Bennée, 2023/04/20
- [PATCH 1/9] docs/devel/kconfig.rst: Fix incorrect markup, Alex Bennée, 2023/04/20
- [PATCH 4/9] docs/cxl: Fix sentence, Alex Bennée, 2023/04/20
- [PATCH 2/9] qemu-options.hx: Update descriptions of memory options for NUMA node, Alex Bennée, 2023/04/20
- [PATCH 7/9] docs/devel: make a statement about includes,
Alex Bennée <=
- [PATCH 8/9] docs/devel: mention the spacing requirement for QOM, Alex Bennée, 2023/04/20
- Re: [PATCH 8/9] docs/devel: mention the spacing requirement for QOM, Juan Quintela, 2023/04/20
- [PATCH 6/9] docs/system: remove excessive punctuation from guest-loader docs, Alex Bennée, 2023/04/20
- [PATCH 3/9] docs: Fix typo (wphx => whpx), Alex Bennée, 2023/04/20