target/tricore/cpu.c | 8 ++++---- target/tricore/cpu.h | 2 +- target/tricore/helper.c | 4 ++-- target/tricore/op_helper.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-)
While upgrading capstone to v5
<https://github.com/Homebrew/homebrew-core/pull/135948>, there was some
name clash with the tricore_feature in capstone (which was introduced in this
PR <https://github.com/capstone-engine/capstone/pull/1973>), thus rename
tricore_feature to is_tricore_feature_enabled.
Build error log is below
/opt/homebrew/Cellar/capstone/5.0/include/capstone/tricore.h:561:3: error:
redefinition of 'tricore_feature' as different kind of symbol
} tricore_feature;
^
../target/tricore/cpu.h:261:19: note: previous definition is here
static inline int tricore_feature(CPUTriCoreState *env, int feature)
^
1 error generated.
Let me know if that makes sense. Thanks!
From c50272465a4eaba85afaf41e0c3340c7d3ffb894 Mon Sep 17 00:00:00 2001
From: Rui Chen <rui@chenrui.dev>
Date: Thu, 6 Jul 2023 11:13:59 -0400
Subject: [PATCH] chore: rename `tricore_feature` to
`is_tricore_feature_enabled`
Signed-off-by: Rui Chen <rui@chenrui.dev>
---
target/tricore/cpu.c | 8 ++++----
target/tricore/cpu.h | 2 +-
target/tricore/helper.c | 4 ++--
target/tricore/op_helper.c | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index f15169bd1b47b909d45ecdfacc3cad9679f8f033..d6b2aeac12207705d0fa98a51c4eeccc0ae16b50 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -104,18 +104,18 @@ static void tricore_cpu_realizefn(DeviceState *dev, Error **errp)
}
/* Some features automatically imply others */
- if (tricore_feature(env, TRICORE_FEATURE_162)) {
+ if (is_tricore_feature_enabled(env, TRICORE_FEATURE_162)) {
set_feature(env, TRICORE_FEATURE_161);
}
- if (tricore_feature(env, TRICORE_FEATURE_161)) {
+ if (is_tricore_feature_enabled(env, TRICORE_FEATURE_161)) {
set_feature(env, TRICORE_FEATURE_16);
}
- if (tricore_feature(env, TRICORE_FEATURE_16)) {
+ if (is_tricore_feature_enabled(env, TRICORE_FEATURE_16)) {
set_feature(env, TRICORE_FEATURE_131);
}
- if (tricore_feature(env, TRICORE_FEATURE_131)) {
+ if (is_tricore_feature_enabled(env, TRICORE_FEATURE_131)) {
set_feature(env, TRICORE_FEATURE_13);
}
cpu_reset(cs);
diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
index a50b91cc362ac534bc1ebd54d50de3840c4e5461..5da884771b8446767f6da36b72f1e3d1c2777ad6 100644
--- a/target/tricore/cpu.h
+++ b/target/tricore/cpu.h
@@ -277,7 +277,7 @@ enum tricore_features {
TRICORE_FEATURE_162,
};
-static inline int tricore_feature(CPUTriCoreState *env, int feature)
+static inline int is_tricore_feature_enabled(CPUTriCoreState *env, int feature)
{
return (env->features & (1ULL << feature)) != 0;
}
diff --git a/target/tricore/helper.c b/target/tricore/helper.c
index 951024d49167b73e35ed961a940145b022332496..14cd07c2e3e52ea2749a069c30b838f34b208786 100644
--- a/target/tricore/helper.c
+++ b/target/tricore/helper.c
@@ -155,7 +155,7 @@ void psw_write(CPUTriCoreState *env, uint32_t val)
#define FIELD_GETTER_WITH_FEATURE(NAME, REG, FIELD, FEATURE) \
uint32_t NAME(CPUTriCoreState *env) \
{ \
- if (tricore_feature(env, TRICORE_FEATURE_##FEATURE)) { \
+ if (is_tricore_feature_enabled(env, TRICORE_FEATURE_##FEATURE)) { \
return FIELD_EX32(env->REG, REG, FIELD ## _ ## FEATURE); \
} \
return FIELD_EX32(env->REG, REG, FIELD ## _13); \
@@ -170,7 +170,7 @@ uint32_t NAME(CPUTriCoreState *env) \
#define FIELD_SETTER_WITH_FEATURE(NAME, REG, FIELD, FEATURE) \
void NAME(CPUTriCoreState *env, uint32_t val) \
{ \
- if (tricore_feature(env, TRICORE_FEATURE_##FEATURE)) { \
+ if (is_tricore_feature_enabled(env, TRICORE_FEATURE_##FEATURE)) { \
env->REG = FIELD_DP32(env->REG, REG, FIELD ## _ ## FEATURE, val); \
} \
env->REG = FIELD_DP32(env->REG, REG, FIELD ## _13, val); \
diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
index 821a4b67cb6dbb4f5f51886fb4ca890ff94bc0e2..5f7fc8aafb90ca50eae9f208d2b5266cc21a2685 100644
--- a/target/tricore/op_helper.c
+++ b/target/tricore/op_helper.c
@@ -2584,7 +2584,7 @@ void helper_ret(CPUTriCoreState *env)
/* PCXI = new_PCXI; */
env->PCXI = new_PCXI;
- if (tricore_feature(env, TRICORE_FEATURE_131)) {
+ if (is_tricore_feature_enabled(env, TRICORE_FEATURE_131)) {
/* PSW = {new_PSW[31:26], PSW[25:24], new_PSW[23:0]}; */
psw_write(env, (new_PSW & ~(0x3000000)) + (psw & (0x3000000)));
} else { /* TRICORE_FEATURE_13 only */
@@ -2695,7 +2695,7 @@ void helper_rfm(CPUTriCoreState *env)
env->gpr_a[10] = cpu_ldl_data(env, env->DCX+8);
env->gpr_a[11] = cpu_ldl_data(env, env->DCX+12);
- if (tricore_feature(env, TRICORE_FEATURE_131)) {
+ if (is_tricore_feature_enabled(env, TRICORE_FEATURE_131)) {
env->DBGTCR = 0;
}
}
Hi Rui, On Thu, Jul 06, 2023 at 12:59:55PM -0400, Rui Chen wrote: > While upgrading capstone to v5, there was some name clash with the > tricore_feature in capstone (which was introduced in this PR), thus rename > tricore_feature to is_tricore_feature_enabled. > > Build error log is below > > /opt/homebrew/Cellar/capstone/5.0/include/capstone/tricore.h:561:3: error: > redefinition of 'tricore_feature' as different kind of symbol > } tricore_feature; > ^ > ../target/tricore/cpu.h:261:19: note: previous definition is here > static inline int tricore_feature(CPUTriCoreState *env, int feature) > ^ > 1 error generated. I ran into the same problem when trying out capstone. I think a better name would be tricore_has_feature() to match has_feature() in target/tricore/translate.c. P.S. if you CC me it helps my mail filter to find your patch :). Also we have the rule for qemu-devel to not send a patch as a attachment. See (https://www.qemu.org/docs/master/devel/submitting-a-patch.html) Cheers, Bastian
© 2016 - 2025 Red Hat, Inc.