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:
Xiang Xiao
2020-02-17 20:19:25 +08:00
committed by Gregory Nutt
parent e7d44ee16e
commit e7d9260014
46 changed files with 413 additions and 136 deletions
+18 -3
View File
@@ -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(). */