title: How to hide extra output from #pragma message
body: <p><strong>Current status</strong></p>
  
  <p>Bug filed in gcc bugtracker (includes simple testcase): <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66234" rel="noreferrer">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66234</a></p>
  
  <hr>
  
  <p>I'm currently porting some code to a new platform and toolchain, which includes an upgrade from gcc 4.7.2 to gcc 4.9.2 (or more specifically, from release 2012 to 2014 of the <a href="http://www.pengutronix.de/oselas/toolchain/index_en.html" rel="noreferrer">OSELAS toolchains</a> - I've also reproduced the behavior on my host machine with gcc 4.6.4 (works) and gcc 4.8.3 (does not work)).</p>
  
  <p>During the build of the application I use some <code>#pragma message</code> statements to output the builddate and hostname (note that <code>BUILDTAG</code> and <code>BUILDHOST</code> are also stored as constants to be used by the application afterwards):</p>
  
  <pre><code>#define BUILDTAG (__DATE__  " "  __TIME__)
  #define BUILDHOST BUILT_ON
  
  #define STR_HELPER(x) #x
  #define STR(x) STR_HELPER(x)
  
  #pragma message "Setting builddate to: " STR(BUILDTAG)
  #pragma message "Building on: " STR(BUILDHOST)
  </code></pre>
  
  <p>The old toolchains (gcc 4.7.2 / 4.6.4) output the following, which is exactly what I want:</p>
  
  <pre><code>note: #pragma message: Setting builddate to: ("May 15 2015" " " 10:35:12")
  note: #pragma message: Building on: my-host
  </code></pre>
  
  <p>However, the new toolchains (gcc 4.9.2 / 4.8.3) gives me:</p>
  
  <pre><code>note: #pragma message: Setting builddate to: ("May 15 2015" " " "10:39:35")
  #pragma message "Setting builddate to: " STR(BUILDTAG)
  ^
  note: in definition of macro 'STR_HELPER'
  #define STR_HELPER(x) #x
                         ^
  note: in expansion of macro 'STR'
  #pragma message "Setting builddate to: " STR(BUILDTAG)
                                           ^
  note: #pragma message: Building on: my-host
  #pragma message "Building on: " STR(BUILDHOST)
                                               ^
  note: in definition of macro 'STR_HELPER'
  #define STR_HELPER(x) #x
                         ^
  note: in expansion of macro 'STR'
  #pragma message "Building on: " STR(BUILDHOST)
                                  ^
  </code></pre>
  
  <p>(Note that I've removed the file path/location from the output in both listings.)</p>
  
  <p>Sure, the output that I want is there, but there's just a whole lot of extra stuff also. Is there anyway to hide the additional <code>in definition of macro</code> / <code>in expansion of macro</code> / etc. messages while keeping the desired output?</p>
  
  <p>Or am I just doing this the wrong way, and is there a better method to print out the messages?</p>