On Tue, 2025-06-10 at 17:00 +0800, mengqinggang wrote: > enum can't be used in #if. > For #if expression, identifiers that are not macros, > which are all considered to be the number zero.
Ooops :(. > This patch may fix > https://sourceware.org/bugzilla/show_bug.cgi?id=32776. > > gcc/ChangeLog: > > * config/loongarch/linux.h: Add brackets. Why do we need some redundant brackets? > * config/loongarch/loongarch-def.h (ABI_BASE_ILP32D): New > macro. > (ABI_BASE_ILP32F): New macro. > (ABI_BASE_ILP32S): New macro. > (ABI_BASE_LP64D): New macro. > (ABI_BASE_LP64F): New macro. > (ABI_BASE_LP64S): New macro. > (N_ABI_BASE_TYPES): New macro. > --- > gcc/config/loongarch/linux.h | 12 ++++++------ > gcc/config/loongarch/loongarch-def.h | 17 +++++++---------- > 2 files changed, 13 insertions(+), 16 deletions(-) > > diff --git a/gcc/config/loongarch/linux.h > b/gcc/config/loongarch/linux.h > index e2e3d868a73..24263212c18 100644 > --- a/gcc/config/loongarch/linux.h > +++ b/gcc/config/loongarch/linux.h > @@ -25,17 +25,17 @@ along with GCC; see the file COPYING3. If not see > && defined(LA_DISABLE_MULTILIB) \ > && defined(LA_DISABLE_MULTIARCH) > > - #if DEFAULT_ABI_BASE == ABI_BASE_ILP32D > + #if (DEFAULT_ABI_BASE == ABI_BASE_ILP32D) > #define ABI_LIBDIR "lib32" > - #elif DEFAULT_ABI_BASE == ABI_BASE_ILP32F > + #elif (DEFAULT_ABI_BASE == ABI_BASE_ILP32F) > #define ABI_LIBDIR "lib32/f32" > - #elif DEFAULT_ABI_BASE == ABI_BASE_ILP32S > + #elif (DEFAULT_ABI_BASE == ABI_BASE_ILP32S) > #define ABI_LIBDIR "lib32/sf" > - #elif DEFAULT_ABI_BASE == ABI_BASE_LP64D > + #elif (DEFAULT_ABI_BASE == ABI_BASE_LP64D) > #define ABI_LIBDIR "lib64" > - #elif DEFAULT_ABI_BASE == ABI_BASE_LP64F > + #elif (DEFAULT_ABI_BASE == ABI_BASE_LP64F) > #define ABI_LIBDIR "lib64/f32" > - #elif DEFAULT_ABI_BASE == ABI_BASE_LP64S > + #elif (DEFAULT_ABI_BASE == ABI_BASE_LP64S) > #define ABI_LIBDIR "lib64/sf" > #endif > > diff --git a/gcc/config/loongarch/loongarch-def.h > b/gcc/config/loongarch/loongarch-def.h > index 6dd9430bbe6..e2bd2ce60be 100644 > --- a/gcc/config/loongarch/loongarch-def.h > +++ b/gcc/config/loongarch/loongarch-def.h > @@ -77,17 +77,14 @@ enum { > extern loongarch_def_array<const char *, N_ISA_EXT_TYPES> > loongarch_isa_ext_strings; > > - > /* Base ABI */ > -enum { > - ABI_BASE_ILP32D = 0, > - ABI_BASE_ILP32F = 1, > - ABI_BASE_ILP32S = 2, > - ABI_BASE_LP64D = 3, > - ABI_BASE_LP64F = 4, > - ABI_BASE_LP64S = 5, > - N_ABI_BASE_TYPES = 6 > -}; > +#define ABI_BASE_ILP32D 0 The line above has a different separator after #define (tab instead of space in the lines below). > +#define ABI_BASE_ILP32F 1 > +#define ABI_BASE_ILP32S 2 > +#define ABI_BASE_LP64D 3 > +#define ABI_BASE_LP64F 4 > +#define ABI_BASE_LP64S 5 > +#define N_ABI_BASE_TYPES 6 > > extern loongarch_def_array<const char *, N_ABI_BASE_TYPES> > loongarch_abi_base_strings; -- Xi Ruoyao <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University