File tree Expand file tree Collapse file tree 2 files changed +48
-1
lines changed
autosar/test/rules/M0-1-10
common/src/codingstandards/cpp Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 1+ #include < cstdint>
2+
3+ // @brief func1
4+ // @return exit code
5+ int32_t func1 (void ) noexcept { // COMPLIANT
6+ int32_t x; // CAUTION: uninitialized!!
7+ int32_t ret;
8+ ret = func2 (x);
9+ return ret;
10+ }
11+
12+ // @brief func2
13+ // @param arg parameter
14+ // @return exit code
15+ int32_t func2 (const int32_t arg) // COMPLIANT
16+ {
17+ int32_t ret;
18+ ret = arg * arg;
19+ return ret;
20+ }
21+
22+ namespace mains {
23+ static int32_t var;
24+
25+ // @brief namespace_func
26+ static void namespace_func (void ) noexcept { // COMPLIANT
27+ mains::var = -1 ;
28+ return ;
29+ }
30+ } // namespace
31+
32+ // @brief main
33+ // @return exit code
34+ int32_t main (void ) {
35+ int32_t ret {0 };
36+ try {
37+ ret = func1 ();
38+ mains::var += ret;
39+ }
40+ catch (...) {
41+ mains::namespace_func ();
42+ }
43+ return ret;
44+ }
Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ abstract class EncapsulatingFunction extends Function { }
1414class MainFunction extends MainLikeFunction {
1515 MainFunction ( ) {
1616 hasGlobalName ( "main" ) and
17- getType ( ) instanceof IntType
17+ (
18+ getType ( ) instanceof IntType or
19+ getType ( ) instanceof Int32_t
20+ )
1821 }
1922}
2023
You can’t perform that action at this time.
0 commit comments