hlrs-vis / covise

Collaborative Visualization and Simulation Environment, OpenCOVER and OddLOT
http://www.hlrs.de/covise/
186 stars 88 forks source link

Warnings from 3rdparty headers and -Werror #20

Closed szellmann closed 8 years ago

szellmann commented 8 years ago

I keep getting warnings like the following on Ubuntu 15.04 and 15.10:

In file included from /usr/lib/openmpi/include/mpi.h:253:0,
                 from /home/zellmans/covise/src/OpenCOVER/cover/coVRMSController.h:25,
                 from /home/zellmans/covise/src/OpenCOVER/cover/coVRPluginList.cpp:17:
/usr/lib/openmpi/include/mpi_portable_platform.h:374:34: error: invalid suffix on literal; C++11 requires a space between literal and string macro [-Werror=literal-suffix]
              _STRINGIFY(__GNUC__)"."_STRINGIFY(__GNUC_MINOR__)"."_STRINGIFY(__GNUC_PATCHLEVEL__)
                                  ^
/usr/lib/openmpi/include/mpi_portable_platform.h:374:63: error: invalid suffix on literal; C++11 requires a space between literal and string macro [-Werror=literal-suffix]
              _STRINGIFY(__GNUC__)"."_STRINGIFY(__GNUC_MINOR__)"."_STRINGIFY(__GNUC_PATCHLEVEL__)

I think this has to do with C++11 raw string literals that can optionally be pre- and suffixed with some token for disambiguation.

Unfortunately, with -Werror activated, I need to care about this. It is only clear on second sight that errors like these are actually warnings - I mean, gcc reports *error: invalid suffix on literal", and only appends the warning code as the only means for clarification.

I personally think that treating warnings as errors is only viable for compilation units that don't include 3rdparty headers and would argue that we generally deactivate this GCC option.

uwewoessner commented 8 years ago

Werror is disabled in many places already. It is good practice to take warnings seriously but if Werror creates more trouble than it solves we should disable it by default.Uwe

--Dr.-Ing. Uwe WoessnerHigh Performance Computing Center Stuttgart mobile: +49-173-7028729office: +49-711-6856-5790http://www.hlrs.de/people/woessner/

-------- Ursprüngliche Nachricht -------- Von: Stefan Zellmann notifications@github.com Datum: 07.02.2016 14:22 (GMT+01:00) An: hlrs-vis/covise covise@noreply.github.com Betreff: [covise] Warnings from 3rdparty headers and -Werror (#20)

I keep getting warnings like the following on Ubuntu 15.04 and 15.10:

In file included from /usr/lib/openmpi/include/mpi.h:253:0,
                 from /home/zellmans/covise/src/OpenCOVER/cover/coVRMSController.h:25,
                 from /home/zellmans/covise/src/OpenCOVER/cover/coVRPluginList.cpp:17:
/usr/lib/openmpi/include/mpi_portable_platform.h:374:34: error: invalid suffix on literal; C++11 requires a space between literal and string macro [-Werror=literal-suffix]
              _STRINGIFY(__GNUC__)"."_STRINGIFY(__GNUC_MINOR__)"."_STRINGIFY(__GNUC_PATCHLEVEL__)
                                  ^
/usr/lib/openmpi/include/mpi_portable_platform.h:374:63: error: invalid suffix on literal; C++11 requires a space between literal and string macro [-Werror=literal-suffix]
              _STRINGIFY(__GNUC__)"."_STRINGIFY(__GNUC_MINOR__)"."_STRINGIFY(__GNUC_PATCHLEVEL__)

I think this has to do with C++11 raw string literals that can optionally be pre- and suffixed with some token for disambiguation.

Unfortunately, with -Werror activated, I need to care about this. It is only clear on second sight that errors like these are actually warnings - I mean, gcc reports *error: invalid suffix on literal", and only appends the warning code as the only means for clarification.

I personally think that treating warnings as errors is only viable for compilation units that don't include 3rdparty headers and would argue that we generally deactivate this GCC option.


Reply to this email directly or view it on GitHub: https://github.com/hlrs-vis/covise/issues/20

aumuell commented 8 years ago

I think it's good if code compiles without warnings: this will make you notice the warnings that are introduced by new changes, and occasionally these warnings point to real problems which might be overlooked in the first place.

The policy of defaulting to -Werror in general helps to keep warnings down. Especially as with recent GCCs it's very easy to disable the treatment of warnings as errors selectively, we should stick to this policy.

In this special case adding -Wno-error=literal-suffix to cmake/Using/UseMPI.cmake should help.