]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: macro instead enum for base abi type releases/gcc-14
authormengqinggang <mengqinggang@loongson.cn>
Fri, 8 Aug 2025 08:22:59 +0000 (16:22 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Tue, 12 Aug 2025 11:27:45 +0000 (19:27 +0800)
enum can't be used in #if.
For #if expression, identifiers that are not macros,
which are all considered to be the number zero.

This patch may fix https://sourceware.org/bugzilla/show_bug.cgi?id=32776.

gcc/ChangeLog:

* config/loongarch/loongarch-def.h (ABI_BASE_LP64D): New macro.
(ABI_BASE_LP64F): New macro.
(ABI_BASE_LP64S): New macro.
(N_ABI_BASE_TYPES): New macro.

(cherry picked from commit 9467435253948b83fcb5f7430f6cd571236960d8)

gcc/config/loongarch/loongarch-def.h

index ef7d183df500fc9a47b128f83398c6904885c691..2769906422d26ad5ad88a9b9445d6d3596bc4353 100644 (file)
@@ -78,12 +78,10 @@ extern loongarch_def_array<const char *, N_ISA_EXT_TYPES>
 
 
 /* Base ABI */
-enum {
-  ABI_BASE_LP64D       = 0,
-  ABI_BASE_LP64F       = 1,
-  ABI_BASE_LP64S       = 2,
-  N_ABI_BASE_TYPES     = 3
-};
+#define ABI_BASE_LP64D   0
+#define ABI_BASE_LP64F   1
+#define ABI_BASE_LP64S   2
+#define N_ABI_BASE_TYPES  3
 
 extern loongarch_def_array<const char *, N_ABI_BASE_TYPES>
   loongarch_abi_base_strings;