Move the entire contents of target-info.c into target-info.h,
marking each function inline.

Signed-off-by: Richard Henderson <[email protected]>
---
 include/qemu/target-info.h | 82 +++++++++++++++++++++++++++------
 target-info.c              | 93 --------------------------------------
 meson.build                |  1 -
 3 files changed, 68 insertions(+), 108 deletions(-)
 delete mode 100644 target-info.c

diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h
index d8d2194d9b..2c9f5c78fb 100644
--- a/include/qemu/target-info.h
+++ b/include/qemu/target-info.h
@@ -45,14 +45,20 @@ TargetInfo target_info;
  *
  * Returns: Canonical target name (i.e. "i386").
  */
-const char *target_name(void);
+static inline const char *target_name(void)
+{
+    return target_info.target_name;
+}
 
 /**
  * target_long_bits:
  *
  * Returns: number of bits in a long type for this target (i.e. 64).
  */
-unsigned target_long_bits(void);
+static inline unsigned target_long_bits(void)
+{
+    return target_info.long_bits;
+}
 
 /**
  * target_machine_typename:
@@ -60,21 +66,30 @@ unsigned target_long_bits(void);
  * Returns: Name of the QOM interface implemented by machines
  *          usable on this target binary.
  */
-const char *target_machine_typename(void);
+static inline const char *target_machine_typename(void)
+{
+    return target_info.machine_typename;
+}
 
 /**
  * target_cpu_type:
  *
  * Returns: target CPU base QOM type name (i.e. TYPE_X86_CPU).
  */
-const char *target_cpu_type(void);
+static inline const char *target_cpu_type(void)
+{
+    return target_info.cpu_type;
+}
 
 /**
  * target_endian_mode:
  *
  * Returns: QAPI EndianMode enum (e.g. ENDIAN_MODE_LITTLE).
  */
-EndianMode target_endian_mode(void);
+static inline EndianMode target_endian_mode(void)
+{
+    return target_info.endianness;
+}
 
 /**
  * target_big_endian:
@@ -86,62 +101,101 @@ EndianMode target_endian_mode(void);
  * the target, so please do *not* use this function unless you  know very
  * well what you are doing!
  */
-bool target_big_endian(void);
+static inline bool target_big_endian(void)
+{
+    return target_endian_mode() == ENDIAN_MODE_BIG;
+}
 
 /**
  * target_arch:
  *
  * Returns: QAPI SysEmuTarget enum (e.g. SYS_EMU_TARGET_X86_64).
  */
-SysEmuTarget target_arch(void);
+static inline SysEmuTarget target_arch(void)
+{
+    return target_info.target_arch;
+}
 
 /**
  * target_base_arm:
  *
  * Returns whether the target architecture is ARM or Aarch64.
  */
-bool target_base_arm(void);
+static inline bool target_base_arm(void)
+{
+    switch (target_arch()) {
+    case SYS_EMU_TARGET_ARM:
+    case SYS_EMU_TARGET_AARCH64:
+        return true;
+    default:
+        return false;
+    }
+}
 
 /**
  * target_arm:
  *
  * Returns whether the target architecture is ARM (32-bit, not Aarch64).
  */
-bool target_arm(void);
+static inline bool target_arm(void)
+{
+    return target_arch() == SYS_EMU_TARGET_ARM;
+}
 
 /**
  * target_aarch64:
  *
  * Returns whether the target architecture is Aarch64.
  */
-bool target_aarch64(void);
+static inline bool target_aarch64(void)
+{
+    return target_arch() == SYS_EMU_TARGET_AARCH64;
+}
 
 /**
  * target_base_ppc:
  *
  * Returns whether the target architecture is PowerPC 32-bit or 64-bit.
  */
-bool target_base_ppc(void);
+static inline bool target_base_ppc(void)
+{
+    switch (target_arch()) {
+    case SYS_EMU_TARGET_PPC:
+    case SYS_EMU_TARGET_PPC64:
+        return true;
+    default:
+        return false;
+    }
+}
 
 /**
  * target_ppc:
  *
  * Returns whether the target architecture is PowerPC 32-bit.
  */
-bool target_ppc(void);
+static inline bool target_ppc(void)
+{
+    return target_arch() == SYS_EMU_TARGET_PPC;
+}
 
 /**
  * target_ppc64:
  *
  * Returns whether the target architecture is PowerPC 64-bit.
  */
-bool target_ppc64(void);
+static inline bool target_ppc64(void)
+{
+    return target_arch() == SYS_EMU_TARGET_PPC64;
+}
 
 /**
  * target_s390x:
  *
  * Returns whether the target architecture is S390x.
  */
-bool target_s390x(void);
+static inline bool target_s390x(void)
+{
+    return target_arch() == SYS_EMU_TARGET_S390X;
+}
 
 #endif
diff --git a/target-info.c b/target-info.c
deleted file mode 100644
index f02a033584..0000000000
--- a/target-info.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * QEMU target info helpers
- *
- *  Copyright (c) Linaro
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#include "qemu/osdep.h"
-#include "qemu/target-info.h"
-#include "qapi/error.h"
-
-const char *target_name(void)
-{
-    return target_info.target_name;
-}
-
-unsigned target_long_bits(void)
-{
-    return target_info.long_bits;
-}
-
-SysEmuTarget target_arch(void)
-{
-    return target_info.target_arch;
-}
-
-const char *target_cpu_type(void)
-{
-    return target_info.cpu_type;
-}
-
-const char *target_machine_typename(void)
-{
-    return target_info.machine_typename;
-}
-
-EndianMode target_endian_mode(void)
-{
-    return target_info.endianness;
-}
-
-bool target_big_endian(void)
-{
-    return target_endian_mode() == ENDIAN_MODE_BIG;
-}
-
-bool target_base_arm(void)
-{
-    switch (target_arch()) {
-    case SYS_EMU_TARGET_ARM:
-    case SYS_EMU_TARGET_AARCH64:
-        return true;
-    default:
-        return false;
-    }
-}
-
-bool target_arm(void)
-{
-    return target_arch() == SYS_EMU_TARGET_ARM;
-}
-
-bool target_aarch64(void)
-{
-    return target_arch() == SYS_EMU_TARGET_AARCH64;
-}
-
-bool target_base_ppc(void)
-{
-    switch (target_arch()) {
-    case SYS_EMU_TARGET_PPC:
-    case SYS_EMU_TARGET_PPC64:
-        return true;
-    default:
-        return false;
-    }
-}
-
-bool target_ppc(void)
-{
-    return target_arch() == SYS_EMU_TARGET_PPC;
-}
-
-bool target_ppc64(void)
-{
-    return target_arch() == SYS_EMU_TARGET_PPC64;
-}
-
-bool target_s390x(void)
-{
-    return target_arch() == SYS_EMU_TARGET_S390X;
-}
diff --git a/meson.build b/meson.build
index 9a804dc810..aad149cdb4 100644
--- a/meson.build
+++ b/meson.build
@@ -3868,7 +3868,6 @@ endif
 common_ss.add(pagevary)
 system_ss.add(files('page-vary-system.c'))
 
-common_ss.add(files('target-info.c'))
 system_ss.add(tinfoqom)
 
 subdir('backends')
-- 
2.43.0


Reply via email to