From 9000cb1967f1928a5b74500521e31551ff12676f Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 25 Feb 2015 08:00:18 -1000 Subject: Intrim DANGEROUS fix to allow the PX4 development to continue until there is a SAFE solution to foreign (non-nuttx) header file inclusion. There is a potential of a binary incompatibility and runtime errors, memory overwrites or corruption. --- nuttx-patches/c++11.patch | 91 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 29 deletions(-) diff --git a/nuttx-patches/c++11.patch b/nuttx-patches/c++11.patch index 17b3fd52f..70276aa92 100644 --- a/nuttx-patches/c++11.patch +++ b/nuttx-patches/c++11.patch @@ -1,20 +1,39 @@ diff --git NuttX/nuttx/include/cxx/cwchar NuttX/nuttx/include/cxx/cwchar -index 60c261d..68a1c04 100755 +index 67716ab..bd21740 100755 --- NuttX/nuttx/include/cxx/cwchar +++ NuttX/nuttx/include/cxx/cwchar -@@ -46,4 +46,97 @@ +@@ -46,13 +46,115 @@ // Namespace //*************************************************************************** -+namespace std -+{ -+ using ::mbstate_t; -+} // namespace std ++/* N.B. The following definitions are enabled at this time to allow the PX4 ++ * development to continue until there is a SAFE solution to foreign ++ * (non-nuttx) header file inclusion. There is a potential of a binary ++ * incompatibility and runtime errors, memory overwrites or corruption ++ * VVVVVVVVVVVVVVVVVVVVVVVVVV Begin Warning VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ++ */ + namespace std + { +-#if 0 /* Not defined */ ++#if __cplusplus >= 201103L + using ::mbstate_t; + #endif ++/*^^^^^^^^^^^^^^^^^^^^^^^^^ End Warning ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + -+/* These functions are not implemented, but listed here to allow compilation -+* Any resulting linker error will require the implementation of the offending -+* function(s) Code contributions are welcome. -+*/ + using ::wint_t; + using ::size_t; + }; + ++/* N.B. The following definitions are enabled at this time to allow the PX4 ++ * development to continue until there is a SAFE solution to foreign ++ * (non-nuttx) header file inclusion. There is a potential of a binary ++ * incompatibility and runtime errors, memory overwrites or corruption ++ * ++ * These functions are not implemented, but listed here to allow compilation ++ * Any resulting linker error will require the implementation of the offending ++ * function(s) Code contributions are welcome. ++ * VVVVVVVVVVVVVVVVVVVVVVVVVV Begin Warning VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ++ */ + +#if __cplusplus >= 201103L + @@ -97,21 +116,26 @@ index 60c261d..68a1c04 100755 +int vswscanf(const wchar_t *, const wchar_t *, va_list); +int vwscanf(const wchar_t *, va_list); +float wcstof(const wchar_t *, wchar_t **); -+ +#endif ++/*^^^^^^^^^^^^^^^^^^^^^^^^^ End Warning ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif // __INCLUDE_CXX_CWCHAR diff --git NuttX/nuttx/include/wchar.h NuttX/nuttx/include/wchar.h -index 54fa796..263212a 100644 +index 90e3d4f..f7dee97 100644 --- NuttX/nuttx/include/wchar.h +++ NuttX/nuttx/include/wchar.h -@@ -93,15 +93,31 @@ - * wctype_t +@@ -96,7 +96,25 @@ typedef int wint_t; + /* wctype_t * A scalar type of a data object that can hold values which represent * locale-specific character classification. - * -- * mbstate_t + */ + ++/* N.B. The following definitions are enabled at this time to allow the PX4 ++ * development to continue until there is a SAFE solution to foreign ++ * (non-nuttx) header file inclusion. There is a potential of a binary ++ * incompatibility and runtime errors, memory overwrites or corruption ++ * VVVVVVVVVVVVVVVVVVVVVVVVVV Begin Warning VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ++ */ +#ifndef _WCTYPE_T +#define _WCTYPE_T +# ifdef _AEABI_PORTABLE @@ -120,23 +144,32 @@ index 54fa796..263212a 100644 +typedef int wctype_t; +# endif +#endif /* !_WCTYPE_T */ ++/*^^^^^^^^^^^^^^^^^^^^^^^^^ End Warning ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + -+ /* mbstate_t ++/* + * mbstate_t * An object type other than an array type that can hold the conversion * state information necessary to convert between sequences of (possibly - * multibyte) characters and wide-characters. If a codeset is being used - * such that an mbstate_t needs to preserve more than 2 levels of reserved +@@ -105,7 +123,13 @@ typedef int wint_t; * state, the results are unspecified. -- * -- * FILE + */ + +-#if 0 /* Not used */ ++/* N.B. The following definitions are enabled at this time to allow the PX4 ++ * development to continue until there is a SAFE solution to foreign ++ * (non-nuttx) header file inclusion. There is a potential of a binary ++ * incompatibility and runtime errors, memory overwrites or corruption ++ * VVVVVVVVVVVVVVVVVVVVVVVVVV Begin Warning VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV + */ -+ -+typedef struct -+{ -+ int __fill[6]; -+} mbstate_t; -+ -+/* FILE ++#if __cplusplus >= 201103L + /* Commented out because this is dangerous. This defines a type that would + * be internal to some wchar implementation. NuttX does not implement the + * wchar functions. Having this definition is a time bomb: If this header +@@ -128,6 +152,7 @@ struct mbstate_s + + typedef struct mbstate_s mbstate_t; + #endif ++/*^^^^^^^^^^^^^^^^^^^^^^^^^ End Warning ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + /* FILE * As described in . - * - * size_t -- cgit v1.2.3