You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/03/02 21:10:46 UTC

[GitHub] [incubator-nuttx] hartmannathan commented on issue #418: include/nuttx: Fix improper use of inline

hartmannathan commented on issue #418: include/nuttx:  Fix improper use of inline
URL: https://github.com/apache/incubator-nuttx/pull/418#issuecomment-593623352
 
 
   On Mon, Mar 2, 2020 at 3:53 PM patacongo <no...@github.com> wrote:
   
   > I finally figured out why the ez80 code has gotten so big. It is because
   > people have been put putting big inline functions in header files. That is
   > a violation of the coding standard, since only c89 compatibility is
   > required in all common code. But we have been tolerating inline function it
   > because include/nuttx/compiler.h defines 'inline' to be nothing for C89
   > compilers.
   >
   > As a result, static inline functions declared within a C file not so bad;
   > the inline qualifier is ignored, if not supported, but otherwise all is
   > well.
   >
   > But it is catastrophic in header files. Those static inline functions are
   > included as static functions and implemented in EVERY file that includes
   > those header files, even if the functions are never called. That makes the
   > code base huge!So there is another PR coming to fix some of the worst
   > offenders.
   >
   > This commit fixes two of the worst offenders I have encountered so far:
   > include/nuttx/sempahore.h and cache.h. But there may be a few other changes
   > needed. Under include/nuttx there are still inline functions thread.h,
   > inclue/nuttx/list.h, mutex.h, tree.h, and include/nuttx/crypto/blake2s.h
   > with no protection for compilers that do not handler the inline qualifier.
   > Otherwise we are clean.
   >
   > With the changes to these two header files, the size of the z20x build is
   > reduced by about 40%. And incredible size savings.
   >
   
   Wow that is significant!!
   
   Good catch!
   
   Nathan
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services