From 57d31cabcfedbab69c74cde694f8fe1ec652385d Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 26 Jan 2019 08:32:07 +0000 Subject: MISRA-related fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12586 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/include/hal_adc.h | 8 ++++---- os/hal/include/hal_buffers.h | 2 ++ os/hal/include/hal_dac.h | 6 +++--- os/hal/include/hal_persistent.h | 8 ++++---- os/hal/include/hal_rtc.h | 4 ++-- os/hal/include/hal_spi.h | 8 ++++---- 6 files changed, 19 insertions(+), 17 deletions(-) (limited to 'os/hal/include') diff --git a/os/hal/include/hal_adc.h b/os/hal/include/hal_adc.h index 57797c7ee..81104ffc2 100644 --- a/os/hal/include/hal_adc.h +++ b/os/hal/include/hal_adc.h @@ -177,18 +177,18 @@ struct hal_adc_driver { * @brief Current conversion group pointer or @p NULL. */ const ADCConversionGroup *grpp; -#if ADC_USE_WAIT || defined(__DOXYGEN__) +#if (ADC_USE_WAIT == TRUE) || defined(__DOXYGEN__) /** * @brief Waiting thread. */ thread_reference_t thread; -#endif -#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) +#endif /* ADC_USE_WAIT == TRUE */ +#if (ADC_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__) /** * @brief Mutex protecting the peripheral. */ mutex_t mutex; -#endif /* ADC_USE_MUTUAL_EXCLUSION */ +#endif /* ADC_USE_MUTUAL_EXCLUSION == TRUE */ #if defined(ADC_DRIVER_EXT_FIELDS) ADC_DRIVER_EXT_FIELDS #endif diff --git a/os/hal/include/hal_buffers.h b/os/hal/include/hal_buffers.h index 9c5ea42d6..200c1b295 100644 --- a/os/hal/include/hal_buffers.h +++ b/os/hal/include/hal_buffers.h @@ -47,7 +47,9 @@ /* Derived constants and error checks. */ /*===========================================================================*/ +/*lint -save -e9027 [10.1] It is meant to be this way, not an error.*/ #if (BUFFERS_CHUNKS_SIZE & (BUFFERS_CHUNKS_SIZE - 1)) != 0 +/*lint -restore*/ #error "BUFFERS_CHUNKS_SIZE must be a power of two" #endif diff --git a/os/hal/include/hal_dac.h b/os/hal/include/hal_dac.h index 403df4970..b3624dc07 100644 --- a/os/hal/include/hal_dac.h +++ b/os/hal/include/hal_dac.h @@ -158,18 +158,18 @@ struct hal_dac_driver { /** * @brief Samples buffer size. */ - uint16_t depth; + size_t depth; /** * @brief Current configuration data. */ const DACConfig *config; -#if DAC_USE_WAIT || defined(__DOXYGEN__) +#if (DAC_USE_WAIT == TRUE) || defined(__DOXYGEN__) /** * @brief Waiting thread. */ thread_reference_t thread; #endif /* DAC_USE_WAIT */ -#if DAC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) +#if (DAC_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__) /** * @brief Mutex protecting the bus. */ diff --git a/os/hal/include/hal_persistent.h b/os/hal/include/hal_persistent.h index 99697f131..e6005227c 100644 --- a/os/hal/include/hal_persistent.h +++ b/os/hal/include/hal_persistent.h @@ -65,7 +65,7 @@ typedef uint32_t ps_offset_t; /** * @brief @p BasePersistentStorage specific methods. */ -#define _base_persistent_storage_methods_alone \ +#define _base_pers_storage_methods_alone \ /* Storage size.*/ \ size_t (*getsize)(void *instance); \ /* Read operation.*/ \ @@ -78,15 +78,15 @@ typedef uint32_t ps_offset_t; /** * @brief @p BasePersistentStorage specific methods with inherited ones. */ -#define _base_persistent_storage_methods \ +#define _base_pers_storage_methods \ _base_object_methods \ - _base_persistent_storage_methods_alone + _base_pers_storage_methods_alone /** * @brief @p BasePersistentStorage virtual methods table. */ struct BasePersistentStorageVMT { - _base_persistent_storage_methods + _base_pers_storage_methods }; /** diff --git a/os/hal/include/hal_rtc.h b/os/hal/include/hal_rtc.h index e64b036e9..ad62e6ff3 100644 --- a/os/hal/include/hal_rtc.h +++ b/os/hal/include/hal_rtc.h @@ -128,7 +128,7 @@ typedef struct { #error "RTC LLD does not define the required RTC_HAS_STORAGE macro" #endif -#if RTC_HAS_STORAGE || defined(__DOXYGEN__) +#if (RTC_HAS_STORAGE == TRUE) || defined(__DOXYGEN__) /** * @extends FileStream * @@ -143,7 +143,7 @@ struct RTCDriverVMT { * @brief Structure representing an RTC driver. */ struct RTCDriver { -#if RTC_HAS_STORAGE || defined(__DOXYGEN__) +#if (RTC_HAS_STORAGE == TRUE) || defined(__DOXYGEN__) /** * @brief Virtual Methods Table. */ diff --git a/os/hal/include/hal_spi.h b/os/hal/include/hal_spi.h index 57f63e13c..35b42c90c 100644 --- a/os/hal/include/hal_spi.h +++ b/os/hal/include/hal_spi.h @@ -198,18 +198,18 @@ struct hal_spi_driver { * @brief Current configuration data. */ const SPIConfig *config; -#if SPI_USE_WAIT || defined(__DOXYGEN__) +#if (SPI_USE_WAIT == TRUE) || defined(__DOXYGEN__) /** * @brief Waiting thread. */ thread_reference_t thread; -#endif /* SPI_USE_WAIT */ -#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) +#endif /* SPI_USE_WAIT == TRUE */ +#if (SPI_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__) /** * @brief Mutex protecting the peripheral. */ mutex_t mutex; -#endif /* SPI_USE_MUTUAL_EXCLUSION */ +#endif /* SPI_USE_MUTUAL_EXCLUSION == TRUE */ #if defined(SPI_DRIVER_EXT_FIELDS) SPI_DRIVER_EXT_FIELDS #endif -- cgit v1.2.3