lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master ec7be84 7/7: Enable '-Wswitch-enum'; fix the


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ec7be84 7/7: Enable '-Wswitch-enum'; fix the issues it flags
Date: Fri, 22 Mar 2019 05:53:37 -0400 (EDT)

branch: master
commit ec7be842920cc4838b808a213b0bf3bf695adc24
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Enable '-Wswitch-enum'; fix the issues it flags
    
    Incidentally rearranged cases to match enumerator declaration order,
    in one 'switch' statement in 'group_quote_pdf_gen_wx.cpp'.
---
 accountvalue.cpp           | 12 ++++++++++++
 getopt.cpp                 |  5 +++++
 group_quote_pdf_gen_wx.cpp |  5 +++++
 input_sequence_parser.cpp  | 41 ++++++++++++++++++++++++++++++++++++++++-
 round_to.hpp               |  1 +
 solve.cpp                  |  4 ++++
 workhorse.make             | 14 +++++++++-----
 7 files changed, 76 insertions(+), 6 deletions(-)

diff --git a/accountvalue.cpp b/accountvalue.cpp
index f39be03..1c729fe 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -471,6 +471,9 @@ void AccountValue::PerformSpecAmtStrategy()
             SA = InvariantValues().SpecAmt[0];
             }
             break;
+        case mce_sa_gsp:      // fall through
+        case mce_sa_corridor: // fall through
+        case mce_sa_salary:   // fall through
         default:
             {
             alarum()
@@ -534,6 +537,8 @@ void AccountValue::TxOptionChange()
             // An alternative is to lapse the policy.
             }
             break;
+        case mce_rop: // fall through
+        case mce_mdb: // fall through
         default:
             {
             alarum() << "Case " << YearsDBOpt << " not found." << LMI_FLUSH;
@@ -643,6 +648,9 @@ void AccountValue::PerformPmtStrategy(double* a_Pmt)
             *a_Pmt = InvariantValues().EePmt[Year];
             }
             break;
+        case mce_pmt_gsp:      // fall through
+        case mce_pmt_corridor: // fall through
+        case mce_pmt_table:    // fall through
         default:
             {
             alarum()
@@ -753,6 +761,8 @@ void AccountValue::TxSetDeathBft()
                 ,YearsCorridorFactor * AV
                 );
             break;
+        case mce_rop: // fall through
+        case mce_mdb: // fall through
         default:
             {
             alarum() << "Case " << YearsDBOpt << " not found." << LMI_FLUSH;
@@ -922,6 +932,8 @@ void AccountValue::TxTakeWD()
         case mce_option2:
             ;
             break;
+        case mce_rop: // fall through
+        case mce_mdb: // fall through
         default:
             {
             alarum() << "Case " << YearsDBOpt << " not found." << LMI_FLUSH;
diff --git a/getopt.cpp b/getopt.cpp
index 6da67c2..59a0e2f 100644
--- a/getopt.cpp
+++ b/getopt.cpp
@@ -601,6 +601,9 @@ GetOpt::operator()()
               case LIST_ARG:
                 list_option = pfound; // fall through
 
+              case REQD_ARG: // fall through
+              case OPT_ARG:  // fall through
+              case ALT_ARG:  // fall through
               default:
                 optarg = nameend + 1;
                 break;
@@ -634,6 +637,8 @@ GetOpt::operator()()
                   }
                 break;
 
+              case NO_ARG:  // fall through
+              case OPT_ARG: // fall through
               default:
                 optarg = nullptr;
                 break;
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 7f977b5..a9829d9 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -1138,6 +1138,11 @@ void 
group_quote_pdf_generator_wx::output_aggregate_values
                 // Do nothing: leave 'average_text' empty.
                 }
                 break;
+            case e_col_number: // fall through--should be unreachable
+            case e_col_name:   // fall through--should be unreachable
+            case e_col_age:    // fall through--should be unreachable
+            case e_col_dob:    // fall through--should be unreachable
+            case e_col_max:    // fall through--should be unreachable
             default:
                 {
                 alarum() << "Case " << i << " not found." << LMI_FLUSH;
diff --git a/input_sequence_parser.cpp b/input_sequence_parser.cpp
index 087cb75..2fc1873 100644
--- a/input_sequence_parser.cpp
+++ b/input_sequence_parser.cpp
@@ -164,6 +164,14 @@ void SequenceParser::duration_scalar()
                 }
             }
             break;
+        case e_eof:
+        case e_major_separator:
+        case e_minor_separator:
+        case e_begin_incl:
+        case e_begin_excl:
+        case e_end_incl:
+        case e_end_excl:
+        case e_startup:
         default:
             {
             diagnostics_ << "Expected keyword, number, '@', or '#'. ";
@@ -191,6 +199,11 @@ void SequenceParser::duration_scalar()
             current_duration_scalar_ += last_input_duration_;
             }
             break;
