Unmatched number of function call arguments is a mandatory diagnostic that all compilers will and must provide without any special setting. It is mandated by the standard.
C99Standard 6.5.2.2 Function calls:
Constraints
If the expression that denotes the called function has a type that includes a prototype, the number of arguments shall agree with the number of parameters. Each argument shall have a type such that its value may be assigned to an object with the unqualified version of the type of its corresponding parameter.
static void dfs();
Tells the compiler dfs
is a static
function which returns a void
and can take unspecified number of arguments. Further you provide a definition for the function which takes 2 arguments & call the same. As you see there is no breaking of contract. The problem is the declaration of the function is incorrect. If you want to declare a function which takes no arguments you must use:
static void dfs(void);
Once you do that the compiler will provide you a diagnostic.