summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/cpu.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-01-19 18:13:34 +0100
committerBeno�t Ganne <bganne@cisco.com>2022-01-24 08:50:09 +0000
commit63c31e0a609bb3fe5cd61b05dac7b790a9282b8d (patch)
tree0aa588f8b47bbaaeddd49a09f1d66790f8c1adc0 /src/vppinfra/cpu.c
parent7e7b030c80d640797a142b113beda856be7abf0b (diff)
vppinfra: fix compilation on riscv
Type: fix Change-Id: I2bc58a711c9429d7989bfd0bfccd289d43fc35d0 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/cpu.c')
-rw-r--r--src/vppinfra/cpu.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/vppinfra/cpu.c b/src/vppinfra/cpu.c
index e98d2d0cc1d..4f6b46f62de 100644
--- a/src/vppinfra/cpu.c
+++ b/src/vppinfra/cpu.c
@@ -198,7 +198,7 @@ format_cpu_model_name (u8 * s, va_list * args)
#endif
}
-
+#if defined(__x86_64__) || defined(__aarch64__)
static inline char const *
flag_skip_prefix (char const *flag, const char *pfx, int len)
{
@@ -206,20 +206,22 @@ flag_skip_prefix (char const *flag, const char *pfx, int len)
return flag + len - 1;
return flag;
}
+#endif
__clib_export u8 *
-format_cpu_flags (u8 * s, va_list * args)
+format_cpu_flags (u8 *s, va_list *args)
{
#if defined(__x86_64__)
-#define _(flag, func, reg, bit) \
- if (clib_cpu_supports_ ## flag()) \
- s = format (s, "%s ", flag_skip_prefix(#flag, "x86_", sizeof("x86_")));
+#define _(flag, func, reg, bit) \
+ if (clib_cpu_supports_##flag ()) \
+ s = format (s, "%s ", flag_skip_prefix (#flag, "x86_", sizeof ("x86_")));
foreach_x86_64_flags return s;
#undef _
#elif defined(__aarch64__)
-#define _(flag, bit) \
- if (clib_cpu_supports_ ## flag()) \
- s = format (s, "%s ", flag_skip_prefix(#flag, "aarch64_", sizeof("aarch64_")));
+#define _(flag, bit) \
+ if (clib_cpu_supports_##flag ()) \
+ s = format (s, "%s ", \
+ flag_skip_prefix (#flag, "aarch64_", sizeof ("aarch64_")));
foreach_aarch64_flags return s;
#undef _
#else /* ! ! __x86_64__ && ! __aarch64__ */