JeffersonLab / qphix

QCD for Intel Xeon Phi and Xeon processors
http://jeffersonlab.github.io/qphix/
Other
13 stars 11 forks source link

Adding a configure switch for all those “#warning”s #43

Closed martin-ueding closed 7 years ago

martin-ueding commented 7 years ago

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 macro MESSAGE. If disabled, those will just be replaced with nothing. Otherwise, it becomes #warning on Intel C++ and #pragma message with GCC.

ddkalamk commented 7 years ago

We should simply use #pragma message instead of #warning. It should work with Intel C++ as well as GCC.

martin-ueding commented 7 years ago

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.

martin-ueding commented 7 years ago

The warnings are now disabled by default, there is a configure switch to get them back.