title: How to verify external symbols in an .h file to the .c file?
body: <p>In <code>C</code> it is an idiomatic pattern to have your <code>.h</code> file contain declarations of the externally visible symbols in the corresponding <code>.c</code> file. The purpose if this is to support a kind of "module &amp; interface" thinking, e.g enabling a cleaner structure.</p>
  
  <p>In a big legacy C system I'm working on it is not uncommon that functions are declared in the wrong header files probably after moving a function to another module, since it still compiles, links and runs, but that makes the modules less explicit in their interfaces and indicates wrong dependencies.</p>
  
  <p>Is there a way to verify / confirm / guarantee that the <code>.h</code> file has all the external symbols from <code>.c</code> and no external symbols that are not there?</p>
  
  <p>E.g. if I have the following files</p>
  
  <p><strong>module.c</strong></p>
  
  <pre><code>int func1(void) {}
  bool func2(int c) {}
  static int func3(void) {}
  </code></pre>
  
  <p><strong>module.h</strong></p>
  
  <pre><code>extern int func1(void);
  extern bool func4(char *v);
  </code></pre>
  
  <p>I want to be pointed to the fact that <code>func4</code> is not an external visible symbol in <code>module.c</code> and that <code>func2</code> is missing.</p>
  
  <p>Modern compilers give some assistance in as so much that they can detect a missing declaration that you actually referenced, but it does not care from which file it comes.</p>
  
  <p>What are my options, other than going over each pair manually, to obtain this information?</p>