# HG changeset patch # User Markus Mützel # Date 1712589489 -7200 # Node ID 2f810ce49c68be8664f98f1e0b41b1655bd7cc5e # Parent 4b134186195c442aa173fd99c57b43cc4bcfefc6# Parent c8dcba6e3ed8c7722ef82f3b4736ed810b6e384b maint: Merge away extra head. diff -r c8dcba6e3ed8 -r 2f810ce49c68 libinterp/octave-value/ov-java.cc --- a/libinterp/octave-value/ov-java.cc Sun Apr 07 22:17:52 2024 +0200 +++ b/libinterp/octave-value/ov-java.cc Mon Apr 08 17:18:09 2024 +0200 @@ -641,6 +641,7 @@ return jvm_lib_path; } + #endif //! Initialize the java virtual machine (jvm) and field #jvm if necessary. @@ -905,6 +906,12 @@ #endif +OCTAVE_NORETURN static void +error_unexpected (const char *name) +{ + error ("unexpected call to %s when HAVE_JAVA is not defined - please report this bug", name); +} + bool octave_java::is_java_string () const { @@ -925,7 +932,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::is_java_string"); #endif } @@ -957,7 +964,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::is_instance_of"); #endif } @@ -2183,7 +2190,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::dims"); #endif } @@ -2248,7 +2255,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::subsref"); #endif } @@ -2338,7 +2345,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::subsasgn"); #endif } @@ -2360,7 +2367,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::map_keys"); #endif } @@ -2386,7 +2393,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::convert_to_str_internal"); #endif } @@ -2496,7 +2503,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_javaMethod"); #endif } @@ -2517,7 +2524,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_javaMethod"); #endif } @@ -2577,7 +2584,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_javaMethod"); #endif } @@ -2600,7 +2607,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_javaMethod"); #endif } @@ -2656,7 +2663,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_javaObject"); #endif } @@ -2677,7 +2684,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_javaObject"); #endif } @@ -2723,7 +2730,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_java_get"); #endif } @@ -2742,7 +2749,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_java_get"); #endif } @@ -2790,7 +2797,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_java_get"); #endif } @@ -2811,7 +2818,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_java_get"); #endif } @@ -2858,7 +2865,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_java_set"); #endif } @@ -2878,7 +2885,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_java_set"); #endif } @@ -2929,7 +2936,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_java_set"); #endif } @@ -2952,7 +2959,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::do_java_set"); #endif } @@ -3002,7 +3009,7 @@ // This shouldn't happen because construction of octave_java // objects is supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::init"); #endif } @@ -3031,7 +3038,7 @@ // This shouldn't happen because construction of octave_java objects is // supposed to be impossible if Java is not available. - panic_impossible (); + error_unexpected ("octave_java::release"); #endif } diff -r c8dcba6e3ed8 -r 2f810ce49c68 libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Sun Apr 07 22:17:52 2024 +0200 +++ b/libinterp/parse-tree/lex.ll Mon Apr 08 17:18:09 2024 +0200 @@ -2108,7 +2108,7 @@ lexical_feedback::symbol_table_context::pop () { if (empty ()) - panic_impossible (); + error ("unexpected: empty stack in lexical_feedback::symbol_table_context::pop - please report this bug"); m_frame_stack.pop_front (); } @@ -2358,7 +2358,9 @@ else len = max_size > m_chars_left ? m_chars_left : max_size; - panic_unless (len > 0); + if (len <= 0) + error ("unexpected: buffer underflow in base_lexer::input_buffer::copy_chunk - please report this bug"); + memcpy (buf, m_buffer.c_str () + m_offset, len); m_chars_left -= len; @@ -2912,6 +2914,12 @@ return (len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')); } +OCTAVE_NORETURN static void +error_unexpected_bytes (int bytes) +{ + error ("unexpected: bytes (= %d) not 1, 2, 4, or 8 in make_integer_value - please report this bug", bytes); +} + static inline octave_value make_integer_value (uintmax_t long_int_val, bool unsigned_val, int bytes) { @@ -2932,7 +2940,7 @@ return octave_value (octave_uint64 (long_int_val)); default: - panic_impossible (); + error_unexpected_bytes (bytes); }; } else @@ -2955,7 +2963,7 @@ return octave_value (octave_int64 (int64_t (long_int_val))); default: - panic_impossible (); + error_unexpected_bytes (bytes); }; } @@ -3025,10 +3033,10 @@ else if (sizeof (uintmax_t) == sizeof (unsigned long)) long_int_val = strtoul (yytxt.c_str (), &end, 2); else - panic_impossible (); + error ("unexpected: size mismatch: uintmax_t vs unsigned long or unsigned long long in base_lexer::handle_number<2> - please report this bug"); if (errno == ERANGE) - panic_impossible (); + error ("unexpected: ERANGE error in base_lexer::handle_number<2> - please report this bug"); octave_value ov_value = make_integer_value (long_int_val, unsigned_val, bytes); @@ -3130,7 +3138,7 @@ else if (sizeof (uintmax_t) == sizeof (unsigned long)) long_int_val = strtoul (tmptxt, &end, 10); else - panic_impossible (); + error ("unexpected: size mismatch: uintmax_t vs unsigned long or unsigned long long in base_lexer::handle_number<10> - please report this bug"); if (errno != ERANGE) { @@ -3212,8 +3220,7 @@ return syntax_error (msg); } - // Panic instead of error here because if yytext doesn't contain a - // valid number, we are in deep doo doo. + // If yytext doesn't contain a valid number, we are in deep doo doo. uintmax_t long_int_val; int status = sscanf (yytxt.c_str (), "%jx", &long_int_val); @@ -3331,7 +3338,7 @@ else if (bracket_type == '}') m_braceflag--; else - panic_impossible (); + error ("unexpected: bracket_type not ']' or '}' in base_lexer::handle_close_bracket - please report this bug"); } pop_start_state (); @@ -4053,7 +4060,8 @@ // input_buffer::copy_chunk, simply insert the marker directly // in BUF. - panic_unless (max_size > 0); + if (max_size <= 0) + error ("unexpected: max_size <= 0 in push_lexer::fill_flex_buffer - please report this bug"); buf[0] = static_cast (1); status = 1;