Skip to content

Commit

Permalink
Fix MSVC pragma warnings (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
riclarsson authored Oct 22, 2024
2 parents 10cb0b3 + 8eb217b commit 98afa87
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/absorption/zeemandata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@
#include "double_imanip.h"
#include "wigner_functions.h"

#ifndef _MSC_VER
#pragma GCC diagnostic push
#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wdeprecated-copy-with-dtor"
#else
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
#endif

#include <Eigen/Dense>

#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif

bool ZeemanModel::empty() const noexcept {
return std::isnan(mdata.gu) and std::isnan(mdata.gl);
Expand Down Expand Up @@ -429,8 +435,10 @@ AllPolarizationVectors AllPolarization_deta(Numeric theta,
return pv;
}

#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-type"
#endif
const PolarizationVector& SelectPolarization(const AllPolarizationVectors& data,
Polarization type) noexcept {
switch (type) {
Expand All @@ -444,7 +452,9 @@ const PolarizationVector& SelectPolarization(const AllPolarizationVectors& data,
return data.sm; //! This should never be reached
}
}
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif

void sum_propmat(PropmatVectorView pm, const ConstComplexVectorView &abs,
const PolarizationVector &polvec) {
Expand Down
4 changes: 4 additions & 0 deletions src/core/legendre/legendre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ constexpr Numeric longitude_clamp(Numeric lon) {
return lon;
}

#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif

std::pair<Matrix, Matrix> schmidt(const Numeric theta, const Index nmax) {
ARTS_USER_ERROR_IF(
Expand Down Expand Up @@ -123,7 +125,9 @@ Vector3 schmidt_fieldcalc(const Matrix& g,

return B;
}
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif

constexpr Numeric next(Numeric p0, Numeric p1, Numeric ni, Numeric x) {
return ((2.0 * ni + 1.0) * x * p1 - ni * p0) / (ni + 1.0);
Expand Down
8 changes: 8 additions & 0 deletions src/core/lineshapemodel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,10 @@ std::istream& LineShape::from_linemixingdata(std::istream& data,
return data;
}

#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-type"
#endif
void LineShape::LegacyPressureBroadeningData::vector2modelpb(
LineShapeTypeOld& mtype,
bool& self,
Expand Down Expand Up @@ -464,7 +466,9 @@ void LineShape::LegacyPressureBroadeningData::vector2modelpb(
}
}
}
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif

LineShape::Model LineShape::LegacyLineMixingData::vector2modellm(
Vector x, LineShape::LegacyLineMixingData::TypeLM type) {
Expand Down Expand Up @@ -775,8 +779,10 @@ ArrayOfString ModelMetaDataArray(const LineShape::Model&,
return as;
}

#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-type"
#endif
Numeric& SingleModelParameter(ModelParameters& mp, const String& type) {
if (type == "X0") return mp.X0;
if (type == "X1") return mp.X1;
Expand All @@ -788,7 +794,9 @@ Numeric& SingleModelParameter(ModelParameters& mp, const String& type) {
"See documentation for accepted types\n",
type)
}
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif

std::ostream& operator<<(std::ostream& os, const ModelParameters& mp) {
os << mp.type << ' ' << mp.X0 << ' ' << mp.X1 << ' ' << mp.X2 << ' ' << mp.X3
Expand Down
6 changes: 6 additions & 0 deletions src/core/matpack/matpack_eigen.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#pragma once

#ifndef _MSC_VER
#pragma GCC diagnostic push
#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wdeprecated-copy-with-dtor"
#else
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
#endif

#include <Eigen/Dense>

#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif

#include "matpack_concepts.h"

Expand Down
6 changes: 6 additions & 0 deletions src/core/minimize.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@

#include <matpack.h>

#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#endif

#include <unsupported/Eigen/NonLinearOptimization>

#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif

namespace Minimize {
//! Functor for minimizing X0 + X1 * X + X2 * X**2 + ... XN * X**N - Y
Expand Down
4 changes: 4 additions & 0 deletions src/core/operators/operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

#include "debug.h"

#ifndef _MSC_VER
#if defined(__clang__)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-template-friend"
#endif
#endif

template <typename R, typename... Args>
struct CustomOperator {
Expand All @@ -28,10 +30,12 @@ struct CustomOperator {
}
};

#ifndef _MSC_VER
#if defined(__clang__)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#endif

using NumericUnaryOperator = CustomOperator<Numeric, Numeric>;
using NumericBinaryOperator = CustomOperator<Numeric, Numeric, Numeric>;
Expand Down
2 changes: 2 additions & 0 deletions src/m_oem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
#include "debug.h"
#include "jacobian.h"

#ifndef _MSC_VER
#pragma GCC diagnostic ignored "-Wconversion"
#endif

#ifdef OEM_SUPPORT
#include "oem.h"
Expand Down

0 comments on commit 98afa87

Please sign in to comment.