openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

sdk_source_check.h (2739B)


      1 /*
      2  * 
      3  * 
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      7  * 
      8  * Check for basic source code architecture violations.
      9  *
     10  * Note that if this file is included multiple times, it must
     11  * be propcessed for errors every time.
     12  */
     13 
     14 /*
     15  * Default source check configuration
     16  */
     17 
     18 #ifndef SCHK_SAL_APPL_HEADERS_IN_SOC
     19 #define SCHK_SAL_APPL_HEADERS_IN_SOC    1
     20 #endif
     21 #ifndef SCHK_BCM_HEADERS_IN_SOC
     22 #define SCHK_BCM_HEADERS_IN_SOC         1
     23 #endif
     24 #ifndef SCHK_PRINTK_IN_SOC
     25 #define SCHK_PRINTK_IN_SOC              1
     26 #endif
     27 #ifndef SCHK_SAL_APPL_HEADERS_IN_BCM
     28 #define SCHK_SAL_APPL_HEADERS_IN_BCM    1
     29 #endif
     30 #ifndef SCHK_PRINTK_IN_BCM
     31 #define SCHK_PRINTK_IN_BCM              1
     32 #endif
     33 #ifndef SCHK_SOC_CM_PRINT_IN_APPL
     34 #define SCHK_SOC_CM_PRINT_IN_APPL       0
     35 #endif
     36 #ifndef SCHK_SOC_CM_DEBUG_IN_APPL
     37 #define SCHK_SOC_CM_DEBUG_IN_APPL       0
     38 #endif
     39 #ifndef SCHK_SSCANF_IN_ANY
     40 #define SCHK_SSCANF_IN_ANY              1
     41 #endif
     42 #ifndef SCHK_FSCANF_IN_ANY
     43 #define SCHK_FSCANF_IN_ANY              1
     44 #endif
     45 
     46 /* Help macros */
     47 #if defined(_SAL_CONFIG_H) || defined(_SAL_PCI_H) || \
     48     defined(_SAL_IO_H) || defined(_SAL_H)
     49 #ifndef _SAL_APPL_HDRS
     50 #define _SAL_APPL_HDRS
     51 #endif
     52 #endif
     53 
     54 #if defined(SOURCE_CHECK_LIBSOC)
     55 
     56 #if SCHK_SAL_APPL_HEADERS_IN_SOC
     57 #if defined(_SAL_APPL_HDRS)
     58 #error SAL_APPL_headers_included_from_SOC_sources
     59 #endif
     60 #endif
     61 
     62 #if SCHK_BCM_HEADERS_IN_SOC
     63 #if defined(__BCM_TYPES_H__)
     64 #error BCM_headers_included_from_SOC_sources
     65 #endif
     66 #endif
     67 
     68 #if SCHK_PRINTK_IN_SOC
     69 #ifndef printk
     70 #define printk          DO_NOT_USE_printk_in_SOC
     71 #endif
     72 #endif
     73 
     74 #endif /* defined(SOURCE_CHECK_LIBSOC) */
     75 
     76 
     77 #if defined(SOURCE_CHECK_LIBBCM)
     78 
     79 #if SCHK_SAL_APPL_HEADERS_IN_BCM
     80 #if defined(_SAL_APPL_HDRS)
     81 #error SAL_APPL_headers_included_from_BCM_sources
     82 #endif
     83 #endif
     84 
     85 #if SCHK_PRINTK_IN_BCM
     86 #ifndef printk
     87 #define printk          DO_NOT_USE_printk_in_BCM
     88 #endif
     89 #endif
     90 
     91 #endif /* defined(SOURCE_CHECK_LIBBCM) */
     92 
     93 
     94 #if defined(SOURCE_CHECK_LIBAPPL) && 0
     95 
     96 #if SCHK_SOC_CM_PRINT_IN_APPL
     97 #ifndef soc_cm_print
     98 #define soc_cm_print    DO_NOT_USE_soc_cm_print_in_APPL
     99 #endif
    100 #endif
    101 
    102 #if SCHK_SOC_CM_DEBUG_IN_APPL
    103 #ifndef soc_cm_debug
    104 #define soc_cm_debug    DO_NOT_USE_soc_cm_debug_in_APPL
    105 #endif
    106 #endif
    107 
    108 #endif /* defined(SOURCE_CHECK_LIBAPPL) */
    109 
    110 
    111 /*
    112  * Checks that apply to all source files
    113  */
    114 
    115 #if defined(SOURCE_CHECK_LIBSOC) || \
    116     defined(SOURCE_CHECK_LIBBCM) || \
    117     defined(SOURCE_CHECK_LIBAPPL)
    118 
    119 #if SCHK_SSCANF_IN_ANY
    120 #ifndef sscanf
    121 #define sscanf          DO_NOT_USE_sscanf
    122 #endif
    123 #endif
    124 
    125 #if SCHK_FSCANF_IN_ANY
    126 #ifndef fscanf
    127 #define fscanf          DO_NOT_USE_fscanf
    128 #endif
    129 #endif
    130 
    131 #endif