diff options
author | Simon Baldwin <simonb@google.com> | 2008-07-28 11:55:11 +0000 |
---|---|---|
committer | Simon Baldwin <simonb@gcc.gnu.org> | 2008-07-28 11:55:11 +0000 |
commit | 0d48657d7378a4b1cb25ed181bca8020eae520f1 (patch) | |
tree | 33aa42b4f5b37d44f904ae5deec152d79f68e2e8 /gcc/doc | |
parent | 17df49a3e95d79d33e62e33ef83159d1c7d4e4a1 (diff) | |
download | gcc-0d48657d7378a4b1cb25ed181bca8020eae520f1.zip gcc-0d48657d7378a4b1cb25ed181bca8020eae520f1.tar.gz gcc-0d48657d7378a4b1cb25ed181bca8020eae520f1.tar.bz2 |
c-pragma.c (handle_pragma_message): New function.
* c-pragma.c (handle_pragma_message): New function.
(init_pragma): Register handle_pragma_message.
* doc/extend.texi (Diagnostic Pragmas): Added #pragma message
documentation.
* gcc.dg/pragma-message.c: New.
From-SVN: r138206
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 4b1d302..4c82dc6 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -11616,6 +11616,35 @@ strict control over project policies. @end table +GCC also offers a simple mechanism for printing messages during +compilation. + +@table @code +@item #pragma message @var{string} +@cindex pragma, diagnostic + +Prints @var{string} as a compiler message on compilation. The message +is informational only, and is neither a compilation warning nor an error. + +@smallexample +#pragma message "Compiling " __FILE__ "..." +@end smallexample + +@var{string} may be parenthesized, and is printed with location +information. For example, + +@smallexample +#define DO_PRAGMA(x) _Pragma (#x) +#define TODO(x) DO_PRAGMA(message ("TODO - " #x)) + +TODO(Remember to fix this) +@end smallexample + +prints @samp{/tmp/file.c:4: note: #pragma message: +TODO - Remember to fix this}. + +@end table + @node Visibility Pragmas @subsection Visibility Pragmas |