Message ID | 20241212141018.59428-2-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | qemu/atomic: Header cleanups | expand |
On 12/12/24 08:10, Philippe Mathieu-Daudé wrote: > Since commit 139c1837db ("meson: rename included C source files > to .c.inc"), QEMU standard procedure for included C files is to > use *.c.inc. > > Besides, since commit 6a0057aa22 ("docs/devel: make a statement > about includes") this is documented in the Coding Style: > > 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. > > Therefore rename 'atomic128-cas.h' as 'atomic128-cas.h.inc'. But these are not templates, nor included multiple times, so... I don't get it. r~
On 12/12/24 16:02, Richard Henderson wrote: > On 12/12/24 08:10, Philippe Mathieu-Daudé wrote: >> Since commit 139c1837db ("meson: rename included C source files >> to .c.inc"), QEMU standard procedure for included C files is to >> use *.c.inc. >> >> Besides, since commit 6a0057aa22 ("docs/devel: make a statement >> about includes") this is documented in the Coding Style: >> >> 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. >> >> Therefore rename 'atomic128-cas.h' as 'atomic128-cas.h.inc'. > > But these are not templates, nor included multiple times, so... > I don't get it. I wanted to avoid including "qemu/atomic.h" in each of them due to: host/include/generic/host/atomic128-cas.h:23:11: error: call to undeclared function 'qatomic_cmpxchg__nocheck'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 23 | r.i = qatomic_cmpxchg__nocheck(ptr_align, c.i, n.i); | ^ 1 error generated.
On 12/12/24 09:09, Philippe Mathieu-Daudé wrote: > On 12/12/24 16:02, Richard Henderson wrote: >> On 12/12/24 08:10, Philippe Mathieu-Daudé wrote: >>> Since commit 139c1837db ("meson: rename included C source files >>> to .c.inc"), QEMU standard procedure for included C files is to >>> use *.c.inc. >>> >>> Besides, since commit 6a0057aa22 ("docs/devel: make a statement >>> about includes") this is documented in the Coding Style: >>> >>> 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. >>> >>> Therefore rename 'atomic128-cas.h' as 'atomic128-cas.h.inc'. >> >> But these are not templates, nor included multiple times, so... >> I don't get it. > I wanted to avoid including "qemu/atomic.h" in each of them due to: > > host/include/generic/host/atomic128-cas.h:23:11: error: call to undeclared function > 'qatomic_cmpxchg__nocheck'; ISO C99 and later do not support implicit function > declarations [-Wimplicit-function-declaration] > 23 | r.i = qatomic_cmpxchg__nocheck(ptr_align, c.i, n.i); > | ^ > 1 error generated. And why would you ever have that? r~
On 12/12/24 16:11, Richard Henderson wrote: > On 12/12/24 09:09, Philippe Mathieu-Daudé wrote: >> On 12/12/24 16:02, Richard Henderson wrote: >>> On 12/12/24 08:10, Philippe Mathieu-Daudé wrote: >>>> Since commit 139c1837db ("meson: rename included C source files >>>> to .c.inc"), QEMU standard procedure for included C files is to >>>> use *.c.inc. >>>> >>>> Besides, since commit 6a0057aa22 ("docs/devel: make a statement >>>> about includes") this is documented in the Coding Style: >>>> >>>> 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. >>>> >>>> Therefore rename 'atomic128-cas.h' as 'atomic128-cas.h.inc'. >>> >>> But these are not templates, nor included multiple times, so... >>> I don't get it. >> I wanted to avoid including "qemu/atomic.h" in each of them due to: >> >> host/include/generic/host/atomic128-cas.h:23:11: error: call to >> undeclared function 'qatomic_cmpxchg__nocheck'; ISO C99 and later do >> not support implicit function declarations [-Wimplicit-function- >> declaration] >> 23 | r.i = qatomic_cmpxchg__nocheck(ptr_align, c.i, n.i); >> | ^ >> 1 error generated. > > And why would you ever have that? To have "not template" headers self-contained; but I'm fine discarding these 2 patches and keeping the last one of this series.
On 12/12/24 09:17, Philippe Mathieu-Daudé wrote: > On 12/12/24 16:11, Richard Henderson wrote: >> On 12/12/24 09:09, Philippe Mathieu-Daudé wrote: >>> On 12/12/24 16:02, Richard Henderson wrote: >>>> On 12/12/24 08:10, Philippe Mathieu-Daudé wrote: >>>>> Since commit 139c1837db ("meson: rename included C source files >>>>> to .c.inc"), QEMU standard procedure for included C files is to >>>>> use *.c.inc. >>>>> >>>>> Besides, since commit 6a0057aa22 ("docs/devel: make a statement >>>>> about includes") this is documented in the Coding Style: >>>>> >>>>> 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. >>>>> >>>>> Therefore rename 'atomic128-cas.h' as 'atomic128-cas.h.inc'. >>>> >>>> But these are not templates, nor included multiple times, so... >>>> I don't get it. >>> I wanted to avoid including "qemu/atomic.h" in each of them due to: >>> >>> host/include/generic/host/atomic128-cas.h:23:11: error: call to undeclared >>> function 'qatomic_cmpxchg__nocheck'; ISO C99 and later do not support implicit function >>> declarations [-Wimplicit-function- declaration] >>> 23 | r.i = qatomic_cmpxchg__nocheck(ptr_align, c.i, n.i); >>> | ^ >>> 1 error generated. >> >> And why would you ever have that? > > To have "not template" headers self-contained; but I'm fine discarding > these 2 patches and keeping the last one of this series. If you have another reason for the change, then that should be the reason in the commit message. But what you copied from Coding Style isn't the reason. r~
diff --git a/host/include/aarch64/host/atomic128-cas.h b/host/include/aarch64/host/atomic128-cas.h index 58630107bcc..991da4ef543 100644 --- a/host/include/aarch64/host/atomic128-cas.h +++ b/host/include/aarch64/host/atomic128-cas.h @@ -13,7 +13,7 @@ /* Through gcc 10, aarch64 has no support for 128-bit atomics. */ #if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128) -#include "host/include/generic/host/atomic128-cas.h" +#include "host/include/generic/host/atomic128-cas.h.inc" #else static inline Int128 atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new) { diff --git a/include/qemu/atomic128.h b/include/qemu/atomic128.h index 88af6d4ea3f..03c27022f0c 100644 --- a/include/qemu/atomic128.h +++ b/include/qemu/atomic128.h @@ -58,7 +58,7 @@ * Therefore, special case each platform. */ -#include "host/atomic128-cas.h" +#include "host/atomic128-cas.h.inc" #include "host/atomic128-ldst.h" #endif /* QEMU_ATOMIC128_H */ diff --git a/host/include/generic/host/atomic128-cas.h b/host/include/generic/host/atomic128-cas.h.inc similarity index 100% rename from host/include/generic/host/atomic128-cas.h rename to host/include/generic/host/atomic128-cas.h.inc
Since commit 139c1837db ("meson: rename included C source files to .c.inc"), QEMU standard procedure for included C files is to use *.c.inc. Besides, since commit 6a0057aa22 ("docs/devel: make a statement about includes") this is documented in the Coding Style: 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. Therefore rename 'atomic128-cas.h' as 'atomic128-cas.h.inc'. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- host/include/aarch64/host/atomic128-cas.h | 2 +- include/qemu/atomic128.h | 2 +- .../generic/host/{atomic128-cas.h => atomic128-cas.h.inc} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename host/include/generic/host/{atomic128-cas.h => atomic128-cas.h.inc} (100%)