From ea1e31e8be764309f24ebb3ec3cbac49e2e12212 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 6 Feb 2018 19:11:03 +0000 Subject: MISRA-related fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11459 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/oslib/include/chfactory.h | 36 +++++++++++++++++++++++------------- os/common/oslib/include/chfifo.h | 4 ++++ 2 files changed, 27 insertions(+), 13 deletions(-) (limited to 'os/common/oslib/include') diff --git a/os/common/oslib/include/chfactory.h b/os/common/oslib/include/chfactory.h index a2f27c626..1843d6a36 100644 --- a/os/common/oslib/include/chfactory.h +++ b/os/common/oslib/include/chfactory.h @@ -90,8 +90,30 @@ /* Derived constants and error checks. */ /*===========================================================================*/ +#if (CH_CFG_FACTORY_SEMAPHORES == TRUE) && (CH_CFG_USE_SEMAPHORES == FALSE) +/*lint -save -e767 [20.5] Valid because the #undef.*/ +#undef CH_CFG_FACTORY_SEMAPHORES +#define CH_CFG_FACTORY_SEMAPHORES FALSE +/*lint restore*/ +#endif + +#if (CH_CFG_FACTORY_MAILBOXES == TRUE) && (CH_CFG_USE_MAILBOXES == FALSE) +/*lint -save -e767 [20.5] Valid because the #undef.*/ +#undef CH_CFG_FACTORY_MAILBOXES +#define CH_CFG_FACTORY_MAILBOXES FALSE +/*lint restore*/ +#endif + +#if (CH_CFG_FACTORY_OBJ_FIFOS == TRUE) && (CH_CFG_USE_OBJ_FIFOS == FALSE) +/*lint -save -e767 [20.5] Valid because the #undef.*/ +#undef CH_CFG_FACTORY_OBJ_FIFOS +#define CH_CFG_FACTORY_OBJ_FIFOS FALSE +/*lint restore*/ +#endif + #define CH_FACTORY_REQUIRES_POOLS \ - ((CH_CFG_FACTORY_SEMAPHORES == TRUE)) + ((CH_CFG_FACTORY_OBJECTS_REGISTRY == TRUE) || \ + (CH_CFG_FACTORY_SEMAPHORES == TRUE)) #define CH_FACTORY_REQUIRES_HEAP \ ((CH_CFG_FACTORY_GENERIC_BUFFERS == TRUE) || \ @@ -119,18 +141,6 @@ #error "CH_CFG_USE_HEAP is required" #endif -#if (CH_CFG_FACTORY_SEMAPHORES == TRUE) && (CH_CFG_USE_SEMAPHORES == FALSE) -#error "CH_CFG_FACTORY_SEMAPHORES requires CH_CFG_USE_SEMAPHORES" -#endif - -#if (CH_CFG_FACTORY_MAILBOXES == TRUE) && (CH_CFG_USE_MAILBOXES == FALSE) -#error "CH_CFG_FACTORY_MAILBOXES requires CH_CFG_USE_MAILBOXES" -#endif - -#if (CH_CFG_FACTORY_OBJ_FIFOS == TRUE) && (CH_CFG_USE_OBJ_FIFOS == FALSE) -#error "CH_CFG_FACTORY_OBJ_FIFOS requires CH_CFG_USE_OBJ_FIFOS" -#endif - /*===========================================================================*/ /* Module data structures and types. */ /*===========================================================================*/ diff --git a/os/common/oslib/include/chfifo.h b/os/common/oslib/include/chfifo.h index 17972392e..11ca3631d 100644 --- a/os/common/oslib/include/chfifo.h +++ b/os/common/oslib/include/chfifo.h @@ -70,6 +70,10 @@ #error "CH_CFG_USE_OBJ_FIFOS requires CH_CFG_USE_SEMAPHORES" #endif +#if CH_CFG_USE_MAILBOXES == FALSE +#error "CH_CFG_USE_OBJ_FIFOS requires CH_CFG_USE_MAILBOXES" +#endif + /*===========================================================================*/ /* Module data structures and types. */ /*===========================================================================*/ -- cgit v1.2.3