This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][RFC] Add #pragma message ... to gcc/g++


Mark Mitchell wrote:
...
I understand the compatibility argument, but it seems at odds with how we generally do things. I don't know what consumers (other than humans) there are for this output. However, it's unlikely that this will work correctly in some of the IDEs people use with GCC, including Eclipse. I suspect that Eclipse filters stderr, so stdout will be ignored. And, Emacs parses output looking for messages of a particular form (with filenames and line numbers). So, I'm not sure that full compatibility is best here.


Do you have a use case that requires the original Microsoft/Intel behavior?

It boils down to a requirement for


#pragma message (__FILE__ " is deprecated, including " REPLACEMENT " instead.")
#include REPLACEMENT


in conjunction with gcc's -Werror. #error and #warning do not work well in these circumstances; neither offers macro replacement for __FILE__ or REPLACEMENT, and both raise a compilation error. Workrounds are possible, but ugly and inconvenient.

It doesn't matter for my use case whether the output goes to stderr or to stdout, nor whether there's a location preamble on the printed string. However, my need can be met by a more general purpose #pragma message, so this seemed like a good opportunity to add a feature that other compilers have, and whose absence has on occasions tripped up some gcc users.

 http://lists.apple.com/archives/Xcode-users/2005/Oct/msg00108.html
 http://lists.apple.com/archives/Xcode-users/2006/Apr/msg00649.html
 http://www.gamedev.net/community/forums/topic.asp?topic_id=178873
 http://www.cocoabuilder.com/archive/message/xcode/2006/1/19/3121

As noted earlier, users can readily add leading filenames and line numbers easily to pragma messages if they wish. However, if gcc always adds leading filenames and line numbers itself, users cannot remove them. In all likelihood, the major consumers of this output will be people, not automated tools.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]