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:
parent
e7d44ee16e
commit
e7d9260014
11
TODO
11
TODO
@ -1164,11 +1164,12 @@ o C++ Support
|
||||
that size_t is of a different type resulting in compilation errors
|
||||
in the operator. Using the underlying integer type Instead of
|
||||
size_t seems to resolve the compilation issues.
|
||||
Status: Kind of open. There is a workaround. Setting CONFIG_CXX_NEWLONG=y
|
||||
will define the operators with argument of type unsigned long;
|
||||
Setting CONFIG_CXX_NEWLONG=n will define the operators with argument
|
||||
of type unsigned int. But this is pretty ugly! A better solution
|
||||
would be to get a hold of the compilers definition of size_t.
|
||||
Status: Kind of open. There is a workaround. Setting CONFIG_ARCH_SIZET_LONG
|
||||
=y will define the operators with argument of type unsigned long;
|
||||
Setting CONFIG_ARCH_SIZET_LONG=n will define the operators with
|
||||
argument of type unsigned int. But this is pretty ugly! A better
|
||||
solution would be to get a hold of the compilers definition of
|
||||
size_t.
|
||||
Priority: Low.
|
||||
|
||||
Title: STATIC CONSTRUCTORS AND MULTITASKING
|
||||
|
@ -156,6 +156,14 @@ config ARCH_GNU_NO_WEAKFUNCTIONS
|
||||
---help---
|
||||
Disable support for weak functions.
|
||||
|
||||
config ARCH_SIZET_LONG
|
||||
bool "size_t is type long"
|
||||
default n
|
||||
---help---
|
||||
size_t may be type long or type int. This matters for some
|
||||
C++ library routines because the NuttX size_t might not have
|
||||
the same underlying type as your toolchain's size_t.
|
||||
|
||||
comment "Architecture Options"
|
||||
|
||||
config ARCH_NOINTC
|
||||
|
@ -78,10 +78,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(). For
|
||||
* ARM, a 32 register value is returned, for the thumb2, Cortex-M3, the 16-bit
|
||||
|
@ -76,10 +76,22 @@ typedef signed long long _int64_t; /* long long is 64-bits */
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A (near) pointer is 2 bytes */
|
||||
/* A (near) size is 2 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;
|
||||
#else
|
||||
typedef signed int _ssize_t;
|
||||
typedef unsigned int _size_t;
|
||||
#endif
|
||||
|
||||
/* A FAR pointer is 4 bytes */
|
||||
|
||||
|
@ -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(). */
|
||||
|
||||
|
@ -85,10 +85,22 @@ typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is two bytes */
|
||||
/* A size is two bytes */
|
||||
|
||||
typedef signed short _intptr_t;
|
||||
typedef unsigned short _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;
|
||||
#else
|
||||
typedef signed short _ssize_t;
|
||||
typedef unsigned short _size_t;
|
||||
#endif
|
||||
|
||||
/* This is the size of the interrupt state save returned by up_irq_save()*/
|
||||
|
||||
|
@ -86,10 +86,22 @@ typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is two bytes */
|
||||
/* A size is two bytes */
|
||||
|
||||
typedef signed short _intptr_t;
|
||||
typedef unsigned short _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;
|
||||
#else
|
||||
typedef signed short _ssize_t;
|
||||
typedef unsigned short _size_t;
|
||||
#endif
|
||||
|
||||
/* This is the size of the interrupt state save returned by up_irq_save()*/
|
||||
|
||||
|
@ -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(). */
|
||||
|
||||
|
@ -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(). */
|
||||
|
||||
|
@ -79,10 +79,25 @@ typedef unsigned long long _uint64_t;
|
||||
|
||||
#define __INT64_DEFINED 1
|
||||
|
||||
/* 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(). */
|
||||
|
||||
|
@ -78,10 +78,22 @@ typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is 2 bytes */
|
||||
/* A size is 2 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;
|
||||
#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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -77,19 +77,46 @@ typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
#ifdef __LP64__
|
||||
/* A pointer is 8 bytes */
|
||||
/* A size is 8 bytes */
|
||||
|
||||
typedef signed long _intptr_t;
|
||||
typedef unsigned long _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;
|
||||
#else
|
||||
typedef signed long _ssize_t;
|
||||
typedef unsigned long _size_t;
|
||||
#endif
|
||||
|
||||
/* This is the size of the interrupt state save returned by irqsave(). */
|
||||
|
||||
typedef unsigned long long irqstate_t;
|
||||
#else
|
||||
/* 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 irqsave(). */
|
||||
|
||||
|
@ -77,16 +77,44 @@ typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
|
||||
/* 64-bit build on 64-bit machine: A pointer is 8 bytes */
|
||||
/* 64-bit build on 64-bit machine: A size is 8 bytes */
|
||||
|
||||
typedef signed long long _intptr_t;
|
||||
typedef unsigned long long _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;
|
||||
#else
|
||||
typedef signed long long _ssize_t;
|
||||
typedef unsigned long long _size_t;
|
||||
#endif
|
||||
|
||||
#else
|
||||
/* 32-bit build on 32- or 64-bit machine: A pointer is 4 bytes */
|
||||
/* 32-bit build on 32- or 64-bit machine: A size is 4 bytes */
|
||||
|
||||
#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
|
||||
|
||||
typedef signed int _intptr_t;
|
||||
typedef unsigned int _uintptr_t;
|
||||
#endif
|
||||
|
||||
/* This is the size of the interrupt state save returned by
|
||||
|
@ -77,10 +77,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()
|
||||
|
@ -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 long _intptr_t;
|
||||
typedef unsigned long _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(). */
|
||||
|
||||
|
@ -72,10 +72,25 @@ typedef unsigned short _uint16_t;
|
||||
typedef signed int _int32_t;
|
||||
typedef unsigned int _uint32_t;
|
||||
|
||||
/* 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()
|
||||
|
@ -91,12 +91,22 @@ typedef unsigned long _uint32_t;
|
||||
* ADL mode - 24 bits
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_EZ80_Z80MODE
|
||||
typedef signed short _intptr_t;
|
||||
typedef unsigned short _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_EZ80_Z80MODE)
|
||||
typedef signed short _ssize_t;
|
||||
typedef unsigned short _size_t;
|
||||
#else
|
||||
typedef signed int _intptr_t;
|
||||
typedef unsigned int _uintptr_t;
|
||||
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().
|
||||
|
@ -84,10 +84,22 @@ typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is 2 bytes */
|
||||
/* A size is 2 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;
|
||||
#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() */
|
||||
|
||||
|
@ -87,10 +87,22 @@ typedef unsigned int _uint16_t;
|
||||
typedef signed long _int32_t;
|
||||
typedef unsigned long _uint32_t;
|
||||
|
||||
/* A pointer is 2 bytes */
|
||||
/* A size is 2 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;
|
||||
#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() */
|
||||
|
||||
|
@ -84,10 +84,22 @@ typedef signed long long _int64_t;
|
||||
typedef unsigned long long _uint64_t;
|
||||
#define __INT64_DEFINED
|
||||
|
||||
/* A pointer is 2 bytes */
|
||||
/* A size is 2 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;
|
||||
#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() */
|
||||
|
||||
|
@ -48,7 +48,6 @@ CONFIG_BOARD_LATE_INITIALIZE=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=6965
|
||||
CONFIG_BOOT_RUNFROMISRAM=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CXX_NEWLONG=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_FS_BINFS=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
|
@ -261,7 +261,7 @@ Configurations
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : General GCC EABI toolchain under windows
|
||||
|
||||
Library Routines ->
|
||||
CONFIG_CXX_NEWLONG=n : size_t is an unsigned int, not long
|
||||
CONFIG_ARCH_SIZET_LONG=n : size_t is an unsigned int, not long
|
||||
|
||||
This re-configuration should be done before making NuttX or else the
|
||||
subsequent 'make' will fail. If you have already attempted building
|
||||
|
@ -27,7 +27,6 @@ CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARMV7M_OABI_TOOLCHAIN=y
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=8720
|
||||
CONFIG_CXX_NEWLONG=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_INPUT=y
|
||||
|
@ -1074,7 +1074,7 @@ Configurations
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : General GCC EABI toolchain under windows
|
||||
|
||||
Library Routines ->
|
||||
CONFIG_CXX_NEWLONG=n : size_t is an unsigned int, not long
|
||||
CONFIG_ARCH_SIZET_LONG=n : size_t is an unsigned int, not long
|
||||
|
||||
This re-configuration should be done before making NuttX or else the
|
||||
subsequent 'make' will fail. If you have already attempted building
|
||||
|
@ -490,7 +490,7 @@ Configuration sub-directories
|
||||
Sometimes NuttX and your toolchain will disagree on the underlying
|
||||
type of size_t; sometimes it is an 'unsigned int' and sometimes it is
|
||||
an 'unsigned long int'. If this error occurs, then you may need to
|
||||
toggle the value of CONFIG_CXX_NEWLONG.
|
||||
toggle the value of CONFIG_ARCH_SIZET_LONG.
|
||||
|
||||
2. If the I/O1 module is connected to the SAM4L Xplained Pro, then
|
||||
support for the SD card slot can be enabled by making the following
|
||||
|
@ -721,7 +721,7 @@ Configuration sub-directories
|
||||
Sometimes NuttX and your toolchain will disagree on the underlying
|
||||
type of size_t; sometimes it is an 'unsigned int' and sometimes it is
|
||||
an 'unsigned long int'. If this error occurs, then you may need to
|
||||
toggle the value of CONFIG_CXX_NEWLONG.
|
||||
toggle the value of CONFIG_ARCH_SIZET_LONG.
|
||||
|
||||
4. If the I/O1 module is connected to the SAMD20 Xplained Pro, then
|
||||
support for the SD card slot can be enabled by making the following
|
||||
|
@ -588,7 +588,7 @@ Configuration sub-directories
|
||||
Sometimes NuttX and your toolchain will disagree on the underlying
|
||||
type of size_t; sometimes it is an 'unsigned int' and sometimes it is
|
||||
an 'unsigned long int'. If this error occurs, then you may need to
|
||||
toggle the value of CONFIG_CXX_NEWLONG.
|
||||
toggle the value of CONFIG_ARCH_SIZET_LONG.
|
||||
|
||||
4. If the I/O1 module is connected to the SAMD21 Xplained Pro, then
|
||||
support for the SD card slot can be enabled by making the following
|
||||
|
@ -750,7 +750,7 @@ Configuration sub-directories
|
||||
Sometimes NuttX and your toolchain will disagree on the underlying
|
||||
type of size_t; sometimes it is an 'unsigned int' and sometimes it is
|
||||
an 'unsigned long int'. If this error occurs, then you may need to
|
||||
toggle the value of CONFIG_CXX_NEWLONG.
|
||||
toggle the value of CONFIG_ARCH_SIZET_LONG.
|
||||
|
||||
4. WARNING: This info comes from the SAMD20 Xplained README. I have
|
||||
not tried the I/O1 module on the SAML21!
|
||||
|
@ -753,7 +753,7 @@ Where <subdir> is one of the following:
|
||||
CONFIG_HOST_WINDOWS=y : Windows
|
||||
CONFIG_WINDOWS_CYGWIN=y : Cygwin environment on Windows
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : NuttX EABI buildroot toolchain
|
||||
CONFIG_CXX_NEWLONG=y : size_t is long (maybe?)
|
||||
CONFIG_ARCH_SIZET_LONG=y : size_t is long (maybe?)
|
||||
|
||||
This is easily changed by modifying the configuration.
|
||||
|
||||
@ -764,7 +764,7 @@ Where <subdir> is one of the following:
|
||||
can try for yourself setting:
|
||||
|
||||
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
CONFIG_CXX_NEWLONG=n : size_t is unsigned int (maybe?)
|
||||
CONFIG_ARCH_SIZET_LONG=n : size_t is unsigned int (maybe?)
|
||||
|
||||
3. In addition to the protected mode build, this NxWM configuration
|
||||
differences from the nxwm configuration in that:
|
||||
|
@ -23,7 +23,6 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
|
||||
CONFIG_ARM_MPU=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILD_PROTECTED=y
|
||||
CONFIG_CXX_NEWLONG=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
CONFIG_FAT_LFN=y
|
||||
CONFIG_FS_FAT=y
|
||||
|
@ -12,7 +12,6 @@ CONFIG_ARCH_BOARD_SIM=y
|
||||
CONFIG_ARCH_CHIP="sim"
|
||||
CONFIG_ARCH_SIM=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=100
|
||||
CONFIG_CXX_NEWLONG=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_LIBM=y
|
||||
|
@ -14,7 +14,6 @@ CONFIG_ARCH_BOARD_SIM=y
|
||||
CONFIG_ARCH_CHIP="sim"
|
||||
CONFIG_ARCH_SIM=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CXX_NEWLONG=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||
CONFIG_EXAMPLES_NX=y
|
||||
|
@ -15,7 +15,6 @@ CONFIG_ARCH_BOARD_SIM=y
|
||||
CONFIG_ARCH_CHIP="sim"
|
||||
CONFIG_ARCH_SIM=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=0
|
||||
CONFIG_CXX_NEWLONG=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||
CONFIG_EXAMPLES_NXLINES=y
|
||||
|
@ -13,7 +13,6 @@ CONFIG_ARCH_BOARD="sim"
|
||||
CONFIG_ARCH_BOARD_SIM=y
|
||||
CONFIG_ARCH_CHIP="sim"
|
||||
CONFIG_ARCH_SIM=y
|
||||
CONFIG_CXX_NEWLONG=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
|
@ -271,10 +271,14 @@ typedef _int64_t int_fast64_t;
|
||||
typedef _uint64_t uint_fast64_t;
|
||||
#endif
|
||||
|
||||
/* Integer types capable of holding object pointers */
|
||||
/* Integer types capable of holding object pointers
|
||||
* As a general rule, the size of size_t should be the same as the size of
|
||||
* uintptr_t: 32-bits on a machine with 32-bit addressing but 64-bits on a
|
||||
* machine with 64-bit addressing.
|
||||
*/
|
||||
|
||||
typedef _intptr_t intptr_t;
|
||||
typedef _uintptr_t uintptr_t;
|
||||
typedef _ssize_t intptr_t;
|
||||
typedef _size_t uintptr_t;
|
||||
|
||||
/* Some architectures support a FAR pointer which is larger then the normal
|
||||
* (near) pointer
|
||||
|
@ -139,14 +139,10 @@ typedef int16_t ssize_t;
|
||||
typedef uint16_t rsize_t;
|
||||
|
||||
#else /* CONFIG_SMALL_MEMORY */
|
||||
/* As a general rule, the size of size_t should be the same as the size of
|
||||
* uintptr_t: 32-bits on a machine with 32-bit addressing but 64-bits on a
|
||||
* machine with 64-bit addressing.
|
||||
*/
|
||||
|
||||
typedef uintptr_t size_t;
|
||||
typedef intptr_t ssize_t;
|
||||
typedef uintptr_t rsize_t;
|
||||
typedef _size_t size_t;
|
||||
typedef _ssize_t ssize_t;
|
||||
typedef _size_t rsize_t;
|
||||
|
||||
#endif /* CONFIG_SMALL_MEMORY */
|
||||
|
||||
|
@ -22,14 +22,6 @@ config HAVE_CXX
|
||||
|
||||
if HAVE_CXX
|
||||
|
||||
config CXX_NEWLONG
|
||||
bool "size_t is type long"
|
||||
default n
|
||||
---help---
|
||||
size_t may be type long or type int. This matters for some
|
||||
C++ library routines because the NuttX size_t might not have
|
||||
the same underlying type as your toolchain's size_t.
|
||||
|
||||
config CXX_EXCEPTION
|
||||
bool
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
// Name: delete
|
||||
//***************************************************************************
|
||||
|
||||
void operator delete(void* ptr)
|
||||
void operator delete(FAR void *ptr)
|
||||
{
|
||||
lib_free(ptr);
|
||||
}
|
||||
|
@ -39,6 +39,8 @@
|
||||
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "libxx.hxx"
|
||||
|
||||
#ifdef CONFIG_HAVE_CXX14
|
||||
@ -61,12 +63,7 @@
|
||||
//
|
||||
//***************************************************************************
|
||||
|
||||
//void operator delete(FAR void *ptr, std::size_t size)
|
||||
#ifdef CONFIG_CXX_NEWLONG
|
||||
void operator delete(FAR void *ptr, unsigned long size)
|
||||
#else
|
||||
void operator delete(FAR void *ptr, unsigned int size)
|
||||
#endif
|
||||
void operator delete(FAR void *ptr, std::size_t size)
|
||||
{
|
||||
lib_free(ptr);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
// Name: delete[]
|
||||
//***************************************************************************
|
||||
|
||||
void operator delete[](void *ptr)
|
||||
void operator delete[](FAR void *ptr)
|
||||
{
|
||||
lib_free(ptr);
|
||||
}
|
||||
|
@ -40,6 +40,8 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "libxx.hxx"
|
||||
|
||||
#ifdef CONFIG_HAVE_CXX14
|
||||
@ -52,12 +54,7 @@
|
||||
// Name: delete[]
|
||||
//***************************************************************************
|
||||
|
||||
//void operator delete[](void *ptr std::size_t size)
|
||||
#ifdef CONFIG_CXX_NEWLONG
|
||||
void operator delete[](FAR void *ptr, unsigned long size)
|
||||
#else
|
||||
void operator delete[](FAR void *ptr, unsigned int size)
|
||||
#endif
|
||||
void operator delete[](FAR void *ptr, std::size_t size)
|
||||
{
|
||||
lib_free(ptr);
|
||||
}
|
||||
|
@ -61,12 +61,7 @@
|
||||
//
|
||||
//***************************************************************************
|
||||
|
||||
//void *operator new(size_t nbytes)
|
||||
#ifdef CONFIG_CXX_NEWLONG
|
||||
void *operator new(unsigned long nbytes)
|
||||
#else
|
||||
void *operator new(unsigned int nbytes)
|
||||
#endif
|
||||
FAR void *operator new(std::size_t nbytes)
|
||||
{
|
||||
// We have to allocate something
|
||||
|
||||
@ -77,7 +72,7 @@ void *operator new(unsigned int nbytes)
|
||||
|
||||
// Perform the allocation
|
||||
|
||||
void *alloc = lib_malloc(nbytes);
|
||||
FAR void *alloc = lib_malloc(nbytes);
|
||||
|
||||
#ifdef CONFIG_DEBUG_ERROR
|
||||
if (alloc == 0)
|
||||
|
@ -69,12 +69,7 @@
|
||||
//
|
||||
//***************************************************************************
|
||||
|
||||
//void *operator new[](size_t size)
|
||||
#ifdef CONFIG_CXX_NEWLONG
|
||||
void *operator new[](unsigned long nbytes)
|
||||
#else
|
||||
void *operator new[](unsigned int nbytes)
|
||||
#endif
|
||||
FAR void *operator new[](std::size_t nbytes)
|
||||
{
|
||||
// We have to allocate something
|
||||
|
||||
@ -85,7 +80,7 @@ void *operator new[](unsigned int nbytes)
|
||||
|
||||
// Perform the allocation
|
||||
|
||||
void *alloc = lib_malloc(nbytes);
|
||||
FAR void *alloc = lib_malloc(nbytes);
|
||||
|
||||
#ifdef CONFIG_DEBUG_ERROR
|
||||
if (alloc == 0)
|
||||
|
@ -180,9 +180,9 @@ function configure {
|
||||
fi
|
||||
|
||||
if [ "X$sizet" != "Xdefault" ]; then
|
||||
sed -i -e "/CONFIG_CXX_NEWLONG/d" $nuttx/.config
|
||||
sed -i -e "/CONFIG_ARCH_SIZET_LONG/d" $nuttx/.config
|
||||
if [ "X$sizet" == "Xulong" ]; then
|
||||
sed -i -e "\$aCONFIG_CXX_NEWLONG=y" $nuttx/.config
|
||||
sed -i -e "\$aCONFIG_ARCH_SIZET_LONG=y" $nuttx/.config
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user