NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
ivclib-static-analysis.h
Go to the documentation of this file.
1 //
2 // SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 // SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 //
5 // NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 // property and proprietary rights in and to this material, related
7 // documentation and any modifications thereto. Any use, reproduction,
8 // disclosure or distribution of this material and related documentation
9 // without an express license agreement from NVIDIA CORPORATION or
10 // its affiliates is strictly prohibited.
11 //
12 
13 #ifndef IVCLIB_STATIC_ANALYSIS_H
14 #define IVCLIB_STATIC_ANALYSIS_H
15 
16 // Inline annotations to suppress Partial Deviations (PDs) and False Positives
17 // (FPs) reported by Coverity (since version 2019.06). Enabled as follows:
18 // $ NV_BUILD_CONFIGURATION_IS_COVERITY=1 tmp
19 
20 #ifdef NV_IS_COVERITY
21 
22 #define IVCLIB_CERTC(num) CERT_##num
23 
24 #define IVCLIB_COV_WHITE_LIST(type, checker, comment_str) \
25  _Pragma(_str(coverity compliance type checker comment_str))
26 
27 // Disable MISRA C and CERT C/CPP violations caused by the leading underscore in macro names.
28 _Pragma("coverity compliance block (deviate CERT_DCL51_CPP) (deviate CERT_DCL37_C)")
29 _Pragma("coverity compliance block (deviate MISRA_C_2012_Rule_21_1) (deviate MISRA_C_2012_Rule_21_2)")
30 // Disable MISRA C violations caused by sharing this header with C++ compiled binaries.
31 _Pragma("coverity compliance block (deviate MISRA_C_2012_Rule_2_5)")
32 
33 // Disable violation(s) in the helper macro not affecting the final binary.
34 _Pragma("coverity compliance deviate MISRA_C_2012_Rule_20_10")
35 #define _str(_x) #_x
36 // The following _stan*() helpers should not be used outside of this file.
37 #define _stan(rule,fpdev,comment) _Pragma(_str(coverity compliance fpdev rule comment))
38 #ifndef STAN_REPORT_APPROVED
39 # define _stanA(rule,fpdev,id) _stan(rule,fpdev,_str(approved^id))
40 # define _stanD(rule,fpdev,id) _stan(rule,fpdev,_str(deferred^id))
41 #else
42 # define _stanA(rule,fpdev,id)
43 # define _stanD(rule,fpdev,id)
44 #endif
45 #ifdef STAN_SUPPRESS_PENDING
46 # define _stanP(rule,fpdev,id) _stan(rule,fpdev,_str(pending^id))
47 #else
48 # define _stanP(rule,fpdev,id)
49 #endif
50 #ifdef STAN_SUPPRESS_REJECTED
51 # define _stanR(rule,fpdev,id) _stan(rule,fpdev,_str(rejected^id))
52 #else
53 # define _stanR(rule,fpdev,id)
54 #endif
55 #ifdef STAN_SUPPRESS_INSPECTED
56 # define _stanI(rule,fpdev,id) _stan(rule,fpdev,_str(inspected^id))
57 #else
58 # define _stanI(rule,fpdev,id)
59 #endif
60 
61 #define STAN_COVERITY_BUG_SATW_5118_begin \
62  _Pragma("coverity compliance block (fp AUTOSAR_Cpp14_A2_11_1) (fp AUTOSAR_Cpp14_A7_1_6) (fp AUTOSAR_Cpp14_A7_1_8) (fp AUTOSAR_Cpp14_A7_4_1) (fp AUTOSAR_Cpp14_A11_3_1)")
63 
64 #define STAN_COVERITY_BUG_SATW_5118_end \
65  _Pragma("coverity compliance end_block AUTOSAR_Cpp14_A2_11_1 AUTOSAR_Cpp14_A7_1_6 AUTOSAR_Cpp14_A7_1_8 AUTOSAR_Cpp14_A7_4_1 AUTOSAR_Cpp14_A11_3_1")
66 
67 #else
68 
69 #define _stan(rule,fpdev,comment)
70 #define _stanA(rule,fpdev,id)
71 #define _stanD(rule,fpdev,id)
72 #define _stanP(rule,fpdev,id)
73 #define _stanR(rule,fpdev,id)
74 #define _stanI(rule,fpdev,id)
75 
76 #define IVCLIB_COV_WHITE_LIST(type, checker, comment_str)
77 
78 #define STAN_COVERITY_BUG_SATW_5118_begin
79 #define STAN_COVERITY_BUG_SATW_5118_end
80 
81 #endif
82 
83 // Tags for identifying reference/pointer function parameters.
84 // Should be paired with STAN_A8_4_8_PD_HV_053 annotations right before
85 // function definitions containing any of these tags.
86 #define OUT
87 #define INOUT
88 
89 // All approved, pending, rejected and inspected FPs and PDs for ivclib shall be listed below.
90 
91 // Approved deviations
92 
93 #define STAN_DCL37_C_PD_VS_193 _stanA(CERT_DCL37_C,deviate,VS-193)
94 #define STAN_EXP55_CPP_FP_HYP_7529 _stanA(CERT_EXP55_CPP,fp,HYP-7529)
95 #define STAN_INT30_C_PD_HYP_4978 _stanA(CERT_INT30_C,deviate,HYP-4978)
96 #define STAN_INT30_C_PD_TID_1999 _stanA(CERT_INT30_C,deviate,TID-1999)
97 #define STAN_A0_1_6_FP_HYP_8787 _stanA(AUTOSAR_Cpp14_A0_1_6,fp,HYP-8787)
98 #define STAN_A1_1_1_PD_HYP_13213 _stanA(AUTOSAR_Cpp14_A1_1_1,deviate,HYP-13213)
99 #define STAN_A1_1_1_PD_HV_135 _stanA(AUTOSAR_Cpp14_A1_1_1,deviate,HV-135)
100 #define STAN_A2_11_1_PD_VS_192 _stanA(AUTOSAR_Cpp14_A2_11_1,deviate,VS-192)
101 #define STAN_A4_7_1_PD_HYP_12975 _stanA(AUTOSAR_Cpp14_A4_7_1,deviate,HYP-12975)
102 #define STAN_A5_2_2_PD_HYP_6132 _stanA(AUTOSAR_Cpp14_A5_2_2,deviate,HYP-6132)
103 #define STAN_A7_1_1_FP_HV_068 _stanA(AUTOSAR_Cpp14_A7_1_1,fp,HV-068)
104 #define STAN_A7_1_4_PD_TID_1685 _stanA(AUTOSAR_Cpp14_A7_1_4,deviate,TID-1685)
105 #define STAN_A7_1_6_PD_HYP_6328 _stanA(AUTOSAR_Cpp14_A7_1_6,deviate,HYP-6328)
106 #define STAN_A7_2_2_PD_HV_100 _stanA(AUTOSAR_Cpp14_A7_2_2,deviate,HV-100)
107 #define STAN_A7_2_3_PD_HV_109 _stanA(AUTOSAR_Cpp14_A7_2_3,deviate,HV-109)
108 #define STAN_A7_4_1_PD_VS_069 _stanA(AUTOSAR_Cpp14_A7_4_1,deviate,VS-069)
109 #define STAN_A8_4_8_PD_HV_053 _stanA(AUTOSAR_Cpp14_A8_4_8,deviate,HV-053)
110 #define STAN_A9_6_1_FP_HV_070 _stanA(AUTOSAR_Cpp14_A9_6_1,fp,HV-070)
111 #define STAN_A9_6_1_PD_HV_102 _stanA(AUTOSAR_Cpp14_A9_6_1,deviate,HV-102)
112 #define STAN_A18_1_1_PD_HYP_18946 _stanA(AUTOSAR_Cpp14_A18_1_1,deviate,HYP-18946)
113 #define STAN_2_3_PD_HYP_10576 _stanA(MISRA_C_2012_Rule_2_3,deviate,HYP-10576)
114 #define STAN_D4_9_PD_VS_180 _stanA(MISRA_C_2012_Directive_4_9,deviate,HV-180)
115 #define STAN_R2_5_PD_HV_137 _stanA(MISRA_C_2012_Rule_2_5,deviate,HV-137)
116 #define STAN_4_3_PD_HYP_8049 _stanA(MISRA_C_2012_Directive_4_3,deviate,HYP-8049)
117 #define STAN_5_9_FP_VS_189 _stanA(MISRA_C_2012_Rule_5_9,fp,VS-189)
118 #define STAN_8_13_PD_HYP_10576 _stanA(MISRA_C_2012_Rule_8_13,deviate,HYP-10576 )
119 #define STAN_11_1_PD_HYP_4975 _stanA(MISRA_C_2012_Rule_11_1,deviate,HYP-4975)
120 #define STAN_M7_4_3_PD_TID_2116 _stanA(AUTOSAR_Cpp14_M7_4_3,deviate,TID-2116)
121 #define STAN_A7_1_4_PD_TID_1685 _stanA(AUTOSAR_Cpp14_A7_1_4,deviate,TID-1685)
122 #define STAN_M5_2_8_PD_HYP_19474 _stanA(AUTOSAR_Cpp14_M5_2_8,deviate,HYP-19475)
123 #define STAN_R11_4_PD_HV_125 _stanA(MISRA_C_2012_Rule_11_4,deviate,HV-125)
124 
125 // Deferred deviations
126 #define STAN_INT31_C_PD_TID_2982 _stanD(CERT_INT31_C,deviate,TID-2982)
127 
128 // Pending deviations
129 
130 #define STAN_R2_4_PD_HYP_20145 _stanP(MISRA_C_2012_Rule_2_4,deviate,HYP-20145)
131 #define STAN_A0_1_3_FP_HYP_18383 _stanP(AUTOSAR_Cpp14_A0_1_3,fp,HYP-18383)
132 #define STAN_A8_4_10_PD_HYP_21165 _stanP(AUTOSAR_Cpp14_A8_4_10,deviate,HYP-21165)
133 #define STAN_M0_1_10_PD_HYP_20589 _stanP(AUTOSAR_Cpp14_M0_1_10,deviate,HYP-20589)
134 #define STAN_M5_2_9_PD_HYP_19475 _stanP(AUTOSAR_Cpp14_M5_2_9,deviate,HYP-19474)
135 
136 // Rejected deviations
137 
138 #define STAN_EXP32_C_PD_HYP_4977 _stanR(CERT_EXP32_C,deviate,HYP-4977)
139 #define STAN_4_7_PD_HYP_4979 _stanR(MISRA_C_2012_Directive_4_7,deviate,HYP-4979)
140 #define STAN_8_6_PD_HYP_4976 _stanR(MISRA_C_2012_Rule_8_6,deviate,HYP-4976)
141 #define STAN_11_3_PD_HYP_8056 _stanR(MISRA_C_2012_Rule_11_3,deviate,HYP-8056)
142 #define STAN_11_8_PD_HYP_4971 _stanR(MISRA_C_2012_Rule_11_8,deviate,HYP-4971)
143 
144 // Violations Inspected/To inspect
145 #define STAN_A0_1_3_FP_HYP_8465 _stanI(AUTOSAR_Cpp14_A0_1_3,fp,HYP-8465)
146 #define STAN_A4_7_1_FP_HYP_4752 _stanI(AUTOSAR_Cpp14_A4_7_1,fp,HYP-4752)
147 #define STAN_M5_0_15_PD_HYP_8675 _stanI(AUTOSAR_Cpp14_M5_0_15,deviate,HYP-8675)
148 #define STAN_A5_2_3_PD_HYP_7746 _stanI(AUTOSAR_Cpp14_A5_2_3,deviate,HYP-7746)
149 #define STAN_M5_2_8_PD_HYP_7098 _stanI(AUTOSAR_Cpp14_M5_2_8,deviate,HYP-7098)
150 
151 // TBD
152 // L3 rule, cannot be treated as advisory
153 #define STAN_EXP37_C_PD_HYP_10579 _stanI(CERT_EXP37_C,deviate,HYP-10579)
154 // L3 rule, cannot be treated as advisory
155 #define STAN_EXP40_C_PD_HYP_10579 _stanI(CERT_EXP40_C,deviate,HYP-10579)
156 // L3 rule, cannot be treated as advisory
157 #define STAN_EXP44_C_PD_HYP_10579 _stanI(CERT_EXP44_C,deviate,HYP-10579)
158 // L3 rule, cannot be treated as advisory
159 #define STAN_INT36_C_PD_HYP_10579 _stanI(CERT_INT36_C,deviate,HYP-10579)
160 #define STAN_M0_1_10_FP_HYP_8741 _stanI(AUTOSAR_Cpp14_M0_1_10,fp,HYP-8741)
161 
162 #ifdef NV_IS_COVERITY
163 _Pragma("coverity compliance end_block MISRA_C_2012_Rule_2_5")
164 _Pragma("coverity compliance end_block MISRA_C_2012_Rule_21_1 MISRA_C_2012_Rule_21_2")
165 _Pragma("coverity compliance end_block CERT_DCL51_CPP CERT_DCL37_C")
166 #endif
167 
168 #endif // include guard