[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master fb7c030b 10/24: Work around clang '-Wno-unrea
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master fb7c030b 10/24: Work around clang '-Wno-unreachable-code-return' |
Date: |
Fri, 8 Jul 2022 07:11:26 -0400 (EDT) |
branch: master
commit fb7c030babab1edf204d7130c72187f64df078b0
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Work around clang '-Wno-unreachable-code-return'
Commenting the alternative code out with "#if 0 ... #endif" is
undesirable because it would promote software rot.
The clang maintainers have discussed tricks like
if((true))
where the extra parentheses prevent the warning. This revision does
much the same thing, but in a standard way.
---
gpt_server.cpp | 5 +++++
stratified_charges.cpp | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/gpt_server.cpp b/gpt_server.cpp
index c19941af..f25b3383 100644
--- a/gpt_server.cpp
+++ b/gpt_server.cpp
@@ -77,7 +77,12 @@ gpt_state test_one_days_gpt_transactions
s["X5_gsp_b"] = value_cast<std::string>(o.GuidelineSinglePremiumPolicyB);
s["X6_glp_c"] = value_cast<std::string>(o.GuidelineLevelPremiumPolicyC );
s["X7_gsp_c"] = value_cast<std::string>(o.GuidelineSinglePremiumPolicyC);
+ // Return here, but retain alternative below.
+volatile bool avoid_warning {true};
+if(avoid_warning)
+ {
return s;
+ }
bool Use7702ATables =
exact_cast<mce_yes_or_no >(input["Use7702ATables"
])->value();
// int IssueAge =
exact_cast<tnr_age >(input["IssueAge"
])->value();
diff --git a/stratified_charges.cpp b/stratified_charges.cpp
index aa83447e..8c86ed60 100644
--- a/stratified_charges.cpp
+++ b/stratified_charges.cpp
@@ -418,7 +418,12 @@ double
stratified_charges::minimum_tiered_sepacct_load_for_7702() const
{
stratified_entity const& z = datum("CurrSepAcctLoadTieredByAssets");
LMI_ASSERT(!z.values().empty());
+ // Return here, but retain alternative below.
+volatile bool avoid_warning {true};
+if(avoid_warning)
+ {
return *std::min_element(z.values().begin(), z.values().end());
+ }
stratified_entity const& z0 = datum("CurrSepAcctLoadBandedByAssets");
stratified_entity const& z1 = datum("CurrSepAcctLoadBandedByPrem");
- [lmi-commits] [lmi] master updated (be3de4b0 -> f8fac8dd), Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 55cc6938 01/24: Establish an initial blacklist of clang warnings, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 10a2b305 06/24: Remediate unreachable 'return' statements, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 8c4089d6 02/24: Label a section for target-specific warnings, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 5de37ebf 07/24: Don't avoid a diagnostic that no longer arises, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 7524301d 08/24: Improve concinnity, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master fb7c030b 10/24: Work around clang '-Wno-unreachable-code-return',
Greg Chicares <=
- [lmi-commits] [lmi] master a5e06004 14/24: Enable another clang warning, except for cgicc, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master c21d8849 12/24: Explain why certain clang warnings will remain disabled, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master e5eeed14 20/24: Explain why two more clang warnings are disabled, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master f8fac8dd 24/24: Explain why several more clang warnings are disabled, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 06f81a9c 05/24: Refine warning pragmata, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 32145870 03/24: Correct an inconsistency in a comment, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master 5334fa49 04/24: Prefer 'nullptr' to '0', Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master e7ef946d 11/24: Disable a warning only for cgicc, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master e97c7ec6 17/24: Enable another clang warning, with one pragmatic exception, Greg Chicares, 2022/07/08
- [lmi-commits] [lmi] master b5cee829 18/24: Explain why '-Wpadded' is disabled for clang, Greg Chicares, 2022/07/08