diff mbox series

[v2,20/20] disas/nanomips: Rename nanomips.cpp to nanomips.c

Message ID 20220905095522.66941-21-milica.lazarevic@syrmia.com (mailing list archive)
State New, archived
Headers show
Series Convert nanoMIPS disassembler from C++ to C | expand

Commit Message

Milica Lazarevic Sept. 5, 2022, 9:55 a.m. UTC
Now that everything is converted to the C code, nanomips.cpp file is
renamed to "nanomips.c". Therefore, meson.build file is also changed.

The explicit cast after the call to g_malloc() is no longer needed
because the file now compiles as a C code.

Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com>
---
 disas/meson.build                  | 2 +-
 disas/{nanomips.cpp => nanomips.c} | 6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)
 rename disas/{nanomips.cpp => nanomips.c} (99%)

Comments

Richard Henderson Sept. 5, 2022, 11:59 a.m. UTC | #1
On 9/5/22 10:55, Milica Lazarevic wrote:
> Now that everything is converted to the C code, nanomips.cpp file is
> renamed to "nanomips.c". Therefore, meson.build file is also changed.
> 
> The explicit cast after the call to g_malloc() is no longer needed
> because the file now compiles as a C code.
> 
> Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com>
> ---
>   disas/meson.build                  | 2 +-
>   disas/{nanomips.cpp => nanomips.c} | 6 +-----
>   2 files changed, 2 insertions(+), 6 deletions(-)
>   rename disas/{nanomips.cpp => nanomips.c} (99%)

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

> @@ -525,11 +525,7 @@ static const char *GPR(uint64 reg, struct Dis_info *info)
>   static char *save_restore_list(uint64 rt, uint64 count, uint64 gp,
>                                  struct Dis_info *info)
>   {
> -    /*
> -     * Currently, this file compiles as a cpp file, so the explicit cast here
> -     * is necessary. Later, the cast will be removed.
> -     */
> -    char *str = (char *)g_malloc(200);
> +    char *str = g_malloc(200);

... noting that this change is obviated by the use of g_strjoinv.


r~
diff mbox series

Patch

diff --git a/disas/meson.build b/disas/meson.build
index ba22f7cbcd..1977f5cd92 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -5,7 +5,7 @@  common_ss.add(when: 'CONFIG_HPPA_DIS', if_true: files('hppa.c'))
 common_ss.add(when: 'CONFIG_M68K_DIS', if_true: files('m68k.c'))
 common_ss.add(when: 'CONFIG_MICROBLAZE_DIS', if_true: files('microblaze.c'))
 common_ss.add(when: 'CONFIG_MIPS_DIS', if_true: files('mips.c'))
-common_ss.add(when: 'CONFIG_NANOMIPS_DIS', if_true: files('nanomips.cpp'))
+common_ss.add(when: 'CONFIG_NANOMIPS_DIS', if_true: files('nanomips.c'))
 common_ss.add(when: 'CONFIG_NIOS2_DIS', if_true: files('nios2.c'))
 common_ss.add(when: 'CONFIG_RISCV_DIS', if_true: files('riscv.c'))
 common_ss.add(when: 'CONFIG_SH4_DIS', if_true: files('sh4.c'))
diff --git a/disas/nanomips.cpp b/disas/nanomips.c
similarity index 99%
rename from disas/nanomips.cpp
rename to disas/nanomips.c
index 7315484464..afe9ae7cc2 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.c
@@ -525,11 +525,7 @@  static const char *GPR(uint64 reg, struct Dis_info *info)
 static char *save_restore_list(uint64 rt, uint64 count, uint64 gp,
                                struct Dis_info *info)
 {
-    /*
-     * Currently, this file compiles as a cpp file, so the explicit cast here
-     * is necessary. Later, the cast will be removed.
-     */
-    char *str = (char *)g_malloc(200);
+    char *str = g_malloc(200);
     str[0] = '\0';
 
     for (uint64 counter = 0; counter != count; counter++) {