I suggest you ...

Report differences between formal parameter names in header file prototypes and formal parameter namers in function definitions

Formal parameter names in function prototypes are optional, but are often used, ideally with names that convey something about the value that should be passed. In C and C++, those names have prototype scope, go away after the prototype is parsed and processed, and are irrelevant to code generation--but a discrepancy between the name of the formal in the prototype and the corresponding name in the function definition can mislead a programmer seeing only the prototype and cause him or her to pass the wrong value. It would therefore be worthwhile for a lint program to remember the prototype formal parameter names and report discrepancies between them and the parameter names in the function defintiion.

10 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    James Jones shared this idea  ·   ·  Admin →

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Achim Olaf Zacher commented  · 

        It has been part of MISRA C1 1998 and MISRA C2 2004 checking already. ((Rule 74/16.4) Parameter list differs from prior declaration for function.)
        But it doesn't detect missing/different const in header?

      • Michael Metivier commented  · 

        This functionality is included in version 9.0k as Note 9072. From my test program:

        Note 9072: parameter list differs from prior declaration for function 'driver(const sbConfigT *, sbStateT *)' [MISRA 2012 Rule 8.3, required]

        This is enabled by selecting the -misra(3) option, or it should be able to be enabled directly by +e9072

      Feedback and Knowledge Base