patacongo commented on issue #131: Improve config
URL: https://github.com/apache/incubator-nuttx/pull/131#issuecomment-578527529
 
 
   I tried a simple thing would might solve this problem.   Currently 
CONFIGX_CXX_NEWLONG is used only in libs/libnxx:
   
       libxx/Kconfig:config CXX_NEWLONG
       libxx/libxx_deletea_sized.cxx:#ifdef CONFIG_CXX_NEWLONG
       libxx/libxx_delete_sized.cxx:#ifdef CONFIG_CXX_NEWLONG
       libxx/libxx_new.cxx:#ifdef CONFIG_CXX_NEWLONG
      libxx/libxx_newa.cxx:#ifdef CONFIG_CXX_NEWLONG
   
   Since that C++ code, it seems like you should be able to implement both the 
unsigned int and the unsigned long forms.  Because of C++ name mangling, there 
are really different symbols.  So tried eliminating CONFIG_CXX_LONG and just 
duplicating both operators with unsigned int and unsigned long.  So, for 
example, there were two operators like:
   
       void operator delete(FAR void *ptr, unsigned long size)
       void operator delete(FAR void *ptr, unsigned int size)
   
   That works for some operators but not for others.  I get these compilation 
errors in that case:
   
       CXX:  libxx_new_uint.cxx
       CXX:  libxx_new_ulong.cxx
       libxx_new_ulong.cxx:65:40: warning: 'operator new' takes type 'size_t' 
('unsigned int') as first parameter [-fpermissive]
        void *operator new(unsigned long nbytes)
                                               ^
       CXX:  libxx_newa_uint.cxx
       CXX:  libxx_newa_ulong.cxx
       libxx_newa_ulong.cxx:73:42: warning: 'operator new' takes type 'size_t' 
('unsigned int') as first parameter [-fpermissive]
       void *operator new[](unsigned long nbytes)
                                                ^
   I was disappointed that that does not work!  I was hoping to resolve this 
issue this way. 
   
   The only real solution is to either built the toolchain from scratch using 
only the NuttX definition of size_t (which depends on the architecture-specific 
definition of uintptr_t).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to