Search code examples
cclangc89

Making `too many arguments in call to function` an error in Clang


I am trying to make the compiler warning warning: too many arguments in call to 'IF' an error (where IF is a function).

I am having trouble configuring clang, as I cannot figure out the actual name of the warning.

I tried the following:

clang -Werror=too-many-arguments main.c

warning: unknown warning option '-Werror=too-many-arguments'; did you mean '-Werror=unknown-argument'?
  [-Wunknown-warning-option]

But that just produces the warning above.

With

clang -Werror main.c

The warning does become an error, but I am trying to make only this specific warning an error.

How do I find the name of this compiler warning so I can promote it to a compiler error?

Thanks.


Solution

  • I checked the current sources in Subversion and found this: test/Misc/warning-flags.c in the Clang sources list warn_call_wrong_number_of_arguments (the internal code for this warning), which means that that it is expected that this warning has no separate -W flag. I'm sure the Clang developers would accept a patch which introduces an explicit name for this option.

    But until that, -Werror is your only option.