3

I have a Visual Studio Windows Console application with ANSI C code. The main function definition is something like:

int main(void)
{
    // do stuff
    return 0;
}

However, PC-Lint reports the below message for the int type

Note 970: Use of modifier or type ⁡int⁢ outside of a typedef [MISRA 2012 Directive 4.6, advisory]

I need to keep both the int type for the main function and the Note 970. Therefore, I want to suppress Note 970 just for the main function definition. I don't want to put a //lint !e970 on the source code.

I would like to know if it is possible to suppress this message only for the definition of the main function with PC-Lint options.

Cem Polat
  • 101
  • 1
  • 7
  • 3
    Thanks for yet another chance to shame this buggy tool publicly on the internet. Almost every single MISRA question about Lint comes with the answer "it is a bug in Lint"/"it is a false positive". Maybe if we shame them enough perhaps they will finally get their crap straight. I would recommend using another tool. – Lundin Feb 15 '18 at 15:12
  • 1
    Well, if you want to use PC-Lint for MISRA you will have to add some lint comments in the code. It's inevitable. If you have a main.c you could do something like "lint-nt.exe -esym(970,int) main.c +esym(970,int) file1.c file2.c ...", but it obviously does not scale very well. – Lars Ljung Feb 15 '18 at 21:28

1 Answers1

6

Your tool is broken, report a bug to PC Lint.

Quoting MISRA-C:2012 Directive 4.6:

Exceptions:

For function main an int may be used rather than the typedefs as a return type. Therefore int main (void) is permitted.

Community
  • 1
  • 1
Lundin
  • 195,001
  • 40
  • 254
  • 396