Skip to content

Commit

Permalink
Merge pull request #10344 from NREL/GCC13-fixes
Browse files Browse the repository at this point in the history
GCC13 Fixes
  • Loading branch information
Myoldmopar authored Dec 22, 2023
2 parents 8f96c94 + e233def commit dd41e28
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
17 changes: 14 additions & 3 deletions cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O

# COMPILER FLAGS
target_compile_options(project_options INTERFACE -pipe) # Faster compiler processing
target_compile_options(project_warnings INTERFACE -Wpedantic
)# Turn on warnings about constructs/situations that may be non-portable or outside of the standard
target_compile_options(project_warnings INTERFACE -Wall -Wextra) # Turn on warnings
target_compile_options(project_warnings INTERFACE -Wpedantic)
# Turn on warnings about constructs/situations that may be non-portable or outside of the standard
target_compile_options(project_warnings INTERFACE -Wall) # Turn on warnings
target_compile_options(project_warnings INTERFACE -Wextra) # Turn on warnings
target_compile_options(project_warnings INTERFACE -Wno-unknown-pragmas)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0)
target_compile_options(project_warnings INTERFACE -Wno-deprecated-copy)
Expand All @@ -104,6 +105,16 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O
target_compile_options(project_warnings INTERFACE -Wno-unused-but-set-parameter -Wno-unused-but-set-variable)
target_compile_options(project_warnings INTERFACE -Wno-maybe-uninitialized)
target_compile_options(project_warnings INTERFACE -Wno-aggressive-loop-optimizations)
# Sadly, GCC 13.2 is throwing many false positives on dangling references and compile time array-bounds
# https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6b927b1297e66e26e62e722bf15c921dcbbd25b9
# https://trofi.github.io/posts/264-gcc-s-new-Wdangling-reference-warning.html
target_compile_options(project_warnings INTERFACE -Wno-dangling-reference)
# The array-bounds appears to be problematic as well depending on the optimization level chosen
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100430
target_compile_options(project_warnings INTERFACE -Wno-array-bounds)
# depending on the level of overflow check selected, the stringop-overflow can also emit false positives
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow
target_compile_options(project_warnings INTERFACE -Wno-stringop-overflow)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
# Suppress unused-but-set warnings until more serious ones are addressed
Expand Down
18 changes: 9 additions & 9 deletions src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ namespace HysteresisPhaseChange {
phaseChangeState = PhaseChangeStates::FREEZING;
this->enthNew =
this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh);
} else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM) {
} else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD));
} else if (this->enthNew < this->enthalpyF && updatedTempTDT > phaseChangeTempReverse) {
} else if ((this->enthNew < this->enthalpyF) && (updatedTempTDT > phaseChangeTempReverse)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
} else if (this->enthNew <= this->enthalpyM && updatedTempTDT <= phaseChangeTempReverse) {
} else if ((this->enthNew <= this->enthalpyM) && (updatedTempTDT <= phaseChangeTempReverse)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
Expand All @@ -191,11 +191,11 @@ namespace HysteresisPhaseChange {
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD));
this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh);
this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh);
if (updatedTempTDT < phaseChangeTempReverse && this->enthNew > this->enthalpyF) {
if ((updatedTempTDT < phaseChangeTempReverse) && (this->enthNew > this->enthalpyF)) {
phaseChangeState = PhaseChangeStates::FREEZING;
this->enthNew =
this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh);
} else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM &&
} else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM) &&
(updatedTempTDT < prevTempTD || updatedTempTDT > prevTempTD)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
Expand All @@ -211,7 +211,7 @@ namespace HysteresisPhaseChange {
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh);
this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh);
if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM) {
if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
Expand All @@ -223,14 +223,14 @@ namespace HysteresisPhaseChange {
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD));
this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh);
this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh);
if (this->enthNew < this->enthOld && updatedTempTDT < prevTempTD) {
if ((this->enthNew < this->enthOld) && (updatedTempTDT < prevTempTD)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD));
} else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM && updatedTempTDT < prevTempTD) {
} else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM) && (updatedTempTDT < prevTempTD)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
} else if (this->enthNew >= this->enthalpyF && updatedTempTDT <= phaseChangeTempReverse) {
} else if ((this->enthNew >= this->enthalpyF) && (updatedTempTDT <= phaseChangeTempReverse)) {
phaseChangeState = PhaseChangeStates::TRANSITION;
this->enthNew =
(this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse));
Expand Down
4 changes: 2 additions & 2 deletions third_party/ssc/shared/lib_battery_lifetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct lifetime_state {

lifetime_state(const std::shared_ptr<cycle_state>& cyc, const std::shared_ptr<calendar_state>& cal);

lifetime_state(const std::shared_ptr<lifetime_nmc_state>& nmc);
explicit lifetime_state(const std::shared_ptr<lifetime_nmc_state>& nmc);

lifetime_state &operator=(const lifetime_state &rhs);

Expand All @@ -81,7 +81,7 @@ class lifetime_t {

lifetime_t(const lifetime_t &rhs);

virtual lifetime_t &operator=(const lifetime_t &rhs);
lifetime_t &operator=(const lifetime_t &rhs);

virtual lifetime_t *clone() = 0;

Expand Down

13 comments on commit dd41e28

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-MacOS-10.17-clang-14.0.0: OK (2760 of 2760 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2781 of 2781 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2759 of 2759 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1972 of 1972 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (790 of 790 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afn-network-validation (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3587 of 3587 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afn-network-validation (jasondegraw) - Win64-Windows-10-VisualStudio-16: OK (2759 of 2759 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afn-network-validation (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1972 of 1972 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update-license-year-2024 (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2759 of 2759 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update-license-year-2024 (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3587 of 3587 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afn-network-validation (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (790 of 790 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update-license-year-2024 (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1972 of 1972 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update-license-year-2024 (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (790 of 790 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.