mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
arch: Customize the typedef of size_t instead of intptr_t
To ensure size_t same as toolchain definition in the first place and rename CXX_NEWLONG to ARCH_SIZET_LONG. The change also check whether __SIZE_TYPE__ exist before CONFIG_ARCH_SIZET_LONG so our definition can align with toolchain(gcc/clang) definition automatically.
This commit is contained in:
@@ -76,10 +76,25 @@ typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is 4 bytes */
|
||||
/* A size is 4 bytes */
|
||||
|
||||
typedef signed int _intptr_t;
|
||||
typedef unsigned int _uintptr_t;
|
||||
#if defined(__SIZE_TYPE__)
|
||||
/* If __SIZE_TYPE__ is defined we define ssize_t based on size_t.
|
||||
* We simply change "unsigned" to "signed" for this single definition
|
||||
* to make sure ssize_t and size_t only differ by their signedness.
|
||||
*/
|
||||
|
||||
#define unsigned signed
|
||||
typedef __SIZE_TYPE__ _ssize_t;
|
||||
#undef unsigned
|
||||
typedef __SIZE_TYPE__ _size_t;
|
||||
#elif defined(CONFIG_ARCH_SIZET_LONG)
|
||||
typedef signed long _ssize_t;
|
||||
typedef unsigned long _size_t;
|
||||
#else
|
||||
typedef signed int _ssize_t;
|
||||
typedef unsigned int _size_t;
|
||||
#endif
|
||||
|
||||
/* This is the size of the interrupt state save returned by up_irq_save(). */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user