diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-10-03 21:10:11 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-10-03 21:10:11 +0000 |
commit | 0da537768a85ab863bd1a46425db167d6333e51c (patch) | |
tree | 9ad543d3e99f65e9ce51a8a56d02d559f46bdf7f /nuttx/libxx | |
parent | 6be41fe54a04032f4516c5eb8a84bf5407cc55ee (diff) | |
download | px4-nuttx-0da537768a85ab863bd1a46425db167d6333e51c.tar.gz px4-nuttx-0da537768a85ab863bd1a46425db167d6333e51c.tar.bz2 px4-nuttx-0da537768a85ab863bd1a46425db167d6333e51c.zip |
Verify C++ support with CodeSourcery
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4016 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/libxx')
-rwxr-xr-x | nuttx/libxx/libxx_new.cxx | 14 | ||||
-rwxr-xr-x | nuttx/libxx/libxx_newa.cxx | 16 |
2 files changed, 23 insertions, 7 deletions
diff --git a/nuttx/libxx/libxx_new.cxx b/nuttx/libxx/libxx_new.cxx index 49caf74f3..8ec725ca8 100755 --- a/nuttx/libxx/libxx_new.cxx +++ b/nuttx/libxx/libxx_new.cxx @@ -58,14 +58,22 @@ // Name: new // // NOTE: -// This should take a type of size_t, which for ARM GCC is unsigned long. -// but size_t may actually be a different different type, in sys/include.h, -// it is typed as uint32_t. Need to REVISIT this. +// This should take a type of size_t. But size_t has an unknown underlying +// type. In the nuttx sys/types.h header file, size_t is typed as uint32_t +// (which is determined by architecture-specific logic). But the C++ +// compiler may believe 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. Need to +// REVISIT this. // //*************************************************************************** //void *operator new(size_t nbytes) +#ifdef CONFIG_CXX_NEWLONG void *operator new(unsigned long nbytes) +#else +void *operator new(unsigned int nbytes) +#endif { // We have to allocate something diff --git a/nuttx/libxx/libxx_newa.cxx b/nuttx/libxx/libxx_newa.cxx index e8c214d4d..855160c41 100755 --- a/nuttx/libxx/libxx_newa.cxx +++ b/nuttx/libxx/libxx_newa.cxx @@ -58,18 +58,26 @@ // Name: new // // NOTE: -// This should take a type of size_t, which for ARM GCC is unsigned long. -// but size_t may actually be a different different type, in sys/include.h, -// it is typed as uint32_t. Need to REVISIT this. +// This should take a type of size_t. But size_t has an unknown underlying +// type. In the nuttx sys/types.h header file, size_t is typed as uint32_t +// (which is determined by architecture-specific logic). But the C++ +// compiler may believe 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. Need to +// REVISIT this. // //*************************************************************************** //void *operator new[](size_t size) +#ifdef CONFIG_CXX_NEWLONG void *operator new[](unsigned long nbytes) +#else +void *operator new[](unsigned int nbytes) +#endif { // We have to allocate something - if (nbytes< 1) + if (nbytes < 1) { nbytes = 1; } |