xentara-utils v2.0.4
The Xentara Utility Library
Loading...
Searching...
No Matches
Diagnosic Macros

Macros

#define XENTARA_WARNING
 Decorated a #pragma message message so that it looks like a compiler warning.
 

Detailed Description

Macro Definition Documentation

◆ XENTARA_WARNING

#define XENTARA_WARNING

Decorated a #pragma message message so that it looks like a compiler warning.

This macro allows you to add a prefix to a #pragma message directive to make it look more like a regular compiler warning. The macro adds file name and line number on compilers like the Microsoft Visual C++ compiler (MSVC), that normally do not output file names and line numers for #pragma message messages. It also adds the string “warning” to the message for compilers that don’t do that themselves.

To output a warning message, use the macro as follows:

#pragma message(XENTARA_WARNING "please don't do that, it hurts my feelings")

This will output the following messages:

MSVC:

VeryRudeFile.hpp(123): warning : please don't do that, it hurts my feelings

Clang:

VeryRudeFile.hpp:123:9: warning : please don't do that, it hurts my feelings [-W#pragma-messages]

GCC:

VeryRudeFile.hpp:123:77: note: ‘#pragma message: warning: please don't do that, it hurts my feelings’