> > What I'm a bit hesitant about is that, if different arches add similar > > "conditional" enumerations later, it could cause the enumeration values > > to change under different compilation conditions (correct? :-)). Although > > it might not break anything, since we don't rely on the specific numeric > > values. > > Every binary we create contains target-specific code for at most one > target. Therefore, different numerical encodings for different targets > are fine. > > Same argument for struct members, by the way. Consider > > { 'struct': 'CpuModelExpansionInfo', > 'data': { 'model': 'CpuModelInfo', > 'deprecated-props' : { 'type': ['str'], > 'if': 'TARGET_S390X' } }, > 'if': { 'any': [ 'TARGET_S390X', > 'TARGET_I386', > 'TARGET_ARM', > 'TARGET_LOONGARCH64', > 'TARGET_RISCV' ] } } > > This generates > > #if defined(TARGET_S390X) || defined(TARGET_I386) || defined(TARGET_ARM) > || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) > struct CpuModelExpansionInfo { > CpuModelInfo *model; > #if defined(TARGET_S390X) > strList *deprecated_props; > #endif /* defined(TARGET_S390X) */ > }; > #endif /* defined(TARGET_S390X) || defined(TARGET_I386) || > defined(TARGET_ARM) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV) */ > > The struct's size depends on the target. If we ever add members after > @deprecated_props, their offset depends on the target, too.
Thank your for further explanation! Regards, Zhao