+        case e_invalid_mode:
+        case e_inception:
+        case e_inforce:
+        case e_retirement:
+        case e_maturity:
         default:
             {
             diagnostics_ << "Expected number, '@', or '#'. ";
@@ -358,9 +371,9 @@ void SequenceParser::duration()
             null_duration();
             }
             break;
-        case e_number:
         case e_age_prefix:
         case e_cardinal_prefix:
+        case e_number:
         case e_keyword:
             {
             single_duration();
@@ -372,6 +385,10 @@ void SequenceParser::duration()
             intervalic_duration();
             }
             break;
+        case e_minor_separator:
+        case e_end_incl:
+        case e_end_excl:
+        case e_startup:
         default:
             {
             diagnostics_
@@ -436,6 +453,16 @@ void SequenceParser::value()
                 }
             }
             break;
+        case e_eof:
+        case e_major_separator:
+        case e_minor_separator:
+        case e_begin_incl:
+        case e_begin_excl:
+        case e_end_incl:
+        case e_end_excl:
+        case e_age_prefix:
+        case e_cardinal_prefix:
+        case e_startup:
         default:
             {
             diagnostics_ << "Expected number or keyword. ";
@@ -472,6 +499,9 @@ void SequenceParser::span()
             duration();
             }
             break;
+        case e_end_incl:
+        case e_end_excl:
+        case e_startup:
         default:
             {
             diagnostics_
@@ -532,6 +562,15 @@ void SequenceParser::sequence()
                 span();
                 }
                 break;
+            case e_minor_separator:
+            case e_begin_incl:
+            case e_begin_excl:
+            case e_end_incl:
+            case e_end_excl:
+            case e_age_prefix:
+            case e_cardinal_prefix:
+            case e_number:
+            case e_keyword:
             default:
                 {
                 diagnostics_ << "Expected ';'. ";
diff --git a/round_to.hpp b/round_to.hpp
index 667d929..4d5bd82 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -409,6 +409,7 @@ round_to<RealType>::select_rounding_function(rounding_style 
const a_style) const
             {
             return detail::round_not;
             }
+        case r_indeterminate: // fall through--always invalid
         default:
             {
             throw std::domain_error("Invalid rounding style.");
diff --git a/solve.cpp b/solve.cpp
index 2d8e57b..e5fd1be 100644
--- a/solve.cpp
+++ b/solve.cpp
@@ -117,6 +117,8 @@ double SolveTest()
                     y = ConstThat->InvariantValues().SpecAmt[ThatSolveTgtYear 
- 1];
                     }
                     break;
+                case mce_rop: // fall through
+                case mce_mdb: // fall through
                 default:
                     {
                     alarum()
@@ -301,6 +303,8 @@ double AccountValue::Solve()
             SolveFn    = SolveWD;
             }
             break;
+        case mce_solve_none:    // fall through
+        case mce_solve_er_prem: // fall through
         default:
             {
             alarum()
diff --git a/workhorse.make b/workhorse.make
index cbc6fc2..5d5c3f4 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -455,6 +455,7 @@ gcc_common_warnings := \
   -Wshadow \
   -Wsign-compare \
   -Wstack-protector \
+  -Wswitch-enum \
   -Wtrampolines \
   -Wundef \
   -Wunreachable-code \
@@ -471,9 +472,7 @@ gcc_common_warnings := \
 # -Wunsafe-loop-optimizations: incompatible with ranged for-loops
 
 # Consider these later:
-
 postponed_gcc_common_warnings := \
-  -Wswitch-enum \
 
 gcc_c_warnings := \
   $(c_standard) \
@@ -523,7 +522,6 @@ gcc_cxx_warnings := \
 #   exact comparison to zero
 
 # Consider these later:
-
 postponed_gcc_cxx_warnings := \
 
 gcc_common_extra_warnings := \
@@ -577,6 +575,7 @@ $(boost_regex_objects): gcc_common_extra_warnings += \
   -Wno-implicit-fallthrough \
   -Wno-register \
   -Wno-shadow \
+  -Wno-switch-enum \
   -Wno-unused-macros \
   -Wno-useless-cast \
 
@@ -586,7 +585,9 @@ boost_dependent_objects := \
   regex_test.o \
   test_coding_rules.o \
 
-$(boost_dependent_objects): gcc_common_extra_warnings += 
-Wno-unused-local-typedefs
+$(boost_dependent_objects): gcc_common_extra_warnings += \
+  -Wno-switch-enum \
+  -Wno-unused-local-typedefs
 
 # The boost regex library improperly defines "NOMINMAX":
 #   http://lists.boost.org/Archives/boost/2006/03/102189.php
@@ -618,7 +619,10 @@ endif
 
 # See:
 #   https://lists.nongnu.org/archive/html/lmi/2019-03/msg00018.html
-$(xmlwrapp_objects): gcc_common_extra_warnings += -Wno-null-dereference
+# et seqq.:
+$(xmlwrapp_objects): gcc_common_extra_warnings += \
+  -Wno-null-dereference \
+  -Wno-switch-enum \
 
 # SOMEDAY !! Address some of these '-Wconversion' issues.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]