qemu/atomic: Header cleanups
cover qemu/atomic: Header cleanups
- Include "qemu/atomic.h" in "qemu/atomic128.h"
- Use .h.inc suffix
Philippe Mathieu-Daudé (3):
qemu/atomic: Rename atomic128-cas.h headers using .h.inc suffix qemu/atomic: Rename atomic128-ldst.h headers using .h.inc suffix qemu/atomic128: Include missing 'qemu/atomic.h' header
host/include/aarch64/host/atomic128-cas.h | 2 +-
include/qemu/atomic128.h | 5 +++--
.../aarch64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} | 0
.../generic/host/{atomic128-cas.h => atomic128-cas.h.inc} | 0
.../generic/host/{atomic128-ldst.h => atomic128-ldst.h.inc} | 0
.../host/{atomic128-ldst.h => atomic128-ldst.h.inc} | 0
.../x86_64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} | 2 +-
host/include/x86_64/host/load-extract-al16-al8.h.inc | 2 +-
8 files changed, 6 insertions(+), 5 deletions(-)
rename host/include/aarch64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} (100%)
rename host/include/generic/host/{atomic128-cas.h => atomic128-cas.h.inc} (100%)
rename host/include/generic/host/{atomic128-ldst.h => atomic128-ldst.h.inc} (100%)
rename host/include/loongarch64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} (100%)
rename host/include/x86_64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} (96%)Signature · 1 line
2.45.2
PATCH 1/3 qemu/atomic: Rename atomic128-cas.h headers using .h.inc suffix
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'.
---
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%)host/include/aarch64/host/atomic128-cas.h +1 -1
@@ -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) {
include/qemu/atomic128.h +1 -1
@@ -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 */
host/include/generic/host/atomic128-cas.h.inc renamed from host/include/generic/host/atomic128-cas.h +0 -0
Signature · 1 line
2.45.2
Re: [PATCH 1/3] qemu/atomic: Rename atomic128-cas.h headers using .h.inc suffix
Quoted 4 lines · Philippe Mathieu-Daudé
Since commit
139c1837db("meson: rename included C source files to .c.inc"), QEMU standard procedure for included C files is to use *.c.inc.
Quoted 8 lines
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~
Re: [PATCH 1/3] qemu/atomic: Rename atomic128-cas.h headers using .h.inc suffix
Quoted 8 lines · Richard Henderson
Quoted 7 lines · Philippe Mathieu-Daudé
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:
Quoted 8 lines
Quoted 5 lines
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.
Re: [PATCH 1/3] qemu/atomic: Rename atomic128-cas.h headers using .h.inc suffix
Quoted 17 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Richard Henderson
Quoted 7 lines · Philippe Mathieu-Daudé
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:Quoted 8 lines
Quoted 5 lines
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.
Quoted 7 lines
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~
Re: [PATCH 1/3] qemu/atomic: Rename atomic128-cas.h headers using .h.inc suffix
Quoted 18 lines · Richard Henderson
Quoted 17 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Richard Henderson
Quoted 4 lines · Philippe Mathieu-Daudé
Since commit
139c1837db("meson: rename included C source files to .c.inc"), QEMU standard procedure for included C files is to use *.c.inc.Quoted 8 lines
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.
Quoted 8 lines
Quoted 6 lines
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.
Re: [PATCH 1/3] qemu/atomic: Rename atomic128-cas.h headers using .h.inc suffix
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Richard Henderson
Quoted 23 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Richard Henderson
Quoted 7 lines · Philippe Mathieu-Daudé
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:Quoted 8 lines
Quoted 5 lines
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.
Quoted 4 lines
Quoted 1 line
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~
PATCH 2/3 qemu/atomic: Rename atomic128-ldst.h headers using .h.inc suffix
In reply to Philippe Mathieu-Daudé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-ldst.h' as 'atomic128-ldst.h.inc'.
---
include/qemu/atomic128.h | 2 +-
.../aarch64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} | 0
.../generic/host/{atomic128-ldst.h => atomic128-ldst.h.inc} | 0
.../loongarch64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} | 0
.../x86_64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} | 2 +-
host/include/x86_64/host/load-extract-al16-al8.h.inc | 2 +-
6 files changed, 3 insertions(+), 3 deletions(-)
rename host/include/aarch64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} (100%)
rename host/include/generic/host/{atomic128-ldst.h => atomic128-ldst.h.inc} (100%)
rename host/include/loongarch64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} (100%)
rename host/include/x86_64/host/{atomic128-ldst.h => atomic128-ldst.h.inc} (96%)include/qemu/atomic128.h +1 -1
@@ -59,6 +59,6 @@*/ #include "host/atomic128-cas.h.inc" -#include "host/atomic128-ldst.h" +#include "host/atomic128-ldst.h.inc" #endif /* QEMU_ATOMIC128_H */
host/include/aarch64/host/atomic128-ldst.h.inc renamed from host/include/aarch64/host/atomic128-ldst.h +0 -0
host/include/generic/host/atomic128-ldst.h.inc renamed from host/include/generic/host/atomic128-ldst.h +0 -0
host/include/loongarch64/host/atomic128-ldst.h.inc renamed from host/include/loongarch64/host/atomic128-ldst.h +0 -0
host/include/x86_64/host/atomic128-ldst.h.inc renamed from host/include/x86_64/host/atomic128-ldst.h +1 -1
@@ -69,7 +69,7 @@ static inline void atomic16_set(Int128 *ptr, Int128 val) } #else /* Provide QEMU_ERROR stubs. */ -#include "host/include/generic/host/atomic128-ldst.h" +#include "host/include/generic/host/atomic128-ldst.h.inc" #endif #endif /* X86_64_ATOMIC128_LDST_H */
host/include/x86_64/host/load-extract-al16-al8.h.inc +1 -1
@@ -9,7 +9,7 @@ #define X86_64_LOAD_EXTRACT_AL16_AL8_H #ifdef CONFIG_INT128_TYPE -#include "host/atomic128-ldst.h" +#include "host/atomic128-ldst.h.inc" /** * load_atom_extract_al16_or_al8:
Signature · 1 line
2.45.2
PATCH 3/3 qemu/atomic128: Include missing 'qemu/atomic.h' header
In reply to Philippe Mathieu-Daudéqatomic_cmpxchg__nocheck() is declared in "qemu/atomic.h". Include it in order to avoid when refactoring unrelated headers:
In file included from ../../accel/tcg/tcg-runtime-gvec.c:22:
In file included from include/exec/helper-proto-common.h:10:
In file included from include/qemu/atomic128.h:61:
host/include/generic/host/atomic128-cas.h.inc: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.
--- include/qemu/atomic128.h | 1 + 1 file changed, 1 insertion(+)
include/qemu/atomic128.h +1 -0
@@ -13,6 +13,7 @@#ifndef QEMU_ATOMIC128_H #define QEMU_ATOMIC128_H +#include "qemu/atomic.h" #include "qemu/int128.h" /*
Signature · 1 line
2.45.2
Re: [PATCH 3/3] qemu/atomic128: Include missing 'qemu/atomic.h' header
Quoted 21 lines · Philippe Mathieu-Daudé
qatomic_cmpxchg__nocheck()is declared in "qemu/atomic.h". Include it in order to avoid when refactoring unrelated headers:In file included from
../../accel/tcg/tcg-runtime-gvec.c:22:
In file included frominclude/exec/helper-proto-common.h:10:
In file included frominclude/qemu/atomic128.h:61:
host/include/generic/host/atomic128-cas.h.inc: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.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/qemu/atomic128.h | 1 + 1 file changed, 1 insertion(+)include/qemu/atomic128.h +0
-0
include/qemu/atomic128.h line 17
Quoted 5 lines
include/qemu/atomic128.h +1
-0@@ -13,6 +13,7 @@#ifndef QEMU_ATOMIC128_H #define QEMU_ATOMIC128_H +#include "qemu/atomic.h" #include "qemu/int128.h"
r~