I suggest to remove CAN_PASS_STRUCTS not only because the code is
ulgy, the more important is that it break the 1st INVIOLABLES rule:
That is certainly a stronger argument.  Personal preference does not carry any weight.
Strict POSIX compliance
-----------------------

   o Strict conformance to the portable standard OS interface as defined at
     OpenGroup.org.
   o A deeply embedded system requires some special support.  Special
     support must be minimized.
   o The portable interface must never be compromised only for the sake of
     expediency.
   o Expediency or even improved performance are not justifications for
     violation of the strict POSIX interface

For example, we even change sigqueue prototype to work around the
compiler issue:
nuttx/include/signal.h:#ifdef CONFIG_CAN_PASS_STRUCTS
nuttx/include/signal.h-int  sigqueue(int pid, int signo, union sigval value);
nuttx/include/signal.h-#else
nuttx/include/signal.h-int  sigqueue(int pid, int signo, FAR void *sival_ptr);
nuttx/include/signal.h-#endif
It's great if we can support the noncompliant compiler without break
API prototype, but CONFIG_CAN_PASS_STRUCTS isn't a case.
BTW, SDCC dev fix this issue:
https://github.com/z88dk/z88dk/issues/1132

mallinfo is not a strong argument, but sigqueue() is a better argument.  Z88DK is a different, but related compiler for the Z80 only.  It is not used by any NuttX platforms at present.  SDCC is here:  https://sourceforge.net/p/sdcc/code/HEAD/tree/trunk/sdcc/

That Z88DK port does state that "Now that sdcc supports assigning structs, ..." implying that the real change is to SDCC.

There is an exception in the INVIOLABLES for deeplying embedded systems that could be invoked:

  o A deeply embedded system requires some special support.  Special support 
must be minimized.

Eliminating CONFIG_CAN_PASS_STRUCTS based on POSIX compliance is more palatable to me.  That is a much better argument that "Ugly" which is just a personal preference, something that we have to avoid.  We cannot make good engineering judgements based on personal preference.  What is important to one person, can be unimportant and "ugly" to another.




Reply via email to