Automated Defect Identification
by Kevin Smith

Listing One
// ------------------------------------------------------------------------
// This file contains specific lint checks that are MANDATORY before
// submitting software into the source code library system.
// ------------------------------------------------------------------------

// ------------------------------------------------------------------------
// Use warning level 1 and continue when an error is encountered
// ------------------------------------------------------------------------

-w1
+fce

// ------------------------------------------------------------------------
// These checks usually find errors...
// ------------------------------------------------------------------------

// non-void function not returning anything
+e533
// returning address of a local (stack) variable
+e604
// using delete when you should use delete[] or free when you want delete
+e424
// use of null pointers
+e413
// out-of-bounds pointers such as "int a[10]; a[10] = 0;"
+e415
+e416
// subtract a value from a pointer returned from malloc (or an auto array)
+e428
// boolean argument to relational, such as "if (a < b < c)"
+e503
// using = when you meant == such as "if (x = 10)"
+e720
// semi-colon after an if such as "if (x == y);"
+e548
// order of evaluation dependency such as "x = i + i++;"
+e564
// classic problems with "%" args in printf-style commands
+e417
+e557
+e558
+e560
+e561
+e566
+e567
+e622
+e627
// non-ANSI escape sequence such as "printf("\i");"
+e606
// constant out of range for operator such as "if (byte < 65537)"
+e650
// signed-unsigned mix with divide such as "x = uint / int;"
+e573
// passing a null pointer to function such as "strcpy(null, null);"
+e418
// data overrun for function such as "char x[1]; strcpy(x, "abc");"
+e419
// access beyond array for function
+e420
// passing a negative value to function such as "x = malloc(-1);"
+e422
// malloc size issues
+e432
+e433
// unused label (usually finds problems with case labels)
+e563

// ------------------------------------------------------------------------
// These checks reflect poor programming style with bad consequences
// ------------------------------------------------------------------------

// started a comment or struct but didn't finish it before end of file
+e404
+e405
+e406
// don't call virtual functions from within constructor or destructor
+e1506
// flag header files that aren't used by the module that includes them
+e766
// don't use gets() because it is dangerous (possible buffer overflows)
+e421
// #define re-defines something that was already #define'd
+e547
// created a #define with same name as a variable
+e652
// really long constant that doesn't fit into a long int
+e417
// mixing int and enum in a case statement
+e408
// ------------------------------------------------------------------------
// Exceptions
// ------------------------------------------------------------------------

// allow macro re-definitions from library headers like stdio.h.
-elib(652)
-elib(547)

// ------------------------------------------------------------------------
// Suppress all syntax errors from warning level 1
// ------------------------------------------------------------------------

-e1 -e2 -e3 -e4 -e5 -e6 -e7 -e8 -e9 -e10
-e11 -e12 -e13 -e14 -e15 -e16 -e17 -e18 -e19 -e20
-e21 -e22 -e23 -e24 -e25 -e26 -e27 -e28 -e29 -e30
-e31 -e32 -e33 -e34 -e35 -e36 -e37 -e38 -e39 -e40
-e41 -e42 -e43 -e44 -e45 -e46 -e47 -e48 -e49 -e50
-e51 -e52 -e53 -e54 -e55 -e56 -e57 -e58 -e59 -e60
-e61 -e62 -e63 -e64 -e65 -e66 -e67 -e68 -e69 -e70
-e71 -e72 -e73 -e74 -e75 -e76 -e77 -e78 -e79 -e80
-e81 -e82 -e83 -e84 -e85 -e86 -e87 -e88 -e89 -e90
-e91 -e92 -e93 -e94 -e95 -e96 -e97 -e98 -e99 -e100
-e101 -e102 -e103 -e104 -e105 -e106 -e107 -e108 -e109 -e110
-e111 -e112 -e113 -e114 -e115 -e116 -e117 -e118 -e119 -e120
-e121 -e122 -e123 -e124 -e125 -e126 -e127 -e128 -e129 -e130
-e131 -e132 -e133 -e134 -e135 -e136 -e137 -e138 -e139 -e140
-e141 -e142 -e143 -e144 -e145 -e146 -e147 -e148 -e149 -e150
-e151 -e152 -e153 -e154 -e155 -e156 -e157 -e158 -e159 -e160
-e161 -e162 -e163 -e164 -e165 -e166 -e167 -e168 -e169 -e170
-e171 -e172 -e173 -e174 -e175 -e176 -e177 -e178 -e179 -e180
-e181 -e182 -e183 -e184 -e185 -e186 -e187 -e188 -e189 -e190
-e191 -e192 -e193 -e194 -e195 -e196 -e197 -e198 -e199
-e1001 -e1002 -e1003 -e1004 -e1005 -e1006 -e1007 -e1008 -e1009 -e1010
-e1011 -e1012 -e1013 -e1014 -e1015 -e1016 -e1017 -e1018 -e1019 -e1020
-e1021 -e1022 -e1023 -e1024 -e1025 -e1026 -e1027 -e1028 -e1029 -e1030
-e1031 -e1032 -e1033 -e1034 -e1035 -e1036 -e1037 -e1038 -e1039 -e1040
-e1041 -e1042 -e1043 -e1044 -e1045 -e1046 -e1047 -e1048 -e1049 -e1050
-e1051 -e1052 -e1053 -e1054 -e1055 -e1056 -e1057 -e1058 -e1059 -e1060
-e1061 -e1062 -e1063 -e1064 -e1065 -e1066 -e1067 -e1068 -e1069 -e1070
-e1071 -e1072 -e1073 -e1074 -e1075 -e1076 -e1077 -e1078 -e1079 -e1080
-e1081 -e1082 -e1083 -e1084 -e1085 -e1086 -e1087 -e1088 -e1089 -e1090
-e1091 -e1092 -e1093 -e1094 -e1095 -e1096 -e1097 -e1098 -e1099 -e1100
-e1101 -e1102 -e1103 -e1104 -e1105 -e1106 -e1107 -e1108 -e1109 -e1110
-e1111 -e1112 -e1113 -e1114 -e1115 -e1116 -e1117 -e1118 -e1119 -e1120
-e1121 -e1122 -e1123 -e1124 -e1125 -e1126 -e1127 -e1128 -e1129 -e1130
-e1131 -e1132 -e1133 -e1134 -e1135 -e1136 -e1137 -e1138 -e1139 -e1140
-e1141 -e1142 -e1143 -e1144 -e1145 -e1146 -e1147 -e1148 -e1149 -e1150
-e1151 -e1152 -e1153 -e1154 -e1155 -e1156 -e1157 -e1158 -e1159 -e1160
-e1161 -e1162 -e1163 -e1164 -e1165 -e1166 -e1167 -e1168 -e1169 -e1170
-e1171 -e1172 -e1173 -e1174 -e1175 -e1176 -e1177 -e1178 -e1179 -e1180
-e1181 -e1182 -e1183 -e1184 -e1185 -e1186 -e1187 -e1188 -e1189 -e1190
-e1191 -e1192 -e1193 -e1194 -e1195 -e1196 -e1197 -e1198







