comparison libinterp/parse-tree/lex.ll @ 33344:3606817b9994

take adavantage of compiler warnings for unhandled enum switch cases Don't use default cases in switch statements that use enum values so that compilers may warn about unhandled enum values. Use error to report enum values that are not accepted by the switch, use error with a meaningful message instead of panic_impossible.
author John W. Eaton <jwe@octave.org>
date Sat, 06 Apr 2024 14:38:17 -0400
parents 70b7f1c285c7
children 56d234504c01
comparison
equal deleted inserted replaced
33343:eb8a24370c2b 33344:3606817b9994
2842 octave_value ov_value (static_cast<double> (l)); 2842 octave_value ov_value (static_cast<double> (l));
2843 tok = new token (kw->tok_id, ov_value, "", m_tok_beg, m_tok_end, get_comment_list ()); 2843 tok = new token (kw->tok_id, ov_value, "", m_tok_beg, m_tok_end, get_comment_list ());
2844 } 2844 }
2845 break; 2845 break;
2846 2846
2847 default: 2847 // We should have handled all possible enum values above. Rely
2848 panic_impossible (); 2848 // on compiler diagnostics to warn if we haven't. For example,
2849 // GCC's -Wswitch option, enabled by -Wall, will provide a
2850 // warning.
2849 } 2851 }
2850 2852
2851 if (! tok) 2853 if (! tok)
2852 tok = new token (kw->tok_id, true, m_tok_beg, m_tok_end, get_comment_list ()); 2854 tok = new token (kw->tok_id, true, m_tok_beg, m_tok_end, get_comment_list ());
2853 2855
2854 return tok; 2856 return tok;
2855 } 2857 }
2856 2858
2857 /* 2859 /*