diff mbox series

[RFC,09/11] user: Replace TARGET_NAME -> target_name()

Message ID 20250305005225.95051-10-philmd@linaro.org
State New
Headers show
Series qemu: Remove TARGET_NAME definition | expand

Commit Message

Philippe Mathieu-Daudé March 5, 2025, 12:52 a.m. UTC
In order to avoid the target-specific TARGET_NAME definition,
replace it by the generic target_name() helper.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 bsd-user/main.c   |  9 ++++++---
 linux-user/main.c | 12 +++++++-----
 2 files changed, 13 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index fdb160bed0f..683003c2d52 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -25,6 +25,7 @@ 
 #include "qemu/help-texts.h"
 #include "qemu/units.h"
 #include "qemu/accel.h"
+#include "qemu/arch_info.h"
 #include "qemu-version.h"
 #include <machine/trap.h>
 
@@ -150,9 +151,11 @@  void cpu_loop(CPUArchState *env)
 
 static void usage(void)
 {
-    printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION
+    const char *target = target_name();
+
+    printf("qemu-%s version " QEMU_FULL_VERSION
            "\n" QEMU_COPYRIGHT "\n"
-           "usage: qemu-" TARGET_NAME " [options] program [arguments...]\n"
+           "usage: qemu-%s [options] program [arguments...]\n"
            "BSD CPU emulator (compiled for %s emulation)\n"
            "\n"
            "Standard options:\n"
@@ -188,7 +191,7 @@  static void usage(void)
            "\n"
            QEMU_HELP_BOTTOM "\n"
            ,
-           TARGET_NAME,
+           target, target, target,
            interp_prefix,
            target_dflssiz);
     exit(1);
diff --git a/linux-user/main.c b/linux-user/main.c
index 5c74c52cc52..0e4722ea273 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -21,6 +21,7 @@ 
 #include "qemu/help-texts.h"
 #include "qemu/units.h"
 #include "qemu/accel.h"
+#include "qemu/arch_info.h"
 #include "qemu-version.h"
 #include <sys/syscall.h>
 #include <sys/resource.h>
@@ -432,8 +433,8 @@  static void handle_arg_strace(const char *arg)
 
 static void handle_arg_version(const char *arg)
 {
-    printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION
-           "\n" QEMU_COPYRIGHT "\n");
+    printf("qemu-%s version " QEMU_FULL_VERSION
+           "\n" QEMU_COPYRIGHT "\n", target_name());
     exit(EXIT_SUCCESS);
 }
 
@@ -543,14 +544,15 @@  static const struct qemu_argument arg_table[] = {
 static void usage(int exitcode)
 {
     const struct qemu_argument *arginfo;
+    const char *target = target_name();
     int maxarglen;
     int maxenvlen;
 
-    printf("usage: qemu-" TARGET_NAME " [options] program [arguments...]\n"
-           "Linux CPU emulator (compiled for " TARGET_NAME " emulation)\n"
+    printf("usage: qemu-%s [options] program [arguments...]\n"
+           "Linux CPU emulator (compiled for %s emulation)\n"
            "\n"
            "Options and associated environment variables:\n"
-           "\n");
+           "\n", target, target);
 
     /* Calculate column widths. We must always have at least enough space
      * for the column header.