github/codeql-coding-standards

`RULE-1-3`: `main` functions are not correctly detected according to the standard

lcartey opened this issue · 0 comments

Affected rules

  • RULE-1-3

Description

The detection of standard-compliant main functions is broken:

  • Does not consider the valid use of typedefs.
  • Does not support the use of arrays instead of pointers for argv
  • Definition of the no-arg main is wrong - currently specified the return type should be void, when it should be int, and it should enforce that void is specified in the parameter list to declare no arguments.

Example

int main() { // NON_COMPLIANT[FALSE_NEGATIVE]
}

int main(int argc, char * argv[]) { // COMPLIANT[FALSE_POSITIVE]
}