Skip to content

Commit

Permalink
Merge pull request cyclus#1811 from bennibbelink/compiler-warnings
Browse files Browse the repository at this point in the history
Resolve various compiler warnings
  • Loading branch information
gonuke authored Sep 25, 2024
2 parents bde9307 + 7b9bf6f commit cd00e5d
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 29 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ Since last release
**Removed:**

* Removed the ResourceBuff class and replaced its instances with ResBuf (#1755)
* Removed reference to deprecated ``ProgTranslator::Context`` class (#1811)

**Fixed:**

* Removed unnecessary records being added to the Resource database by packaging process (#1761)
* Removed GTest source code from code coverage reports (#1759)
* Updated action versions to avoid node.js deprecation (#1802)
* Removed the module imports in `cyclus/__init__.py` and removed the need for multi-phase initialization of Cython modules (#1809)
* No longer use deprecated Numpy Cython api when Cython>=3 (#1811)
* ResTracker Extract gave the wrong parent_id to one of the child resources (#1806)


Expand Down
3 changes: 3 additions & 0 deletions cyclus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ foreach(file ${CYCLUS_CYTHON_FILES})
set_target_properties(${targ} PROPERTIES LINKER_LANGUAGE CXX
OUTPUT_NAME ${name}
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
if (CYTHON_VERSION_MAJOR GREATER_EQUAL 3)
target_compile_definitions(${targ} PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
endif()
# the following install is needed so that CMake sets the correct RPATH for the
# python extension modules, even though they are installed (with the wrong RPATH)
# by setup.py, along with the pure python files.
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,15 @@ if(Cython_FOUND)

ADD_LIBRARY(${name} ${_cc_file})
SET(CythonModuleSrc ${CythonModuleSrc} ${_cc_file})
SET_TARGET_PROPERTIES(${name} PROPERTIES
SET_TARGET_PROPERTIES(${name} PROPERTIES
OUTPUT_NAME "${name}"
PREFIX ""
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib"
)
IF (CYTHON_VERSION_MAJOR GREATER_EQUAL 3)
TARGET_COMPILE_DEFINITIONS(${name} PRIVATE NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
ENDIF()

TARGET_LINK_LIBRARIES(${name} dl ${NoCythonLibs})

Expand Down
6 changes: 6 additions & 0 deletions src/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,14 @@ class Context {
}

Agent* m = protos_[proto_name];
if (m == NULL) {
throw KeyError("Null prototype for " + proto_name);
}
T* casted(NULL);
Agent* clone = m->Clone();
if (clone == NULL) {
throw StateError("Clone operation failed for " + proto_name);
}
casted = dynamic_cast<T*>(clone);
if (casted == NULL) {
PyDelAgent(clone->id());
Expand Down
8 changes: 4 additions & 4 deletions src/infile_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace cyclus {

#if LIBXMLXX_MAJOR_VERSION == 2
#if LIBXMLXX_MAJOR_VERSION == 2
typedef xmlpp::NodeSet NodeSet;
typedef xmlpp::Node::NodeList const_NodeList;
#else
Expand Down Expand Up @@ -76,7 +76,7 @@ std::string InfileTree::GetString(std::string query, int index) {
dynamic_cast<const Element*>(nodeset.at(index));

if (!element) {
throw CastError("Node: " + element->get_name() +
throw CastError("Node: " + nodeset.at(index)->get_name() +
" is not an Element node.");
}

Expand All @@ -90,7 +90,7 @@ std::string InfileTree::GetString(std::string query, int index) {
dynamic_cast<const xmlpp::TextNode*>(element->get_children().front());

if (!text) {
throw CastError("Node: " + text->get_name() + " is not a Text node.");
throw CastError("Node: " + element->get_name() + " is not a Text node.");
}

return text->get_content();
Expand Down Expand Up @@ -129,7 +129,7 @@ InfileTree* InfileTree::GetEngineFromQuery(std::string query, int index) {
xmlpp::Element* element = dynamic_cast<xmlpp::Element*>(nodeset.at(index));

if (!element) {
throw CastError("Node: " + element->get_name() +
throw CastError("Node: " + nodeset.at(index)->get_name() +
" is not an Element node.");
}

Expand Down
1 change: 1 addition & 0 deletions src/package.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ int TransportUnit::MaxShippablePackages(int pkgs) {
}
return shippable;
}
return 0;
}

TransportUnit::TransportUnit(std::string name, int fill_min, int fill_max, std::string strategy) :
Expand Down
10 changes: 0 additions & 10 deletions src/prog_translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,5 @@ void ProgTranslator::FromProg() {
}
}

ProgTranslator::Context::Context() {
throw DepricationError("Class ProgTranslator::Context is now deprecated "
"in favor of ProgTranslatorContext.");
}

ProgTranslator::Context::~Context() {
throw DepricationError("Class ProgTranslator::Context is now deprecated "
"in favor of ProgTranslatorContext.");
}


} // namespace cyclus
2 changes: 0 additions & 2 deletions src/toolkit/building_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include "prog_translator.h"
#include "CoinPackedVector.hpp"

// Headers in this file below this pragma have all warnings shushed.
#pragma GCC system_header
#include "OsiCbcSolverInterface.hpp"

namespace cyclus {
Expand Down
10 changes: 5 additions & 5 deletions src/toolkit/matl_sell_policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ std::set<BidPortfolio<Material>::Ptr> MatlSellPolicy::GetMatlBids(
// overflow to negative int limit
std::string s;
if (manager() != NULL)
s + " Agent: "
s += " Agent: "
+ Trader::manager()->prototype() + "-"
+ std::to_string(Trader::manager()->id()) + ". ";
s + "This is likely due to too much material (did you forget a "
+ "throughput?) or small package limits relative to the "
+ "quantity available. qty: " + std::to_string(qty)
+ ", and each bid would be: " + std::to_string(bid_qty);
s += "This is likely due to too much material (did you forget a ";
s += "throughput?) or small package limits relative to the ";
s += "quantity available. qty: " + std::to_string(qty);
s += ", and each bid would be: " + std::to_string(bid_qty);
Package::ExceedsSplitLimits(n_full_bids, s);

bids.assign(n_full_bids, bid_qty);
Expand Down
5 changes: 4 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ SET(GENERATED_TEST_LIST "" CACHE INTERNAL "")
SET(GENERATED_FILTER_LIST "" CACHE INTERNAL "")
SET(GENERATED_TEST_SOURCE_LIST "" CACHE INTERNAL "")

include(FetchContent)
INCLUDE(FetchContent)
IF (CMAKE_VERSION GREATER_EQUAL 3.24)
CMAKE_POLICY(SET CMP0135 NEW)
ENDIF()
FetchContent_Declare(
googletest
BUILD_GMOCK FALSE # do not build googlemock subproject
Expand Down
6 changes: 0 additions & 6 deletions tests/prog_translator_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,5 @@ TEST(ProgTranslatorTests, translation) {
delete iface;
}

TEST(ProgTranslatorTests, depricated) {

// confirm depricated error is thrown
ASSERT_THROW(new ProgTranslator::Context(), DepricationError);
}


} // namespace cyclus

0 comments on commit cd00e5d

Please sign in to comment.