Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22063

Silence only pragma messages containing a specific string in gcc

$
0
0

I have a special macro for pragma messages that is defined as shown below:

#ifdef IGNORE_MESSAGES
#   define MY_MESSAGE(x) 
#else
#   ifdef KD_UNIX
#       if CHECK_GCC_VERSION(4, 4)
#           define DO_PRAGMA(x) _Pragma (#x)
#           define MY_MESSAGE(x) DO_PRAGMA(message x)
#       else
#           define MY_MESSAGE(x) // _Pragma message unsupported before gcc 4.4
#       endif
#   else
#       define MY_MESSAGE(x) __pragma(message(x))
#   endif
#endif

Then, I use my newly defined macro MY_MESSAGE in another file:

MY_MESSAGE("[CUSTOM_MSG] Generating "__FILE__ "...")

But, depending the environment (in linux) I may want to filter messages that start by the "[CUSTOM_MSG]" so that they don't get displayed.

Is there a way to filter pragma messages depending on the content of the message? In other words, is it possible to silence pragma messages containing a particular string in a particular platform (i.e. "[CUSTOM_MSG]" in linux ?


Viewing all articles
Browse latest Browse all 22063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>