arch/risc-v: Replace __LP64__ with CONFIG_ARCH_RV64

It can provide better auto complete experience for modern code editor,
since they use clang/gcc based parser to analyze code but lacks some
target dependent info such as __LP64__ for riscv64.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi
2022-01-04 20:48:54 +08:00
committed by Xiang Xiao
parent dce8c96281
commit 3a0e86c99b
3 changed files with 8 additions and 12 deletions
+3 -3
View File
@@ -29,7 +29,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#if defined(__LP64__) #if defined(CONFIG_ARCH_RV64)
#define _PRI32PREFIX #define _PRI32PREFIX
#define _PRI64PREFIX "l" #define _PRI64PREFIX "l"
#define _PRIPTRPREFIX "l" #define _PRIPTRPREFIX "l"
@@ -40,7 +40,7 @@
#define INT64_C(x) x ## l #define INT64_C(x) x ## l
#define UINT32_C(x) x ## u #define UINT32_C(x) x ## u
#define UINT64_C(x) x ## ul #define UINT64_C(x) x ## ul
#else /* defined(__LP64__) */ #else /* defined(CONFIG_ARCH_RV64) */
#define _PRI32PREFIX "l" #define _PRI32PREFIX "l"
#define _PRI64PREFIX "ll" #define _PRI64PREFIX "ll"
#define _PRIPTRPREFIX #define _PRIPTRPREFIX
@@ -51,7 +51,7 @@
#define INT64_C(x) x ## ll #define INT64_C(x) x ## ll
#define UINT32_C(x) x ## ul #define UINT32_C(x) x ## ul
#define UINT64_C(x) x ## ull #define UINT64_C(x) x ## ull
#endif /* defined(__LP64__) */ #endif /* defined(CONFIG_ARCH_RV64) */
#define PRId8 "d" #define PRId8 "d"
#define PRId16 "d" #define PRId16 "d"
+1 -5
View File
@@ -78,11 +78,7 @@
* RISC-V architecture supports fence instruction to ensure memory ordering * RISC-V architecture supports fence instruction to ensure memory ordering
*/ */
#ifdef __LP64__ typedef uintptr_t spinlock_t;
typedef uint64_t spinlock_t;
#else
typedef uint32_t spinlock_t;
#endif
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
+4 -4
View File
@@ -54,19 +54,19 @@ typedef unsigned char _uint8_t;
typedef signed short _int16_t; typedef signed short _int16_t;
typedef unsigned short _uint16_t; typedef unsigned short _uint16_t;
#ifdef __LP64__ #ifdef CONFIG_ARCH_RV64
typedef signed int _int32_t; typedef signed int _int32_t;
typedef unsigned int _uint32_t; typedef unsigned int _uint32_t;
typedef signed long _int64_t; typedef signed long _int64_t;
typedef unsigned long _uint64_t; typedef unsigned long _uint64_t;
#else /* __LP64__ */ #else /* CONFIG_ARCH_RV64 */
typedef signed long _int32_t; typedef signed long _int32_t;
typedef unsigned long _uint32_t; typedef unsigned long _uint32_t;
typedef signed long long _int64_t; typedef signed long long _int64_t;
typedef unsigned long long _uint64_t; typedef unsigned long long _uint64_t;
#endif /* __LP64__ */ #endif /* CONFIG_ARCH_RV64 */
#define __INT64_DEFINED #define __INT64_DEFINED
typedef _int64_t _intmax_t; typedef _int64_t _intmax_t;
@@ -78,7 +78,7 @@ typedef __WCHAR_TYPE__ _wchar_t;
typedef int _wchar_t; typedef int _wchar_t;
#endif #endif
#ifdef __LP64__ #ifdef CONFIG_ARCH_RV64
/* A size is 8 bytes */ /* A size is 8 bytes */
#if defined(__SIZE_TYPE__) #if defined(__SIZE_TYPE__)