title: Included files from standard directories can silently replace existing macros?
body: <p>Create the file <code>/usr/local/include/define_x.h</code> with the single line:</p>
  
  <pre><code>#define X "/usr/local/include"
  </code></pre>
  
  <p>The following program <code>foo.cpp</code> compiles and runs fine with no warnings:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  #define X "local"
  #include &lt;define_x.h&gt;
  
  int main()
  {
    std::cout &lt;&lt; "X = " &lt;&lt; X &lt;&lt; std::endl;
    return 0;
  }
  </code></pre>
  
  <p>Output: <code>X = /usr/local/include</code></p>
  
  <p>Now swap lines 3 and 4:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  #include &lt;define_x.h&gt;
  #define X "local"
  
  int main()
  {
    std::cout &lt;&lt; "X = " &lt;&lt; X &lt;&lt; std::endl;
    return 0;
  }
  </code></pre>
  
  <p>Now the output is <code>X = local</code> as expected, but now there is a compiler warning:</p>
  
  <pre><code>foo.cpp:4: warning: "X" redefined
   #define X "local"
  
  In file included from foo.cpp:3:
  /usr/local/include/define_x.h:1: note: this is the location of the previous definition
   #define X "/usr/local/include"
  </code></pre>
  
  <h3>Question: Why is there is no warning in the first version?</h3>
  
  <p>Both were compiled with gcc 8.2.1: <code>g++ foo.cpp</code>.</p>
  
  <p>It seems it has something to do with placing files in the standard /usr/include or /usr/local/include directories, as placing them either in the current directory or another found via <code>-I</code> doesn't produce this effect.</p>