Fixed all messages reported in third run using memory checks.
Now running LCLint reports no anomalies.
dbase.c: (in macro firstERC) dbase.c:4,20: Unrecognized identifier in macro definition: mMGRS dbase.c: (in macro lastERC) dbase.c:5,19: Unrecognized identifier in macro definition: fNONThe macro definitions are before the enumerator definition, so mMGRS and fNON are not yet defined. (Without macro checking, no error was reported since they are defined where the macro is used.) We move the macro definitions after the enumerator definitions.
employee.h:5: Macro constant employeeFormat not declared Macro constant has no declaration. Use /*@constant ...@*/ to declare the macro. Use -macroconstdecl to suppress message. dbase.c:4: Macro constant firstERC not declared dbase.c:5: Macro constant lastERC not declared dbase.c:6: Macro constant numERCS not declaredSince there is no declaration, the type of the macro cannot be checked, and it is allowed to match any type. For the three errors in dbase.c, we add /*@constant ...@*/ declarations for the macros:
/*@constant static employeeKinds firstERC;@*/ # define firstERC mMGRS /*@constant static employeeKinds lastERC;@*/ # define lastERC fNON /*@constant static int numERCS;@*/ # define numERCS (lastERC - firstERC + 1)We could do the same thing for employeeFormat, but then we would not get checking for the printf arguments where employeeFormat is used. Instead, we put /*@notfunction@*/ before the definition, so employeeFormat is expanded normally.