title: Compiler warning for function defined without prototype in scope?
body: <p>[Question inspired by a comment thread at <a href="https://stackoverflow.com/questions/50399128/functions-in-c-headers/50399252#50399252">this answer</a>.]</p>
  
  <p>As everyone knows, since C99 it's an error to call a function that hasn't been declared, preferably with a proper prototype.</p>
  
  <p>But, going beyond that, I want my compiler to warn me if I <em>define</em> a function without a prototype declaration in scope, presumably included out of the same header file that the callers are using.  (Unless the function is static, in which case all of this is moot.)</p>
  
  <p>The reason should be obvious: If there's a prototype declaration in a header, and it's included by all the callers, but it's not included in the file where the function is defined, and if the function's actual definition somehow differs from the external prototype, then all the prototype checking done on behalf the callers is worthless, and in fact counterproductively wrong.  There's a glaring error, but it's not guaranteed to be caught at all.</p>
  
  <p>Are there common compilers which can check this?  I tried both gcc and clang with -Wall, and they don't.  (I would imagine Gimpel lint -- if it's still around -- would do this, but I don't have a copy.)</p>
  
  <p>Ideally, I'd like it to also insist that the prototype exist in a separate header file, but that's different kettle of fish, so I don't insist on it.  (The reason for this additional stipulation would be that some programmers, harried by the hypothetical warning message, might try to silence it by typing in an external prototype at the top of the <code>.c</code> file containing the definition, which, again, would defeat the purpose.)</p>