Closed martin-ueding closed 7 years ago
We should simply use #pragma message instead of #warning. It should work with Intel C++ as well as GCC.
The problem with #pragma message
on Intel C++ is that no context is emitted. Without the context (as you get with a #warning
), those messages are not very useful. One could put in __LINE__
and __FILE__
, but that would not be as good as the whole include trace.
If one uses an abstracted macro, one could of course tune that for Intel C++ as one desires.
The warnings are now disabled by default, there is a configure
switch to get them back.
QPhiX and also QDP++ use a lot of
#warning
directives to signal which compile time branches were taken. This is handy for debugging compile flags, but it makes working with the actual code harder. There is no point in looking for purple warnings because most of the time they are just messages.Ideally the code would be compiled with
-Wall -Wpedantic
to find dubious pieces that could be improved. With all those explicit#warning
directives the output would be really hard to read.So I though about introducing a
configure
switch and then have conditionally define a macroMESSAGE
. If disabled, those will just be replaced with nothing. Otherwise, it becomes#warning
on Intel C++ and#pragma message
with GCC.