title: gcc 4.8.4 "pragma GCC diagnostic not applied"
body: <p>Using g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4</p>
  
  <p>In a pre-compiled-header I have the following:</p>
  
  <pre><code>63 #pragma GCC diagnostic push
  64 #pragma GCC diagnostic ignored "-Wunused-variable"
  65 #include &lt;boost/filesystem.hpp&gt;
  66 #pragma GCC diagnostic pop
  </code></pre>
  
  <p>Now when I go to run our build system, I get the following build error:</p>
  
  <pre><code>from &lt;&gt;../../../../Core_Pch.h:65,
      from &lt;command-line&gt;:0:
  &lt;&gt;/../../../../external/include/BoostBase/boost/system/error_code.hpp: At global scope:
  &lt;&gt;/../../../../external/include/BoostBase/boost/system/error_code.hpp:221:36: error: ‘boost::system::posix_category’ defined but not used [-Werror=unused-variable]
       static const error_category &amp;  posix_category = generic_category();
  </code></pre>
  
  <p>There appears to be a possible bug already opened in GCC's <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431" rel="nofollow">bug tracker</a>. However, I am wondering if anyone has this working? The bug eludes to the fact that the behavior of the preprocessor used by the <strong>C</strong> lexer works differently than that used by the C++ lexer.</p>
  
  <hr>
  
  <p>This might be related to something else in our build system. Note that if I create the most simple of examples:</p>
  
  <pre><code>#pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wunused-variable"
  int main(void)                               
  {
    int x;                                     
  
    return 0;
  }
  #pragma GCC diagnostic pop
  </code></pre>
  
  <p>This works as expected if I invoke:</p>
  
  <pre><code>~/Devel/pragma $ gcc -Werror -Wall -pedantic main.c 
  ~/Devel/pragma $ g++ -Werror -Wall -pedantic main.c 
  </code></pre>
  
  <p>Commenting out the ignored line results in:</p>
  
  <pre><code>mhoggan@mhoggan-Precision-T3600 ~/Devel/pragma $ gcc -Werror -Wall -pedantic main.c 
  main.c:2:1: error: C++ style comments are not allowed in ISO C90 [-Werror]
   //#pragma GCC diagnostic ignored "-Wunused-variable"
   ^
  main.c:2:1: error: (this will be reported only once per input file) [-Werror]
  main.c: In function ‘main’:
  main.c:5:7: error: unused variable ‘x’ [-Werror=unused-variable]
     int x;
         ^
  cc1: all warnings being treated as errors
  mhoggan@mhoggan-Precision-T3600 ~/Devel/pragma $ g++ -Werror -Wall -pedantic main.c 
  main.c: In function ‘int main()’:
  main.c:5:7: error: unused variable ‘x’ [-Werror=unused-variable]
     int x;
         ^
  cc1plus: all warnings being treated as errors
  </code></pre>