What should confdefs.h do if CONFIGURE_INIT is not defined?

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Dec 17 08:43:06 UTC 2019


Hello,

I plan to move content from confdefs.h to separate header files for 
configuration groups. What should confdefs.h do if CONFIGURE_INIT is not 
defined?

Should we do the consistency checks for example if CONFIGURE_INIT is not 
defined, e.g.

#if defined(CONFIGURE_UNLIMITED_OBJECTS)
   #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \
      !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \
      !defined(CONFIGURE_MEMORY_OVERHEAD)
      #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area, 
an executive RAM size, or a defined workspace memory overhead"
   #endif

vs.

#ifdef CONFIGURE_INIT
#if defined(CONFIGURE_UNLIMITED_OBJECTS)
   #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \
      !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \
      !defined(CONFIGURE_MEMORY_OVERHEAD)
      #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area, 
an executive RAM size, or a defined workspace memory overhead"
   #endif

What about includes, e.g.

#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
   #include <rtems/clockdrv.h>

   #ifdef CONFIGURE_INIT
     RTEMS_SYSINIT_ITEM(
       _Clock_Initialize,
       RTEMS_SYSINIT_DEVICE_DRIVERS,
       RTEMS_SYSINIT_ORDER_THIRD
     );
   #endif
#endif

vs.

#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
   #ifdef CONFIGURE_INIT
     #include <rtems/clockdrv.h>

     RTEMS_SYSINIT_ITEM(
       _Clock_Initialize,
       RTEMS_SYSINIT_DEVICE_DRIVERS,
       RTEMS_SYSINIT_ORDER_THIRD
     );
   #endif
#endif

?

My approach would be to place all the define evaluations into a #ifdef 
CONFIGURE_INIT guard, so that #include <rtems/confdefs.h> provides 
nothing to the C compiler if CONFIGURE_INIT is not defined.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list