Skip to content

Commit

Permalink
Partially revert 1c7521a7910: swig chokes on the macro
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Sep 1, 2022
1 parent 1c7521a commit 019c0b5
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 51 deletions.
15 changes: 12 additions & 3 deletions src/energyplus/ForwardTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2919,14 +2919,23 @@ namespace energyplus {
break;
}

DISABLE_WARNING_PUSH
DISABLE_WARNING_DEPRECATED
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
#elif (defined(__GNUC__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
case openstudio::IddObjectType::OS_Table_MultiVariableLookup: {
model::TableMultiVariableLookup table = modelObject.cast<TableMultiVariableLookup>();
retVal = translateTableMultiVariableLookup(table);
break;
}
DISABLE_WARNING_POP
#if defined(_MSC_VER)
# pragma warning(pop)
#elif (defined(__GNUC__))
# pragma GCC diagnostic pop
#endif

case openstudio::IddObjectType::OS_Table_Lookup: {
auto table = modelObject.cast<TableLookup>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ namespace openstudio {

namespace energyplus {

DISABLE_WARNING_PUSH
DISABLE_WARNING_DEPRECATED
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
#elif (defined(__GNUC__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

boost::optional<IdfObject> ForwardTranslator::translateTableMultiVariableLookup(TableMultiVariableLookup& modelObject) {
OptionalString s;
Expand Down Expand Up @@ -189,7 +194,11 @@ namespace energyplus {
return tableLookup;
}

DISABLE_WARNING_POP
#if defined(_MSC_VER)
# pragma warning(pop)
#elif (defined(__GNUC__))
# pragma GCC diagnostic pop
#endif

} // namespace energyplus

Expand Down
35 changes: 24 additions & 11 deletions src/model/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

#include "../utilities/core/Assert.hpp"
#include "../utilities/core/PathHelpers.hpp"
#include "../utilities/core/Deprecated.hpp"

#include "../utilities/idd/IddEnums.hpp"
#include "../utilities/idd/IddObject_Impl.hpp"
Expand Down Expand Up @@ -4260,12 +4259,19 @@ namespace model {
REGISTER_CONSTRUCTOR(SurfacePropertyOtherSideConditionsModel);
REGISTER_CONSTRUCTOR(SurfacePropertySurroundingSurfaces);
REGISTER_CONSTRUCTOR(SwimmingPoolIndoor);

DISABLE_WARNING_PUSH
DISABLE_WARNING_DEPRECATED
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
#elif (defined(__GNUC__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
REGISTER_CONSTRUCTOR(TableMultiVariableLookup);
DISABLE_WARNING_POP

#if defined(_MSC_VER)
# pragma warning(pop)
#elif (defined(__GNUC__))
# pragma GCC diagnostic pop
#endif
REGISTER_CONSTRUCTOR(TableLookup);
REGISTER_CONSTRUCTOR(TableIndependentVariable);
REGISTER_CONSTRUCTOR(TemperingValve);
Expand Down Expand Up @@ -4806,12 +4812,19 @@ namespace model {
REGISTER_COPYCONSTRUCTORS(SurfacePropertyOtherSideConditionsModel);
REGISTER_COPYCONSTRUCTORS(SurfacePropertySurroundingSurfaces);
REGISTER_COPYCONSTRUCTORS(SwimmingPoolIndoor);

DISABLE_WARNING_PUSH
DISABLE_WARNING_DEPRECATED
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
#elif (defined(__GNUC__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
REGISTER_COPYCONSTRUCTORS(TableMultiVariableLookup);
DISABLE_WARNING_POP

#if defined(_MSC_VER)
# pragma warning(pop)
#elif (defined(__GNUC__))
# pragma GCC diagnostic pop
#endif
REGISTER_COPYCONSTRUCTORS(TableLookup);
REGISTER_COPYCONSTRUCTORS(TableIndependentVariable);
REGISTER_COPYCONSTRUCTORS(TemperingValve);
Expand Down
17 changes: 12 additions & 5 deletions src/model/TableMultiVariableLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/

#include "../utilities/core/Deprecated.hpp"

DISABLE_WARNING_PUSH
DISABLE_WARNING_DEPRECATED
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
#elif (defined(__GNUC__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

#include "TableMultiVariableLookup.hpp"
#include "TableMultiVariableLookup_Impl.hpp"
Expand Down Expand Up @@ -1349,4 +1352,8 @@ namespace model {
} // namespace model
} // namespace openstudio

DISABLE_WARNING_POP
#if defined(_MSC_VER)
# pragma warning(pop)
#elif (defined(__GNUC__))
# pragma GCC diagnostic pop
#endif
16 changes: 12 additions & 4 deletions src/model/TableMultiVariableLookup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,13 @@ namespace model {
REGISTER_LOGGER("openstudio.model.TableMultiVariableLookup");
};

DISABLE_WARNING_PUSH
DISABLE_WARNING_DEPRECATED
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
#elif (defined(__GNUC__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

/** \relates TableMultiVariableLookup*/
using OptionalTableMultiVariableLookup = boost::optional<TableMultiVariableLookup>;
Expand All @@ -351,8 +356,11 @@ namespace model {

/** \relates TableMultiVariableLookupPoint*/
using TableMultiVariableLookupPointVector = std::vector<TableMultiVariableLookupPoint>;

DISABLE_WARNING_POP
#if defined(_MSC_VER)
# pragma warning(pop)
#elif (defined(__GNUC__))
# pragma GCC diagnostic pop
#endif

} // namespace model
} // namespace openstudio
Expand Down
17 changes: 12 additions & 5 deletions src/model/test/TableMultiVariableLookup_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@

#include "ModelFixture.hpp"

#include "../../utilities/core/Deprecated.hpp"

DISABLE_WARNING_PUSH
DISABLE_WARNING_DEPRECATED
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4996)
#elif (defined(__GNUC__))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

#include "../TableMultiVariableLookup.hpp"
#include "../TableMultiVariableLookup_Impl.hpp"
Expand Down Expand Up @@ -335,4 +338,8 @@ TEST_F(ModelFixture, TableMultiVariablePointOrder2) {
EXPECT_EQ(324, points[23].y());
}

DISABLE_WARNING_POP
#if defined(_MSC_VER)
# pragma warning(pop)
#elif (defined(__GNUC__))
# pragma GCC diagnostic pop
#endif
20 changes: 0 additions & 20 deletions src/utilities/core/Deprecated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,4 @@
# define OS_DEPRECATED
#endif

// Adapted from: https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/
// clang-format off
#if defined(_MSC_VER)
#define DISABLE_WARNING_PUSH __pragma(warning( push ))
#define DISABLE_WARNING_POP __pragma(warning( pop ))
#define DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber ))

#define DISABLE_WARNING_DEPRECATED DISABLE_WARNING(4996)

#elif defined(__GNUC__) || defined(__clang__)
#define DO_PRAGMA(X) _Pragma(#X)
#define DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
#define DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
#define DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName)

#define DISABLE_WARNING_DEPRECATED DISABLE_WARNING(-Wdeprecated-declarations)

#endif
// clang-format on

#endif // UTILITIES_CORE_DEPRECATED_HPP

0 comments on commit 019c0b5

Please sign in to comment.