Graphics framework for GR-PEACH. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

Dependents:   ImageZoomInout_Sample ImageRotaion_Sample ImageScroll_Sample GR-PEACH_LCD_4_3inch_Save_to_USB ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers r_static_an_tag.h Source File

r_static_an_tag.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * DISCLAIMER
00003 * This software is supplied by Renesas Electronics Corporation and is only
00004 * intended for use with Renesas products. No other uses are authorized. This
00005 * software is owned by Renesas Electronics Corporation and is protected under
00006 * all applicable laws, including copyright laws.
00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
00016 * Renesas reserves the right, without notice, to make changes to this software
00017 * and to discontinue the availability of this software. By using this software,
00018 * you agree to the additional terms and conditions found by accessing the
00019 * following link:
00020 * http://www.renesas.com/disclaimer
00021 * Copyright (C) 2012 - 2015 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 /**
00024 * @file  r_static_an_tag.h
00025 * @brief   Reviewed tag for warnings of static code analysis.
00026 *
00027 * $Module: OSPL $ $PublicVersion: 0.90 $ (=R_OSPL_VERSION)
00028 * $Rev: 35 $
00029 * $Date:: 2014-04-15 21:38:18 +0900#$
00030 */
00031 
00032 #ifndef R_STATIC_AN_TAG_H
00033 #define R_STATIC_AN_TAG_H
00034 
00035 
00036 /******************************************************************************
00037 Includes   <System Includes> , "Project Includes"
00038 ******************************************************************************/
00039 #include  "Project_Config.h"
00040 #include  "r_typedefs.h"
00041 #include  "r_multi_compiler.h"
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif /* __cplusplus */
00046 
00047 
00048 /******************************************************************************
00049 Typedef definitions
00050 ******************************************************************************/
00051 
00052 /******************************************************************************
00053 Macro definitions
00054 ******************************************************************************/
00055 
00056 /******************************************************************************
00057 Variable Externs
00058 ******************************************************************************/
00059 
00060 /******************************************************************************
00061 Functions Prototypes
00062 ******************************************************************************/
00063 
00064 /***********************************************************************
00065 * Macros: IS
00066 *    Changes the code accepted with MISRA 13.2 to readable
00067 *
00068 * Arguments:
00069 *    bool_value - The expression that evaluated result becomes boolean type
00070 *
00071 * Return Value:
00072 *    Evaluate result of "bool_value != 0".
00073 *
00074 * Description:
00075 *   Avoid "not 0" as double negation.
00076 *   "IS" macro corresponds to cast to boolean type specified in the language.
00077 *
00078 *   This is for QAC warning : MISRA 13.2 Advice : Tests of a value against
00079 *   zero should be made explicit, unless the operand is effectively Boolean.
00080 *
00081 *   Write this macro after being warned by static code analyzer.
00082 *
00083 * Example:
00084 *    > if ( IS( bool_value ) ) {...}
00085 *    > if ( IS( bool_value ) && IS( bool_value2 ) && ! bool_value3 ) {...}
00086 *    > if ( IS( unsigned_bitfield ) ) {...}
00087 *    > bool_t is_flag = (bool_t) unsigned_bitfield;  ("IS" is not used)
00088 ************************************************************************/
00089 /* ->MISRA 19.7 : For return _Bool type */ /* ->SEC M5.1.3 */
00090 #if ! R_BOOL_IS_SIGNED
00091 #define  IS( bool_value )  ( (bool_t)( bool_value ) != 0u )
00092 #else
00093 #define  IS( bool_value )  ( (bool_t)( bool_value ) != 0 )
00094 #endif
00095 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00096 
00097 #if 0
00098 /* Comment out because if checking type function(this) was called, raises SEC R3.6.2(QAC 3441) */
00099 #define  IS( bool_value )  ( IS_Sub( bool_value ) != 0 )
00100 INLINE bool_t  IS_Sub( bool_t const  value )   /* Check type only */
00101 {
00102     return  value;
00103 }
00104 #endif
00105 
00106 
00107 /***********************************************************************
00108 * Macros: IF_DQ
00109 *    Error check on DEBUG and QAC version for faster
00110 ************************************************************************/
00111 /* ->MISRA 19.4 : Compliant with C language syntax. */ /* ->SEC M1.8.2 */
00112 #if defined(__QAC_ARM_H__)
00113 #define  IF_DQ  if
00114 #else
00115 #define  IF_DQ  IF_D
00116 #endif
00117 /* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
00118 
00119 
00120 /***********************************************************************
00121 * Macros: IF_DS
00122 *    Error check on DEBUG and QAC version for always false
00123 *
00124 * Description:
00125 *    QAC assist tool founds IF_DS keyword.
00126 *    Sentence using this expects IPA SEC O4.1, O1.1.
00127 ************************************************************************/
00128 #define  IF_DS  IF_DQ
00129 
00130 
00131 /***********************************************************************
00132 * Macros: IF_S
00133 *    Error check on QAC version for always false
00134 *
00135 * Description:
00136 *    QAC assist tool founds IF_S keyword.
00137 *    Compiler always does not check it.
00138 ************************************************************************/
00139 /* ->MISRA 19.4 : Compliant with C language syntax. */ /* ->SEC M1.8.2 */
00140 #if defined(__QAC_ARM_H__)
00141 #define  IF_S               if
00142 #else
00143 #define  IF_S( Condition )  if ( false )
00144 #endif
00145 /* <-MISRA 19.4 */ /* <-SEC M1.8.2 */
00146 
00147 
00148 /**
00149 * @def  R_CUT_IF_ALWAYS
00150 * @brief  Whether a expression always true/false was cut or not.
00151 * @par Parameters
00152 *    None
00153 * @return  None.
00154 *
00155 * @par Description
00156 *    The value is 0 or 1.
00157 *    This macro is for @ref R_CUT_IF_ALWAYS_TRUE and @ref R_CUT_IF_ALWAYS_FALSE.
00158 */
00159 #ifndef  R_CUT_IF_ALWAYS
00160 #if defined(__QAC_ARM_H__)
00161 #define  R_CUT_IF_ALWAYS  0
00162 #else
00163 #define  R_CUT_IF_ALWAYS  1
00164 #endif
00165 #endif
00166 
00167 
00168 /**
00169 * @def  R_CUT_IF_ALWAYS_TRUE
00170 * @brief  Assertion that the expression is always true
00171 * @par Parameters
00172 *    None
00173 * @return  None.
00174 */
00175 #if R_CUT_IF_ALWAYS
00176 #define  R_CUT_IF_ALWAYS_TRUE( expression_and )
00177 #else
00178 /* ->MISRA 19.10 : Can not in ( ). e.g. expression_and = " a >= 0  &&" */
00179 #define  R_CUT_IF_ALWAYS_TRUE( expression_and )  expression_and
00180 /* <-MISRA 19.10 */
00181 #endif
00182 
00183 
00184 /**
00185 * @def  R_CUT_IF_ALWAYS_FALSE
00186 * @brief  Assertion that the expression is always false
00187 * @par Parameters
00188 *    None
00189 * @return  None.
00190 */
00191 #if R_CUT_IF_ALWAYS
00192 #define  R_CUT_IF_ALWAYS_FALSE( expression_or )
00193 #else
00194 /* ->MISRA 19.10 : Can not in ( ). e.g. expression_and = " a >= 0  &&" */
00195 #define  R_CUT_IF_ALWAYS_FALSE( expression_or )  expression_or
00196 /* <-MISRA 19.10 */
00197 #endif
00198 
00199 
00200 /**
00201 * @def  R_UNREFERENCED_VARIABLE
00202 * @brief  Assertion that specified variable is not referenced
00203 * @par Parameters
00204 *    None
00205 * @return  None.
00206 *
00207 * @par Description
00208 *    This avoids warning of "set but never used".
00209 */
00210 /* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
00211 #define  R_UNREFERENCED_VARIABLE( a1 )  R_UNREFERENCED_VARIABLE_Sub( &(a1) )
00212 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00213 /* ->QAC 3206 : Not used argument */
00214 INLINE void  R_UNREFERENCED_VARIABLE_Sub( volatile const void *a1 ) { }
00215 /* <-QAC 3206 */
00216 
00217 
00218 /**
00219 * @def  R_UNREFERENCED_VARIABLE_2
00220 * @brief  Assertion that specified variable is not referenced
00221 * @par Parameters
00222 *    None
00223 * @return  None.
00224 *
00225 * @par Description
00226 *    This avoids warning of "set but never used".
00227 */
00228 /* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
00229 #define  R_UNREFERENCED_VARIABLE_2( a1,a2 )  R_UNREFERENCED_VARIABLE_2_Sub( &(a1), &(a2) )
00230 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00231 /* ->QAC 3206 : Not used argument */
00232 INLINE void  R_UNREFERENCED_VARIABLE_2_Sub( volatile const void *a1, volatile const void *a2 ) { }
00233 /* <-QAC 3206 */
00234 
00235 
00236 /**
00237 * @def  R_UNREFERENCED_VARIABLE_3
00238 * @brief  Assertion that specified variable is not referenced
00239 * @par Parameters
00240 *    None
00241 * @return  None.
00242 *
00243 * @par Description
00244 *    This avoids warning of "set but never used".
00245 */
00246 /* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
00247 #define  R_UNREFERENCED_VARIABLE_3( a1,a2,a3 )  R_UNREFERENCED_VARIABLE_3_Sub( &(a1), &(a2), &(a3) )
00248 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00249 /* ->QAC 3206 : Not used argument */
00250 INLINE void  R_UNREFERENCED_VARIABLE_3_Sub( volatile const void *a1, volatile const void *a2,
00251         volatile const void *a3 ) { }
00252 /* <-QAC 3206 */
00253 
00254 
00255 /**
00256 * @def  R_UNREFERENCED_VARIABLE_4
00257 * @brief  Assertion that specified variable is not referenced
00258 * @par Parameters
00259 *    None
00260 * @return  None.
00261 *
00262 * @par Description
00263 *    This avoids warning of "set but never used".
00264 */
00265 /* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
00266 #define  R_UNREFERENCED_VARIABLE_4( a1,a2,a3,a4 )  R_UNREFERENCED_VARIABLE_4_Sub( &(a1), &(a2), &(a3), &(a4) )
00267 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00268 /* ->QAC 3206 : Not used argument */
00269 INLINE void  R_UNREFERENCED_VARIABLE_4_Sub( volatile const void *a1, volatile const void *a2,
00270         volatile const void *a3, volatile const void *a4 ) { }
00271 /* <-QAC 3206 */
00272 
00273 
00274 /**
00275 * @def  R_IT_WILL_BE_NOT_CONST
00276 * @brief  variable WILL_BE_NOT_CONST
00277 * @par Parameters
00278 *    None
00279 * @return  None.
00280 *
00281 * @par Description
00282 *    This avoids MISRA 16.7 advisory and SEC M1.11.1 for not modified API argument
00283 *    will be not const future.
00284 */
00285 /* ->MISRA 16.7 */ /* ->SEC M1.11.1 : Tell to QAC/compiler that "*Pointer" was changed */
00286 INLINE void  R_IT_WILL_BE_NOT_CONST( void *Pointer );  /* MISRA 8.1 Advice */
00287 INLINE void  R_IT_WILL_BE_NOT_CONST( void *Pointer )
00288 {
00289     R_UNREFERENCED_VARIABLE( Pointer );
00290 }
00291 /* <-MISRA 16.7 */ /* <-SEC M1.11.1 */
00292 
00293 
00294 /**
00295 * @def  R_AVOID_UNSAFE_ALWAYS_WARNING
00296 * @brief  Specifies the code cannot be cut.
00297 * @par Parameters
00298 *    None
00299 * @return  None.
00300 *
00301 * @par Description
00302 *    This avoid MISRA 13.7 require always true/false condition.
00303 *    This tells to QAC/compiler that "Variable" was changed.
00304 */
00305 /* ->MISRA 19.7 : Argument must be any type */ /* ->SEC M5.1.3 */
00306 #define  R_AVOID_UNSAFE_ALWAYS_WARNING( Variable ) \
00307     R_AVOID_UNSAFE_ALWAYS_WARNING_SUB( &(Variable) )
00308 /* <-MISRA 19.7 */ /* <-SEC M5.1.3 */
00309 /* ->MISRA 16.7 : Tell to QAC/compiler that "Variable" was changed */ /* ->SEC M1.11.1 */
00310 INLINE void  R_AVOID_UNSAFE_ALWAYS_WARNING_SUB( void *Pointer );  /* MISRA 8.1 Advice */
00311 INLINE void  R_AVOID_UNSAFE_ALWAYS_WARNING_SUB( void *Pointer )
00312 /* <-MISRA 16.7 */ /* <-SEC M1.11.1 */
00313 {
00314     R_UNREFERENCED_VARIABLE( Pointer );
00315 }
00316 
00317 
00318 /**
00319 * @def  TO_UNSIGNED
00320 * @brief  Cast to unsigned type constant value
00321 * @par Parameters
00322 *    None
00323 * @return  None.
00324 */
00325 /* ->MISRA 19.7 : It is not able to replace to function because this expands macro's parameter */
00326 /* ->SEC M5.1.3 */
00327 #define  TO_UNSIGNED(x)  TO_UNSIGNED_AGAIN(x)  /* Expand "x" */
00328 /* <-MISRA 19.7 */
00329 /* <-SEC M5.1.3 */
00330 
00331 /* ->MISRA 19.13 */ /* ->SEC M5.1.2 (1) */
00332 #define  TO_UNSIGNED_AGAIN(x)  (x##u)
00333 /* <-MISRA 19.13 */ /* <-SEC M5.1.2 (1) */
00334 
00335 
00336 /**
00337 * @brief   Cast to unsigned type constant value
00338 *
00339 * @par Parameters
00340 *    None
00341 * @return  None.
00342 *
00343 * @par Description
00344 *    This can not avoid QAC warning. This macro is for count reviewed code automatically.
00345 */
00346 INLINE uint32_t  R_ToUnsigned( int32_t const  ConstantInteger )
00347 {
00348     return  (uint32_t) ConstantInteger;
00349 }
00350 
00351 
00352 /**
00353 * @brief   Cast to signed type constant value
00354 *
00355 * @par Parameters
00356 *    None
00357 * @return  None.
00358 *
00359 * @par Description
00360 *    This can not avoid QAC warning. This macro is for count reviewed code automatically.
00361 */
00362 INLINE int32_t  R_ToSigned( uint32_t const  ConstantInteger )
00363 {
00364     return  (int32_t) ConstantInteger;
00365 }
00366 
00367 
00368 /***********************************************************************
00369 * End of File:
00370 ************************************************************************/
00371 #ifdef __cplusplus
00372 }  /* extern "C" */
00373 #endif /* __cplusplus */
00374 
00375 #endif /* R_STATIC_AN_TAG_H */
00376