[Bug c++/66234] New: Too much output from pragma message with g++ 4.8 and above

simon at newtec dot dk gcc-bugzilla@gcc.gnu.org
Thu May 21 08:44:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66234

            Bug ID: 66234
           Summary: Too much output from pragma message with g++ 4.8 and
                    above
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at newtec dot dk
  Target Milestone: ---

Created attachment 35584
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35584&action=edit
Quick test, just compile with g++ <filename>

I'm using pragma message to output a couple of messages during compilation, but
after a toolchain upgrade (from OSELAS-2012 to 2014, and thus from gcc-4.7.2 to
gcc-4.9.2 - but I've also recreated this on my host with gcc-4.6.4 which is
working fine, and gcc-4.8.3 which exhibits the problem), a lot of extra output
is shown.

A quick test is attached.

Compiling with 4.7.2 / 4.6.4 gives the file location and:

note: #pragma message: Setting builddate to: ("May 21 2015" " " "10:33:13")

 - which is just what I want.

Compiling with 4.9.2 / 4.8.3 gives (file locations removed):

note: #pragma message: Setting builddate to: ("May 21 2015" " " "10:34:51")
 #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)
                                          ^
The output that I want is still there, but together with a lot of extra
clutter.

I can hide the extra output with -ftrack-macro-expansion=0 and
-fno-diagnostics-show-caret, but I suspect that that may also in some cases
hide compilation messages that I *do* want to see.

As I see it, pragma message should (by default) just output the desired message
and nothing else - or is it just that I'm using it the wrong way?

A related post on stackoverflow can be found here:
http://stackoverflow.com/questions/30255294/how-to-hide-extra-output-from-pragma-message



More information about the Gcc-bugs mailing list