All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files
@ 2023-06-06 14:12 Philippe Mathieu-Daudé
  2023-06-06 14:12 ` [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc Philippe Mathieu-Daudé
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-06 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm, Philippe Mathieu-Daudé

Follow the convention to use the .inc extension for .c/.h files
re-included, as docummented in Coding Style since commit 6a0057aa22:

    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.

Most of the codebase already uses this extension:

  $ git ls-files | fgrep .inc | wc -l
       155

Rename some files left over.

Philippe Mathieu-Daudé (5):
  bsd-user: Rename elfcore.c -> elfcore.c.inc
  target/arm: Rename helper template headers as '.h.inc'
  target/i386: Rename helper template headers as '.h.inc'
  target: Rename per-target 'helper.h' -> 'helper.h.inc'
  tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc

 docs/devel/tcg-ops.rst                                    | 2 +-
 include/exec/helper-gen.h                                 | 2 +-
 include/exec/helper-proto.h                               | 2 +-
 target/alpha/{helper.h => helper.h.inc}                   | 0
 target/arm/{helper.h => helper.h.inc}                     | 8 ++++----
 target/arm/tcg/{helper-a64.h => helper-a64.h.inc}         | 0
 target/arm/tcg/{helper-mve.h => helper-mve.h.inc}         | 0
 target/arm/tcg/{helper-sme.h => helper-sme.h.inc}         | 0
 target/arm/tcg/{helper-sve.h => helper-sve.h.inc}         | 0
 target/avr/{helper.h => helper.h.inc}                     | 0
 target/cris/{helper.h => helper.h.inc}                    | 0
 target/hexagon/{helper.h => helper.h.inc}                 | 0
 target/hppa/{helper.h => helper.h.inc}                    | 0
 target/i386/{helper.h => helper.h.inc}                    | 6 +++---
 target/i386/{ops_sse_header.h => ops_sse_header.h.inc}    | 0
 ...hift_helper_template.h => shift_helper_template.h.inc} | 0
 .../{cc_helper_template.h => cc_helper_template.h.inc}    | 0
 target/loongarch/{helper.h => helper.h.inc}               | 0
 target/m68k/{helper.h => helper.h.inc}                    | 0
 target/microblaze/{helper.h => helper.h.inc}              | 0
 target/mips/{helper.h => helper.h.inc}                    | 0
 target/nios2/{helper.h => helper.h.inc}                   | 0
 target/openrisc/{helper.h => helper.h.inc}                | 0
 target/ppc/{helper.h => helper.h.inc}                     | 0
 target/riscv/{helper.h => helper.h.inc}                   | 0
 target/rx/{helper.h => helper.h.inc}                      | 0
 target/s390x/{helper.h => helper.h.inc}                   | 0
 target/sh4/{helper.h => helper.h.inc}                     | 0
 target/sparc/{helper.h => helper.h.inc}                   | 0
 target/tricore/{helper.h => helper.h.inc}                 | 0
 target/xtensa/{helper.h => helper.h.inc}                  | 0
 bsd-user/elfload.c                                        | 2 +-
 target/alpha/translate.c                                  | 2 +-
 target/arm/machine.c                                      | 2 +-
 target/arm/tcg/translate.c                                | 2 +-
 target/avr/translate.c                                    | 2 +-
 target/cris/translate.c                                   | 2 +-
 target/hexagon/translate.c                                | 2 +-
 target/hppa/translate.c                                   | 2 +-
 target/i386/tcg/cc_helper.c                               | 8 ++++----
 target/i386/tcg/int_helper.c                              | 8 ++++----
 target/i386/tcg/translate.c                               | 2 +-
 target/loongarch/translate.c                              | 2 +-
 target/m68k/translate.c                                   | 2 +-
 target/microblaze/translate.c                             | 2 +-
 target/mips/tcg/translate.c                               | 2 +-
 target/nios2/translate.c                                  | 2 +-
 target/openrisc/translate.c                               | 2 +-
 target/ppc/translate.c                                    | 2 +-
 target/riscv/translate.c                                  | 2 +-
 target/rx/translate.c                                     | 2 +-
 target/s390x/tcg/translate.c                              | 2 +-
 target/sh4/translate.c                                    | 2 +-
 target/sparc/translate.c                                  | 2 +-
 target/tricore/translate.c                                | 2 +-
 target/xtensa/translate.c                                 | 2 +-
 tests/tcg/aarch64/bti-1.c                                 | 2 +-
 tests/tcg/aarch64/bti-3.c                                 | 2 +-
 bsd-user/{elfcore.c => elfcore.c.inc}                     | 0
 tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc}        | 0
 60 files changed, 43 insertions(+), 43 deletions(-)
 rename target/alpha/{helper.h => helper.h.inc} (100%)
 rename target/arm/{helper.h => helper.h.inc} (99%)
 rename target/arm/tcg/{helper-a64.h => helper-a64.h.inc} (100%)
 rename target/arm/tcg/{helper-mve.h => helper-mve.h.inc} (100%)
 rename target/arm/tcg/{helper-sme.h => helper-sme.h.inc} (100%)
 rename target/arm/tcg/{helper-sve.h => helper-sve.h.inc} (100%)
 rename target/avr/{helper.h => helper.h.inc} (100%)
 rename target/cris/{helper.h => helper.h.inc} (100%)
 rename target/hexagon/{helper.h => helper.h.inc} (100%)
 rename target/hppa/{helper.h => helper.h.inc} (100%)
 rename target/i386/{helper.h => helper.h.inc} (98%)
 rename target/i386/{ops_sse_header.h => ops_sse_header.h.inc} (100%)
 rename target/i386/{shift_helper_template.h => shift_helper_template.h.inc} (100%)
 rename target/i386/tcg/{cc_helper_template.h => cc_helper_template.h.inc} (100%)
 rename target/loongarch/{helper.h => helper.h.inc} (100%)
 rename target/m68k/{helper.h => helper.h.inc} (100%)
 rename target/microblaze/{helper.h => helper.h.inc} (100%)
 rename target/mips/{helper.h => helper.h.inc} (100%)
 rename target/nios2/{helper.h => helper.h.inc} (100%)
 rename target/openrisc/{helper.h => helper.h.inc} (100%)
 rename target/ppc/{helper.h => helper.h.inc} (100%)
 rename target/riscv/{helper.h => helper.h.inc} (100%)
 rename target/rx/{helper.h => helper.h.inc} (100%)
 rename target/s390x/{helper.h => helper.h.inc} (100%)
 rename target/sh4/{helper.h => helper.h.inc} (100%)
 rename target/sparc/{helper.h => helper.h.inc} (100%)
 rename target/tricore/{helper.h => helper.h.inc} (100%)
 rename target/xtensa/{helper.h => helper.h.inc} (100%)
 rename bsd-user/{elfcore.c => elfcore.c.inc} (100%)
 rename tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc} (100%)

-- 
2.38.1



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc
  2023-06-06 14:12 [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Philippe Mathieu-Daudé
@ 2023-06-06 14:12 ` Philippe Mathieu-Daudé
  2023-06-06 14:29   ` Richard Henderson
  2023-06-06 14:12 ` [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc' Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-06 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm, 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 as 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 the included 'elfcore.c' as 'elfcore.c.inc'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 bsd-user/elfload.c                    | 2 +-
 bsd-user/{elfcore.c => elfcore.c.inc} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename bsd-user/{elfcore.c => elfcore.c.inc} (100%)

diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index 1f650bdde8..d2dced3d7e 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -121,7 +121,7 @@ static void bswap_note(struct elf_note *en) { }
 
 #endif /* ! BSWAP_NEEDED */
 
-#include "elfcore.c"
+#include "elfcore.c.inc"
 
 /*
  * 'copy_elf_strings()' copies argument/envelope strings from user
diff --git a/bsd-user/elfcore.c b/bsd-user/elfcore.c.inc
similarity index 100%
rename from bsd-user/elfcore.c
rename to bsd-user/elfcore.c.inc
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc'
  2023-06-06 14:12 [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Philippe Mathieu-Daudé
  2023-06-06 14:12 ` [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc Philippe Mathieu-Daudé
@ 2023-06-06 14:12 ` Philippe Mathieu-Daudé
  2023-06-06 14:37   ` Richard Henderson
  2023-06-06 14:12 ` [PATCH 3/5] target/i386: " Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-06 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm, 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 as 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 the included templates as '.h.inc'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/arm/helper.h                               | 8 ++++----
 target/arm/tcg/{helper-a64.h => helper-a64.h.inc} | 0
 target/arm/tcg/{helper-mve.h => helper-mve.h.inc} | 0
 target/arm/tcg/{helper-sme.h => helper-sme.h.inc} | 0
 target/arm/tcg/{helper-sve.h => helper-sve.h.inc} | 0
 5 files changed, 4 insertions(+), 4 deletions(-)
 rename target/arm/tcg/{helper-a64.h => helper-a64.h.inc} (100%)
 rename target/arm/tcg/{helper-mve.h => helper-mve.h.inc} (100%)
 rename target/arm/tcg/{helper-sme.h => helper-sme.h.inc} (100%)
 rename target/arm/tcg/{helper-sve.h => helper-sve.h.inc} (100%)

diff --git a/target/arm/helper.h b/target/arm/helper.h
index 3335c2b10b..4218d98b51 100644
--- a/target/arm/helper.h
+++ b/target/arm/helper.h
@@ -1039,9 +1039,9 @@ DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, i32)
 
 #ifdef TARGET_AARCH64
-#include "tcg/helper-a64.h"
-#include "tcg/helper-sve.h"
-#include "tcg/helper-sme.h"
+#include "tcg/helper-a64.h.inc"
+#include "tcg/helper-sve.h.inc"
+#include "tcg/helper-sme.h.inc"
 #endif
 
-#include "tcg/helper-mve.h"
+#include "tcg/helper-mve.h.inc"
diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h.inc
similarity index 100%
rename from target/arm/tcg/helper-a64.h
rename to target/arm/tcg/helper-a64.h.inc
diff --git a/target/arm/tcg/helper-mve.h b/target/arm/tcg/helper-mve.h.inc
similarity index 100%
rename from target/arm/tcg/helper-mve.h
rename to target/arm/tcg/helper-mve.h.inc
diff --git a/target/arm/tcg/helper-sme.h b/target/arm/tcg/helper-sme.h.inc
similarity index 100%
rename from target/arm/tcg/helper-sme.h
rename to target/arm/tcg/helper-sme.h.inc
diff --git a/target/arm/tcg/helper-sve.h b/target/arm/tcg/helper-sve.h.inc
similarity index 100%
rename from target/arm/tcg/helper-sve.h
rename to target/arm/tcg/helper-sve.h.inc
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/5] target/i386: Rename helper template headers as '.h.inc'
  2023-06-06 14:12 [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Philippe Mathieu-Daudé
  2023-06-06 14:12 ` [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc Philippe Mathieu-Daudé
  2023-06-06 14:12 ` [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc' Philippe Mathieu-Daudé
@ 2023-06-06 14:12 ` Philippe Mathieu-Daudé
  2023-06-06 14:38   ` Richard Henderson
  2023-06-06 14:12 ` [PATCH 4/5] target: Rename per-target 'helper.h' -> 'helper.h.inc' Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-06 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm, 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 as 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 the included templates as '.h.inc'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/i386/helper.h                                      | 6 +++---
 target/i386/{ops_sse_header.h => ops_sse_header.h.inc}    | 0
 ...hift_helper_template.h => shift_helper_template.h.inc} | 0
 .../{cc_helper_template.h => cc_helper_template.h.inc}    | 0
 target/i386/tcg/cc_helper.c                               | 8 ++++----
 target/i386/tcg/int_helper.c                              | 8 ++++----
 6 files changed, 11 insertions(+), 11 deletions(-)
 rename target/i386/{ops_sse_header.h => ops_sse_header.h.inc} (100%)
 rename target/i386/{shift_helper_template.h => shift_helper_template.h.inc} (100%)
 rename target/i386/tcg/{cc_helper_template.h => cc_helper_template.h.inc} (100%)

diff --git a/target/i386/helper.h b/target/i386/helper.h
index e627a93107..e972e1cf36 100644
--- a/target/i386/helper.h
+++ b/target/i386/helper.h
@@ -203,11 +203,11 @@ DEF_HELPER_1(enter_mmx, void, env)
 DEF_HELPER_1(emms, void, env)
 
 #define SHIFT 0
-#include "ops_sse_header.h"
+#include "ops_sse_header.h.inc"
 #define SHIFT 1
-#include "ops_sse_header.h"
+#include "ops_sse_header.h.inc"
 #define SHIFT 2
-#include "ops_sse_header.h"
+#include "ops_sse_header.h.inc"
 
 DEF_HELPER_3(rclb, tl, env, tl, tl)
 DEF_HELPER_3(rclw, tl, env, tl, tl)
diff --git a/target/i386/ops_sse_header.h b/target/i386/ops_sse_header.h.inc
similarity index 100%
rename from target/i386/ops_sse_header.h
rename to target/i386/ops_sse_header.h.inc
diff --git a/target/i386/shift_helper_template.h b/target/i386/shift_helper_template.h.inc
similarity index 100%
rename from target/i386/shift_helper_template.h
rename to target/i386/shift_helper_template.h.inc
diff --git a/target/i386/tcg/cc_helper_template.h b/target/i386/tcg/cc_helper_template.h.inc
similarity index 100%
rename from target/i386/tcg/cc_helper_template.h
rename to target/i386/tcg/cc_helper_template.h.inc
diff --git a/target/i386/tcg/cc_helper.c b/target/i386/tcg/cc_helper.c
index 6227dbb30b..c310bd842f 100644
--- a/target/i386/tcg/cc_helper.c
+++ b/target/i386/tcg/cc_helper.c
@@ -58,21 +58,21 @@ const uint8_t parity_table[256] = {
 };
 
 #define SHIFT 0
-#include "cc_helper_template.h"
+#include "cc_helper_template.h.inc"
 #undef SHIFT
 
 #define SHIFT 1
-#include "cc_helper_template.h"
+#include "cc_helper_template.h.inc"
 #undef SHIFT
 
 #define SHIFT 2
-#include "cc_helper_template.h"
+#include "cc_helper_template.h.inc"
 #undef SHIFT
 
 #ifdef TARGET_X86_64
 
 #define SHIFT 3
-#include "cc_helper_template.h"
+#include "cc_helper_template.h.inc"
 #undef SHIFT
 
 #endif
diff --git a/target/i386/tcg/int_helper.c b/target/i386/tcg/int_helper.c
index 599ac968b0..05418f181f 100644
--- a/target/i386/tcg/int_helper.c
+++ b/target/i386/tcg/int_helper.c
@@ -448,20 +448,20 @@ target_ulong helper_pext(target_ulong src, target_ulong mask)
 }
 
 #define SHIFT 0
-#include "shift_helper_template.h"
+#include "shift_helper_template.h.inc"
 #undef SHIFT
 
 #define SHIFT 1
-#include "shift_helper_template.h"
+#include "shift_helper_template.h.inc"
 #undef SHIFT
 
 #define SHIFT 2
-#include "shift_helper_template.h"
+#include "shift_helper_template.h.inc"
 #undef SHIFT
 
 #ifdef TARGET_X86_64
 #define SHIFT 3
-#include "shift_helper_template.h"
+#include "shift_helper_template.h.inc"
 #undef SHIFT
 #endif
 
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/5] target: Rename per-target 'helper.h' -> 'helper.h.inc'
  2023-06-06 14:12 [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2023-06-06 14:12 ` [PATCH 3/5] target/i386: " Philippe Mathieu-Daudé
@ 2023-06-06 14:12 ` Philippe Mathieu-Daudé
  2023-06-06 14:43   ` Richard Henderson
  2023-06-06 14:12 ` [PATCH 5/5] tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc Philippe Mathieu-Daudé
  2023-06-06 17:02 ` [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Alex Bennée
  5 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-06 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm,
	Philippe Mathieu-Daudé,
	Richard Henderson

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 as 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 the included 'helper.h' as 'helper.h.inc' for
all targets (updating the documentation).

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 docs/devel/tcg-ops.rst                       | 2 +-
 include/exec/helper-gen.h                    | 2 +-
 include/exec/helper-proto.h                  | 2 +-
 target/alpha/{helper.h => helper.h.inc}      | 0
 target/arm/{helper.h => helper.h.inc}        | 0
 target/avr/{helper.h => helper.h.inc}        | 0
 target/cris/{helper.h => helper.h.inc}       | 0
 target/hexagon/{helper.h => helper.h.inc}    | 0
 target/hppa/{helper.h => helper.h.inc}       | 0
 target/i386/{helper.h => helper.h.inc}       | 0
 target/loongarch/{helper.h => helper.h.inc}  | 0
 target/m68k/{helper.h => helper.h.inc}       | 0
 target/microblaze/{helper.h => helper.h.inc} | 0
 target/mips/{helper.h => helper.h.inc}       | 0
 target/nios2/{helper.h => helper.h.inc}      | 0
 target/openrisc/{helper.h => helper.h.inc}   | 0
 target/ppc/{helper.h => helper.h.inc}        | 0
 target/riscv/{helper.h => helper.h.inc}      | 0
 target/rx/{helper.h => helper.h.inc}         | 0
 target/s390x/{helper.h => helper.h.inc}      | 0
 target/sh4/{helper.h => helper.h.inc}        | 0
 target/sparc/{helper.h => helper.h.inc}      | 0
 target/tricore/{helper.h => helper.h.inc}    | 0
 target/xtensa/{helper.h => helper.h.inc}     | 0
 target/alpha/translate.c                     | 2 +-
 target/arm/machine.c                         | 2 +-
 target/arm/tcg/translate.c                   | 2 +-
 target/avr/translate.c                       | 2 +-
 target/cris/translate.c                      | 2 +-
 target/hexagon/translate.c                   | 2 +-
 target/hppa/translate.c                      | 2 +-
 target/i386/tcg/translate.c                  | 2 +-
 target/loongarch/translate.c                 | 2 +-
 target/m68k/translate.c                      | 2 +-
 target/microblaze/translate.c                | 2 +-
 target/mips/tcg/translate.c                  | 2 +-
 target/nios2/translate.c                     | 2 +-
 target/openrisc/translate.c                  | 2 +-
 target/ppc/translate.c                       | 2 +-
 target/riscv/translate.c                     | 2 +-
 target/rx/translate.c                        | 2 +-
 target/s390x/tcg/translate.c                 | 2 +-
 target/sh4/translate.c                       | 2 +-
 target/sparc/translate.c                     | 2 +-
 target/tricore/translate.c                   | 2 +-
 target/xtensa/translate.c                    | 2 +-
 46 files changed, 25 insertions(+), 25 deletions(-)
 rename target/alpha/{helper.h => helper.h.inc} (100%)
 rename target/arm/{helper.h => helper.h.inc} (100%)
 rename target/avr/{helper.h => helper.h.inc} (100%)
 rename target/cris/{helper.h => helper.h.inc} (100%)
 rename target/hexagon/{helper.h => helper.h.inc} (100%)
 rename target/hppa/{helper.h => helper.h.inc} (100%)
 rename target/i386/{helper.h => helper.h.inc} (100%)
 rename target/loongarch/{helper.h => helper.h.inc} (100%)
 rename target/m68k/{helper.h => helper.h.inc} (100%)
 rename target/microblaze/{helper.h => helper.h.inc} (100%)
 rename target/mips/{helper.h => helper.h.inc} (100%)
 rename target/nios2/{helper.h => helper.h.inc} (100%)
 rename target/openrisc/{helper.h => helper.h.inc} (100%)
 rename target/ppc/{helper.h => helper.h.inc} (100%)
 rename target/riscv/{helper.h => helper.h.inc} (100%)
 rename target/rx/{helper.h => helper.h.inc} (100%)
 rename target/s390x/{helper.h => helper.h.inc} (100%)
 rename target/sh4/{helper.h => helper.h.inc} (100%)
 rename target/sparc/{helper.h => helper.h.inc} (100%)
 rename target/tricore/{helper.h => helper.h.inc} (100%)
 rename target/xtensa/{helper.h => helper.h.inc} (100%)

diff --git a/docs/devel/tcg-ops.rst b/docs/devel/tcg-ops.rst
index 6a166c5665..c74849a231 100644
--- a/docs/devel/tcg-ops.rst
+++ b/docs/devel/tcg-ops.rst
@@ -151,7 +151,7 @@ Types
 Helpers
 =======
 
-Helpers are registered in a guest-specific ``helper.h``,
+Helpers are registered in a guest-specific ``helper.h.inc``,
 which is processed to generate ``tcg_gen_helper_*`` functions.
 With these functions it is possible to call a function taking
 i32, i64, i128 or pointer types.
diff --git a/include/exec/helper-gen.h b/include/exec/helper-gen.h
index f7ec155699..fdb3ec39f5 100644
--- a/include/exec/helper-gen.h
+++ b/include/exec/helper-gen.h
@@ -9,7 +9,7 @@
 
 #include "exec/helper-gen-common.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-gen.h.inc"
 #undef  HELPER_H
 
diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h
index 6935cb4f16..fd061749be 100644
--- a/include/exec/helper-proto.h
+++ b/include/exec/helper-proto.h
@@ -9,7 +9,7 @@
 
 #include "exec/helper-proto-common.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-proto.h.inc"
 #undef  HELPER_H
 
diff --git a/target/alpha/helper.h b/target/alpha/helper.h.inc
similarity index 100%
rename from target/alpha/helper.h
rename to target/alpha/helper.h.inc
diff --git a/target/arm/helper.h b/target/arm/helper.h.inc
similarity index 100%
rename from target/arm/helper.h
rename to target/arm/helper.h.inc
diff --git a/target/avr/helper.h b/target/avr/helper.h.inc
similarity index 100%
rename from target/avr/helper.h
rename to target/avr/helper.h.inc
diff --git a/target/cris/helper.h b/target/cris/helper.h.inc
similarity index 100%
rename from target/cris/helper.h
rename to target/cris/helper.h.inc
diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h.inc
similarity index 100%
rename from target/hexagon/helper.h
rename to target/hexagon/helper.h.inc
diff --git a/target/hppa/helper.h b/target/hppa/helper.h.inc
similarity index 100%
rename from target/hppa/helper.h
rename to target/hppa/helper.h.inc
diff --git a/target/i386/helper.h b/target/i386/helper.h.inc
similarity index 100%
rename from target/i386/helper.h
rename to target/i386/helper.h.inc
diff --git a/target/loongarch/helper.h b/target/loongarch/helper.h.inc
similarity index 100%
rename from target/loongarch/helper.h
rename to target/loongarch/helper.h.inc
diff --git a/target/m68k/helper.h b/target/m68k/helper.h.inc
similarity index 100%
rename from target/m68k/helper.h
rename to target/m68k/helper.h.inc
diff --git a/target/microblaze/helper.h b/target/microblaze/helper.h.inc
similarity index 100%
rename from target/microblaze/helper.h
rename to target/microblaze/helper.h.inc
diff --git a/target/mips/helper.h b/target/mips/helper.h.inc
similarity index 100%
rename from target/mips/helper.h
rename to target/mips/helper.h.inc
diff --git a/target/nios2/helper.h b/target/nios2/helper.h.inc
similarity index 100%
rename from target/nios2/helper.h
rename to target/nios2/helper.h.inc
diff --git a/target/openrisc/helper.h b/target/openrisc/helper.h.inc
similarity index 100%
rename from target/openrisc/helper.h
rename to target/openrisc/helper.h.inc
diff --git a/target/ppc/helper.h b/target/ppc/helper.h.inc
similarity index 100%
rename from target/ppc/helper.h
rename to target/ppc/helper.h.inc
diff --git a/target/riscv/helper.h b/target/riscv/helper.h.inc
similarity index 100%
rename from target/riscv/helper.h
rename to target/riscv/helper.h.inc
diff --git a/target/rx/helper.h b/target/rx/helper.h.inc
similarity index 100%
rename from target/rx/helper.h
rename to target/rx/helper.h.inc
diff --git a/target/s390x/helper.h b/target/s390x/helper.h.inc
similarity index 100%
rename from target/s390x/helper.h
rename to target/s390x/helper.h.inc
diff --git a/target/sh4/helper.h b/target/sh4/helper.h.inc
similarity index 100%
rename from target/sh4/helper.h
rename to target/sh4/helper.h.inc
diff --git a/target/sparc/helper.h b/target/sparc/helper.h.inc
similarity index 100%
rename from target/sparc/helper.h
rename to target/sparc/helper.h.inc
diff --git a/target/tricore/helper.h b/target/tricore/helper.h.inc
similarity index 100%
rename from target/tricore/helper.h
rename to target/tricore/helper.h.inc
diff --git a/target/xtensa/helper.h b/target/xtensa/helper.h.inc
similarity index 100%
rename from target/xtensa/helper.h
rename to target/xtensa/helper.h.inc
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
index 1f7dd078d8..1fd9c18262 100644
--- a/target/alpha/translate.c
+++ b/target/alpha/translate.c
@@ -30,7 +30,7 @@
 #include "exec/translator.h"
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/arm/machine.c b/target/arm/machine.c
index fc4a4a4064..6d9afc5f00 100644
--- a/target/arm/machine.c
+++ b/target/arm/machine.c
@@ -462,7 +462,7 @@ static bool pmsav7_rnr_needed(void *opaque)
     CPUARMState *env = &cpu->env;
 
     /* For R profile cores pmsav7.rnr is migrated via the cpreg
-     * "RGNR" definition in helper.h. For M profile we have to
+     * "RGNR" definition in helper.h.inc. For M profile we have to
      * migrate it separately.
      */
     return arm_feature(env, ARM_FEATURE_M);
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index a68d3c7f6d..308f6a8513 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -29,7 +29,7 @@
 #include "cpregs.h"
 #include "exec/helper-proto.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/avr/translate.c b/target/avr/translate.c
index ef2edd7415..4205bf94b3 100644
--- a/target/avr/translate.c
+++ b/target/avr/translate.c
@@ -30,7 +30,7 @@
 #include "exec/log.h"
 #include "exec/translator.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/cris/translate.c b/target/cris/translate.c
index 1445cd8bb5..3b5686cbb0 100644
--- a/target/cris/translate.c
+++ b/target/cris/translate.c
@@ -37,7 +37,7 @@
 #include "exec/helper-gen.h"
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
index 708339198e..3d5c628885 100644
--- a/target/hexagon/translate.c
+++ b/target/hexagon/translate.c
@@ -33,7 +33,7 @@
 #include "genptr.h"
 #include "printinsn.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index d33813d173..f2e5ace845 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -29,7 +29,7 @@
 #include "exec/translator.h"
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 5cf14311a6..61fa64efa7 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -34,7 +34,7 @@
 
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/loongarch/translate.c b/target/loongarch/translate.c
index 3146a2d4ac..fdbb9d25ea 100644
--- a/target/loongarch/translate.c
+++ b/target/loongarch/translate.c
@@ -23,7 +23,7 @@
 TCGv cpu_gpr[32], cpu_pc;
 static TCGv cpu_lladdr, cpu_llval;
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 551ef9e52a..8594313e8f 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -34,7 +34,7 @@
 #include "exec/log.h"
 #include "fpu/softfloat.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index 7e7f837c63..ffb40421a0 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -31,7 +31,7 @@
 
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
index 74af91e4f5..1dfffe1c6f 100644
--- a/target/mips/tcg/translate.c
+++ b/target/mips/tcg/translate.c
@@ -32,7 +32,7 @@
 #include "disas/disas.h"
 #include "fpu_helper.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index a365ad8293..6f81efe90b 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -34,7 +34,7 @@
 #include "qemu/qemu-print.h"
 #include "semihosting/semihost.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
index 7760329e75..f5e8a25977 100644
--- a/target/openrisc/translate.c
+++ b/target/openrisc/translate.c
@@ -34,7 +34,7 @@
 
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 37fd431870..598759f813 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -41,7 +41,7 @@
 #include "qemu/qemu-print.h"
 #include "qapi/error.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
index 933b11c50d..e27df3c9af 100644
--- a/target/riscv/translate.c
+++ b/target/riscv/translate.c
@@ -33,7 +33,7 @@
 #include "instmap.h"
 #include "internals.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/rx/translate.c b/target/rx/translate.c
index 08cabbde61..5b60082749 100644
--- a/target/rx/translate.c
+++ b/target/rx/translate.c
@@ -28,7 +28,7 @@
 #include "exec/translator.h"
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index 7c549cd8d0..7db663c915 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -45,7 +45,7 @@
 #include "exec/log.h"
 #include "qemu/atomic128.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 49c87d7a01..df4c721cee 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -29,7 +29,7 @@
 #include "exec/log.h"
 #include "qemu/qemu-print.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index bad2ec90a0..99efd3ae87 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -33,7 +33,7 @@
 #include "exec/log.h"
 #include "asi.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
index 8e4f99478c..ed40a2c8ef 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -33,7 +33,7 @@
 #include "exec/translator.h"
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index b7386ff0f0..68495fc983 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -45,7 +45,7 @@
 
 #include "exec/log.h"
 
-#define HELPER_H "helper.h"
+#define HELPER_H "helper.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/5] tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc
  2023-06-06 14:12 [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2023-06-06 14:12 ` [PATCH 4/5] target: Rename per-target 'helper.h' -> 'helper.h.inc' Philippe Mathieu-Daudé
@ 2023-06-06 14:12 ` Philippe Mathieu-Daudé
  2023-06-06 14:29   ` Richard Henderson
  2023-06-06 17:05   ` Alex Bennée
  2023-06-06 17:02 ` [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Alex Bennée
  5 siblings, 2 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-06 14:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm, 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 as 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 'bti-crt.inc.c' as 'bti-crt.c.inc'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 tests/tcg/aarch64/bti-1.c                          | 2 +-
 tests/tcg/aarch64/bti-3.c                          | 2 +-
 tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc} | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc} (100%)

diff --git a/tests/tcg/aarch64/bti-1.c b/tests/tcg/aarch64/bti-1.c
index 61924f0d7a..99a879af23 100644
--- a/tests/tcg/aarch64/bti-1.c
+++ b/tests/tcg/aarch64/bti-1.c
@@ -2,7 +2,7 @@
  * Branch target identification, basic notskip cases.
  */
 
-#include "bti-crt.inc.c"
+#include "bti-crt.c.inc"
 
 static void skip2_sigill(int sig, siginfo_t *info, ucontext_t *uc)
 {
diff --git a/tests/tcg/aarch64/bti-3.c b/tests/tcg/aarch64/bti-3.c
index a852856d9a..8c534c09d7 100644
--- a/tests/tcg/aarch64/bti-3.c
+++ b/tests/tcg/aarch64/bti-3.c
@@ -2,7 +2,7 @@
  * BTI vs PACIASP
  */
 
-#include "bti-crt.inc.c"
+#include "bti-crt.c.inc"
 
 static void skip2_sigill(int sig, siginfo_t *info, ucontext_t *uc)
 {
diff --git a/tests/tcg/aarch64/bti-crt.inc.c b/tests/tcg/aarch64/bti-crt.c.inc
similarity index 100%
rename from tests/tcg/aarch64/bti-crt.inc.c
rename to tests/tcg/aarch64/bti-crt.c.inc
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc
  2023-06-06 14:12 ` [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc Philippe Mathieu-Daudé
@ 2023-06-06 14:29   ` Richard Henderson
  2023-06-06 18:08     ` Warner Losh
  0 siblings, 1 reply; 19+ messages in thread
From: Richard Henderson @ 2023-06-06 14:29 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm, Warner Losh

On 6/6/23 07:12, 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 as 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 the included 'elfcore.c' as 'elfcore.c.inc'.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   bsd-user/elfload.c                    | 2 +-
>   bsd-user/{elfcore.c => elfcore.c.inc} | 0
>   2 files changed, 1 insertion(+), 1 deletion(-)
>   rename bsd-user/{elfcore.c => elfcore.c.inc} (100%)

Assuming Warner doesn't simply want to merge this small file, or compile it separately. It 
isn't actually included more than once.


r~


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc
  2023-06-06 14:12 ` [PATCH 5/5] tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc Philippe Mathieu-Daudé
@ 2023-06-06 14:29   ` Richard Henderson
  2023-06-06 17:05   ` Alex Bennée
  1 sibling, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-06-06 14:29 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

On 6/6/23 07:12, 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 as 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 'bti-crt.inc.c' as 'bti-crt.c.inc'.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   tests/tcg/aarch64/bti-1.c                          | 2 +-
>   tests/tcg/aarch64/bti-3.c                          | 2 +-
>   tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc} | 0
>   3 files changed, 2 insertions(+), 2 deletions(-)
>   rename tests/tcg/aarch64/{bti-crt.inc.c => bti-crt.c.inc} (100%)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc'
  2023-06-06 14:12 ` [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc' Philippe Mathieu-Daudé
@ 2023-06-06 14:37   ` Richard Henderson
  2023-06-06 15:49     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 19+ messages in thread
From: Richard Henderson @ 2023-06-06 14:37 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

On 6/6/23 07:12, 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 as 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 the included templates as '.h.inc'.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

FYI, after yesterday's tcg pr, we can do more than this.  These fragments no longer have 
to be all included into one common helper.h. Each translate-foo.c can include only the 
helper-foo.h.inc bits that they need, and the bits need not be visible to the rest of the 
front end.

It was something that I had in mind when splitting include/exec/helper-gen.h, but the 
patch set was already large enough.

The renaming to .h.inc would have been the first step, anyway.


r~


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/5] target/i386: Rename helper template headers as '.h.inc'
  2023-06-06 14:12 ` [PATCH 3/5] target/i386: " Philippe Mathieu-Daudé
@ 2023-06-06 14:38   ` Richard Henderson
  0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-06-06 14:38 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

On 6/6/23 07:12, 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 as 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 the included templates as '.h.inc'.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   target/i386/helper.h                                      | 6 +++---
>   target/i386/{ops_sse_header.h => ops_sse_header.h.inc}    | 0
>   ...hift_helper_template.h => shift_helper_template.h.inc} | 0
>   .../{cc_helper_template.h => cc_helper_template.h.inc}    | 0
>   target/i386/tcg/cc_helper.c                               | 8 ++++----
>   target/i386/tcg/int_helper.c                              | 8 ++++----
>   6 files changed, 11 insertions(+), 11 deletions(-)
>   rename target/i386/{ops_sse_header.h => ops_sse_header.h.inc} (100%)
>   rename target/i386/{shift_helper_template.h => shift_helper_template.h.inc} (100%)
>   rename target/i386/tcg/{cc_helper_template.h => cc_helper_template.h.inc} (100%)

Move to tcg/ at the same time?

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/5] target: Rename per-target 'helper.h' -> 'helper.h.inc'
  2023-06-06 14:12 ` [PATCH 4/5] target: Rename per-target 'helper.h' -> 'helper.h.inc' Philippe Mathieu-Daudé
@ 2023-06-06 14:43   ` Richard Henderson
  2023-06-08  6:46     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 19+ messages in thread
From: Richard Henderson @ 2023-06-06 14:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

On 6/6/23 07:12, 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 as 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 the included 'helper.h' as 'helper.h.inc' for
> all targets (updating the documentation).
> 
> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---

A bulk patch like this isn't ideal.  Targets that have a tcg/ subdir should have 
helper.h.inc moved into there.  At the end, include/exec/helper-gen.h and 
include/exec/helper-proto.h become unused and go away.


r~


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc'
  2023-06-06 14:37   ` Richard Henderson
@ 2023-06-06 15:49     ` Philippe Mathieu-Daudé
  2023-06-06 15:55       ` Peter Maydell
  2023-06-06 16:31       ` Richard Henderson
  0 siblings, 2 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-06 15:49 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

On 6/6/23 16:37, Richard Henderson wrote:
> On 6/6/23 07:12, 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 as 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 the included templates as '.h.inc'.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
> FYI, after yesterday's tcg pr, we can do more than this.  These 
> fragments no longer have to be all included into one common helper.h. 
> Each translate-foo.c can include only the helper-foo.h.inc bits that 
> they need, and the bits need not be visible to the rest of the front end.

Don't we need foo fully converted to decodetree first? Otherwise
generic translate code can call foo helpers, so needs their prototype
declaration.

For example in translate-a64.c handle_msr_i(SVCR) calls
gen_helper_set_svcr() which is declared in helper-sme.h.

> It was something that I had in mind when splitting 
> include/exec/helper-gen.h, but the patch set was already large enough.
> 
> The renaming to .h.inc would have been the first step, anyway.
> 
> 
> r~



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc'
  2023-06-06 15:49     ` Philippe Mathieu-Daudé
@ 2023-06-06 15:55       ` Peter Maydell
  2023-06-06 16:31       ` Richard Henderson
  1 sibling, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2023-06-06 15:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Richard Henderson, qemu-devel, qemu-s390x, qemu-ppc, qemu-riscv,
	qemu-arm

On Tue, 6 Jun 2023 at 16:50, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 6/6/23 16:37, Richard Henderson wrote:
> > On 6/6/23 07:12, 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 as 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 the included templates as '.h.inc'.
> >>
> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> >
> > Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> >
> > FYI, after yesterday's tcg pr, we can do more than this.  These
> > fragments no longer have to be all included into one common helper.h.
> > Each translate-foo.c can include only the helper-foo.h.inc bits that
> > they need, and the bits need not be visible to the rest of the front end.
>
> Don't we need foo fully converted to decodetree first? Otherwise
> generic translate code can call foo helpers, so needs their prototype
> declaration.
>
> For example in translate-a64.c handle_msr_i(SVCR) calls
> gen_helper_set_svcr() which is declared in helper-sme.h.

That's unrelated to decodetree -- the decodetree conversion for
that instruction still has code in translate-a64.c which
calls gen_helper_set_svcr(), it's just in a different function.

https://patchew.org/QEMU/20230602155223.2040685-1-peter.maydell@linaro.org/20230602155223.2040685-6-peter.maydell@linaro.org/

thanks
-- PMM


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc'
  2023-06-06 15:49     ` Philippe Mathieu-Daudé
  2023-06-06 15:55       ` Peter Maydell
@ 2023-06-06 16:31       ` Richard Henderson
  1 sibling, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-06-06 16:31 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

On 6/6/23 08:49, Philippe Mathieu-Daudé wrote:
> For example in translate-a64.c handle_msr_i(SVCR) calls
> gen_helper_set_svcr() which is declared in helper-sme.h.

The placement in helper-sme.h was not done with consideration as to which compilation 
units might need to use it, since that wasn't a thing at the time.


r~


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files
  2023-06-06 14:12 [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2023-06-06 14:12 ` [PATCH 5/5] tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc Philippe Mathieu-Daudé
@ 2023-06-06 17:02 ` Alex Bennée
  5 siblings, 0 replies; 19+ messages in thread
From: Alex Bennée @ 2023-06-06 17:02 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm


Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> Follow the convention to use the .inc extension for .c/.h files
> re-included, as docummented in Coding Style since commit 6a0057aa22:
>
>     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.
>
> Most of the codebase already uses this extension:
>
>   $ git ls-files | fgrep .inc | wc -l
>        155

Ahh prescient as I've just added this hack to the loc tool I'm using:

  modified   src/lib.rs
  @@ -338,7 +338,7 @@ pub fn lang_from_ext(filepath: &str) -> Lang {
           "at" => AmbientTalk,
           "awk" => Awk,
           "bat" | "btm" | "cmd" => Batch,
  -        "c" | "ec" | "pgc" => C,
  +        "c" | "ec" | "pgc" | "inc" => C,
           "cc" | "cpp" | "cxx" | "c++" | "pcc" => Cpp,
           "cfc" => ColdFusionScript,
           "cmake" => CMake,

while gathering loc stats for the project.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/5] tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc
  2023-06-06 14:12 ` [PATCH 5/5] tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc Philippe Mathieu-Daudé
  2023-06-06 14:29   ` Richard Henderson
@ 2023-06-06 17:05   ` Alex Bennée
  1 sibling, 0 replies; 19+ messages in thread
From: Alex Bennée @ 2023-06-06 17:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm


Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> 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 as 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 'bti-crt.inc.c' as 'bti-crt.c.inc'.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc
  2023-06-06 14:29   ` Richard Henderson
@ 2023-06-06 18:08     ` Warner Losh
  2023-06-06 19:08       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 19+ messages in thread
From: Warner Losh @ 2023-06-06 18:08 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]

On Tue, Jun 6, 2023 at 8:29 AM Richard Henderson <
richard.henderson@linaro.org> wrote:

> On 6/6/23 07:12, 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 as 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 the included 'elfcore.c' as 'elfcore.c.inc'.
> >
> > Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> > ---
> >   bsd-user/elfload.c                    | 2 +-
> >   bsd-user/{elfcore.c => elfcore.c.inc} | 0
> >   2 files changed, 1 insertion(+), 1 deletion(-)
> >   rename bsd-user/{elfcore.c => elfcore.c.inc} (100%)
>
> Assuming Warner doesn't simply want to merge this small file, or compile
> it separately. It
> isn't actually included more than once.
>

I'd much rather inline it in elfload.c I did the include trick as a
short-term
hack so I didn't have to upstream ALL of the core dump support to get
progress on other things in elfload.c.

So rather than rename it (which will cause some grief to me when I merge
things, but not a huge amount), it would be better to just inline what's
upstream now and I'll reconcile that when I upstream core dump support.

Warner

[-- Attachment #2: Type: text/html, Size: 2220 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc
  2023-06-06 18:08     ` Warner Losh
@ 2023-06-06 19:08       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-06 19:08 UTC (permalink / raw)
  To: Warner Losh, Richard Henderson
  Cc: qemu-devel, qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

On 6/6/23 20:08, Warner Losh wrote:
> On Tue, Jun 6, 2023 at 8:29 AM Richard Henderson 
> <richard.henderson@linaro.org <mailto:richard.henderson@linaro.org>> wrote:
> 
>     On 6/6/23 07:12, 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 as 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 the included 'elfcore.c' as 'elfcore.c.inc'.
>      >
>      > Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org
>     <mailto:philmd@linaro.org>>
>      > ---
>      >   bsd-user/elfload.c                    | 2 +-
>      >   bsd-user/{elfcore.c => elfcore.c.inc} | 0
>      >   2 files changed, 1 insertion(+), 1 deletion(-)
>      >   rename bsd-user/{elfcore.c => elfcore.c.inc} (100%)
> 
>     Assuming Warner doesn't simply want to merge this small file, or
>     compile it separately. It
>     isn't actually included more than once.
> 
> 
> I'd much rather inline it in elfload.c I did the include trick as a 
> short-term
> hack so I didn't have to upstream ALL of the core dump support to get
> progress on other things in elfload.c.
> 
> So rather than rename it (which will cause some grief to me when I merge
> things, but not a huge amount), it would be better to just inline what's
> upstream now and I'll reconcile that when I upstream core dump support.

I'll just drop it in favor of yours.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/5] target: Rename per-target 'helper.h' -> 'helper.h.inc'
  2023-06-06 14:43   ` Richard Henderson
@ 2023-06-08  6:46     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-06-08  6:46 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-s390x, qemu-ppc, qemu-riscv, qemu-arm

On 6/6/23 16:43, Richard Henderson wrote:
> On 6/6/23 07:12, 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 as 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 the included 'helper.h' as 'helper.h.inc' for
>> all targets (updating the documentation).
>>
>> Suggested-by: Richard Henderson<richard.henderson@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
>> ---
> 
> A bulk patch like this isn't ideal.
Unfortunately these headers (declaring HELPER_H path) are used
by all targets:

  include/exec/helper-gen.h
  include/exec/helper-proto.h

So this has to be bulk.

> Targets that have a tcg/ subdir 
> should have helper.h.inc moved into there.

OK.

> At the end, 
> include/exec/helper-gen.h and include/exec/helper-proto.h become unused 
> and go away.

Ah, you are suggesting to first inline these helpers in each target,
then move. Hmm OK I'll try.


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-06-08  6:47 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 14:12 [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Philippe Mathieu-Daudé
2023-06-06 14:12 ` [PATCH 1/5] bsd-user: Rename elfcore.c -> elfcore.c.inc Philippe Mathieu-Daudé
2023-06-06 14:29   ` Richard Henderson
2023-06-06 18:08     ` Warner Losh
2023-06-06 19:08       ` Philippe Mathieu-Daudé
2023-06-06 14:12 ` [PATCH 2/5] target/arm: Rename helper template headers as '.h.inc' Philippe Mathieu-Daudé
2023-06-06 14:37   ` Richard Henderson
2023-06-06 15:49     ` Philippe Mathieu-Daudé
2023-06-06 15:55       ` Peter Maydell
2023-06-06 16:31       ` Richard Henderson
2023-06-06 14:12 ` [PATCH 3/5] target/i386: " Philippe Mathieu-Daudé
2023-06-06 14:38   ` Richard Henderson
2023-06-06 14:12 ` [PATCH 4/5] target: Rename per-target 'helper.h' -> 'helper.h.inc' Philippe Mathieu-Daudé
2023-06-06 14:43   ` Richard Henderson
2023-06-08  6:46     ` Philippe Mathieu-Daudé
2023-06-06 14:12 ` [PATCH 5/5] tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc Philippe Mathieu-Daudé
2023-06-06 14:29   ` Richard Henderson
2023-06-06 17:05   ` Alex Bennée
2023-06-06 17:02 ` [PATCH 0/5] misc: Enforce .[ch].inc extension for re-included .c/.h files Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.