Disable unknown pragma warnings and adapt to it

This commit is contained in:
Alexander Bock
2022-07-05 14:27:40 +02:00
parent bcdfd662c5
commit 0b62d5cc4b
9 changed files with 10 additions and 40 deletions

View File

@@ -30,17 +30,13 @@
#pragma warning (disable : 4706) // assignment within conditional expression
#endif // WIN32
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#endif // __GNUC__
#include <json/json.hpp>
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif // __GNUC__
#ifdef WIN32
#pragma warning (pop)

View File

@@ -36,22 +36,17 @@
#include <vector>
#include <set>
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include "SpiceUsr.h"
#include "SpiceZpr.h"
#ifdef __clang__
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
namespace openspace {

View File

@@ -25,26 +25,17 @@
#ifndef __OPENSPACE_MODULE_TOUCH___TUIO_EAR___H__
#define __OPENSPACE_MODULE_TOUCH___TUIO_EAR___H__
// -Wold-style-cast
#if (defined(__GNUC__) && !defined(__clang__))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif // defined(__GNUC__) && !defined(__clang__)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#endif // __clang__
#include <modules/touch/ext/libTUIO11/TUIO/TuioListener.h>
#include <modules/touch/ext/libTUIO11/TUIO/TuioClient.h>
#if (defined(__GNUC__) && !defined(__clang__))
#pragma GCC diagnostic pop
#endif // defined(__GNUC__) && !defined(__clang__)
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
#include <openspace/util/touch.h>
#include <ghoul/glm.h>

View File

@@ -1026,13 +1026,11 @@ void SpiceManager::findCkCoverage(const std::string& path) {
constexpr unsigned int MaxObj = 1024;
constexpr unsigned int WinSiz = 16384;
#if defined __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
SPICEINT_CELL(ids, MaxObj);
SPICEDOUBLE_CELL(cover, WinSiz);
@@ -1045,11 +1043,8 @@ void SpiceManager::findCkCoverage(const std::string& path) {
for (SpiceInt i = 0; i < card_c(&ids); ++i) {
const SpiceInt frame = SPICE_CELL_ELEM_I(&ids, i); // NOLINT
#if defined __clang__
#pragma clang diagnostic pop
#elif defined __GNUC__
#pragma GCC diagnostic pop
#endif
scard_c(0, &cover);
ckcov_c(path.c_str(), frame, SPICEFALSE, "SEGMENT", 0.0, "TDB", &cover);
@@ -1085,13 +1080,11 @@ void SpiceManager::findSpkCoverage(const std::string& path) {
constexpr unsigned int MaxObj = 1024;
constexpr unsigned int WinSiz = 16384;
#if defined __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
SPICEINT_CELL(ids, MaxObj);
SPICEDOUBLE_CELL(cover, WinSiz);
@@ -1104,11 +1097,8 @@ void SpiceManager::findSpkCoverage(const std::string& path) {
for (SpiceInt i = 0; i < card_c(&ids); ++i) {
const SpiceInt obj = SPICE_CELL_ELEM_I(&ids, i); // NOLINT
#if defined __clang__
#pragma clang diagnostic pop
#elif defined __GNUC__
#pragma GCC diagnostic pop
#endif
scard_c(0, &cover);
spkcov_c(path.c_str(), obj, &cover);

View File

@@ -28,6 +28,7 @@ function (set_openspace_compile_settings target)
set(MSVC_WARNINGS
"/MP" # Multi-threading support
"/W4" # Highest warning level
"/wd4068" # unknown pragma
"/wd4127" # conditional expression is constant [raised by: websocketpp]
"/wd4201" # nonstandard extension used : nameless struct/union [raised by: GLM]
"/wd5030" # attribute 'attribute' is not recognized [raised by: codegen]
@@ -145,6 +146,7 @@ function (set_openspace_compile_settings target)
"-Wno-attributes"
"-Wno-missing-braces"
"-Wno-unknown-attributes"
"-Wno-unknown-pragmas"
)
if (OPENSPACE_WARNINGS_AS_ERRORS)
set(CLANG_WARNINGS ${CLANG_WARNINGS} "-Werror")
@@ -183,6 +185,7 @@ function (set_openspace_compile_settings target)
"-Wno-float-equal"
"-Wno-long-long"
"-Wno-unknown-attributes"
"-Wno-unknown-pragmas"
"-Wno-write-strings"
)
if (OPENSPACE_WARNINGS_AS_ERRORS)

View File

@@ -433,22 +433,17 @@ TEST_CASE("SpiceManager: Get Position Transform Matrix", "[spicemanager]") {
}
}
#if defined __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast"
#elif defined __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
// transform reference position into new frame
mxvg_c(referenceMatrix, state, 3, 3, state_t);
#if defined __clang__
#pragma clang diagnostic pop
#elif defined __GNUC__
#pragma GCC diagnostic pop
#endif
position = positionMatrix * position;
// check transformed values match