CppCodingStandardCheckerReview:/AbraxasSample

Abraxas Sample

The following is a trivial C++ program which is compliance checked using the  MISRA Coding Standards (quite strict).

Input file

int myfunction() {
int f = 1;
return (f);
}

int main(int argc, char *argv[]) {
int a;
int b;
a = 2;
b = 3;
int c;
c = a + b;
exit(0);
}

Output File

robyn@gumtree.tuc.noao.edu% ./ccdemo g411p.ccp -Rmisra04.cco yourfile.cc

Abraxas Software (R) CodeCheck Linux Version 1410 B1 DEMO
Copyright (c) 1988-2008, by Abraxas Software, Inc. All rights reserved.

Checking GNU - GCC C/C++ file yourfile.cc with rules from misra04.cc:

yourfile.cc(3): Warning W0071: yourfile.cc(3) : Rule 71 (REQUIRED) 8.1 Functions shall always have prototype declarations. {DEFN}
yourfile.cc(3): Warning W0074: yourfile.cc(3) : Rule 74 (REQUIRED) 16.4 identifiers given for any of the parameters decl and/or defn must be same
yourfile.cc(4): Warning W0013: yourfile.cc(4) : Rule 13 (ADVISED)  6.3 Typedefs should be used in place of basic types
yourfile.cc(5): Warning W0083: yourfile.cc(5) : Rule 83 (REQUIRED) 16.8 Non Void return type must match. { RET MISMATCH }
yourfile.cc(8): Warning W0013: yourfile.cc(8) : Rule 13 (ADVISED)  6.3 Typedefs should be used in place of basic types
yourfile.cc(8): Warning W0013: yourfile.cc(8) : Rule 13 (ADVISED)  6.3 Typedefs should be used in place of basic types
yourfile.cc(8): Warning W0014: yourfile.cc(8) : Rule 14 (REQUIRED) 6.2 char should only be used with the signed or unsigned keyword.
yourfile.cc(8): Warning W0071: yourfile.cc(8) : Rule 71 (REQUIRED) 8.1 Functions shall always have prototype declarations. {DEFN}
yourfile.cc(8): Warning W0074: yourfile.cc(8) : Rule 74 (REQUIRED) 16.4 identifiers given for any of the parameters decl and/or defn must be same
yourfile.cc(9): Warning W0013: yourfile.cc(9) : Rule 13 (ADVISED)  6.3 Typedefs should be used in place of basic types
yourfile.cc(10): Warning W0013: yourfile.cc(10) : Rule 13 (ADVISED)  6.3 Typedefs should be used in place of basic types
yourfile.cc(13): Warning W0013: yourfile.cc(13) : Rule 13 (ADVISED)  6.3 Typedefs should be used in place of basic types
yourfile.cc(15): Warning W0126: yourfile.cc(15) : Rule 126 (REQUIRED) 20.11 Library functions abort, exit, getenv and system should not be used.
yourfile.cc(15): Warning W0071: yourfile.cc(15) : Rule 71 (REQUIRED) 8.1 Functions shall always have prototype declarations. {CALL}
yourfile.cc(16): Warning W0083: yourfile.cc(16) : Rule 83 (REQUIRED) 16.8 Non void return type must be explicit expression. { RET VOID }
File yourfile.cc check complete.