diff --git a/cobc/ChangeLog b/cobc/ChangeLog index 50fb38e1e..f4c5ee4ef 100644 --- a/cobc/ChangeLog +++ b/cobc/ChangeLog @@ -208,6 +208,10 @@ * codegen.c (output_perform_call): allow label end to be NULL if there is no PERFORM THRU, adjusted callers to not pass duplicate labels +2022-09-20 Simon Sobisch + + * parser.y (examine_format_variant): fix compiler warning + 2022-09-01 Nicolas Berthier FR #18 support EXAMINE statement @@ -283,6 +287,9 @@ moved -Wunsupported check for ORGANIZATION INDEXED from codegen to parsing * tree.c, typeck.c: msgid change for -Wunsupported + * reserved.c (add_reserved_word): fixed theoretical additions of + reserved=alias longer than 32 characters + * typeck.c (cb_build_const_next): minor refactoring to get field founder 2022-07-25 Simon Sobisch diff --git a/cobc/codegen.c b/cobc/codegen.c index a8af9dd09..cfb19deea 100644 --- a/cobc/codegen.c +++ b/cobc/codegen.c @@ -10537,7 +10537,7 @@ output_report_one_field (struct cb_report *r, struct cb_field *f, int idx, int o sprintf (report_field_name, "&%s", field_name); if (f->report_field_from) { - output_local ("/*FROM %s*/{", f->report_field_from->name); + output_local ("/* FROM %s */{", f->report_field_from->name); p = real_field_founder (f->report_field_from); if (f->report_field_size > 1) output_local ("%d,", f->report_field_size); @@ -10553,7 +10553,7 @@ output_report_one_field (struct cb_report *r, struct cb_field *f, int idx, int o output_local ("},"); } else if (f->report_from) { p = cb_code_field (f->report_from); - output_local ("/*COMPUTE*/{%d,", p->size); + output_local ("/* COMPUTE */{%d,", p->size); output_base (p, 0); output_local (","); output_attr (cb_build_field_reference (p, NULL)); @@ -10562,14 +10562,14 @@ output_report_one_field (struct cb_report *r, struct cb_field *f, int idx, int o output_local ("{0,NULL,NULL},"); } if (f->report_sum_counter) { - output_local ("/*SUM*/"); + output_local ("/* SUM */"); output_param (f->report_sum_counter, 0); } else { output_local ("NULL"); } output_local (","); if(f->report_control) { - output_local("/*CONTROL*/"); + output_local("/* CONTROL */"); output_param (f->report_control, 0); } else { output_local("NULL"); @@ -11059,7 +11059,7 @@ output_report_sum_counters (const int top, struct cb_field *f, struct cb_report if (x) { output_local("&%s%d,",CB_PREFIX_FIELD, cb_code_field(x)->id); } else { - output_local("/*NO SUM!*/NULL,"); + output_local("/* NO SUM! */NULL,"); } if (f->report_sum_counter) { output_local("&%s%d,",CB_PREFIX_FIELD, cb_code_field(f->report_sum_counter)->id); diff --git a/cobc/parser.y b/cobc/parser.y index 74539bcd5..28656f6fa 100644 --- a/cobc/parser.y +++ b/cobc/parser.y @@ -1875,7 +1875,7 @@ check_preceding_tallying_phrases (const enum tallying_phrase phrase) case ALL_LEADING_TRAILING_PHRASES: if (previous_tallying_phrase == CHARACTERS_PHRASE - || previous_tallying_phrase == ALL_LEADING_TRAILING_PHRASES) { + || previous_tallying_phrase == ALL_LEADING_TRAILING_PHRASES) { cb_error (_("missing value between ALL/LEADING/TRAILING words")); } /* fall through */ @@ -1886,8 +1886,8 @@ check_preceding_tallying_phrases (const enum tallying_phrase phrase) break; case VALUE_REGION_PHRASE: - if (!(previous_tallying_phrase == ALL_LEADING_TRAILING_PHRASES - || previous_tallying_phrase == VALUE_REGION_PHRASE)) { + if (! ( previous_tallying_phrase == ALL_LEADING_TRAILING_PHRASES + || previous_tallying_phrase == VALUE_REGION_PHRASE)) { cb_error (_("missing ALL/LEADING/TRAILING before value")); } break; @@ -1907,8 +1907,8 @@ static int has_relative_pos (struct cb_field const *field) { return !!(field->screen_flag - & (COB_SCREEN_LINE_PLUS | COB_SCREEN_LINE_MINUS - | COB_SCREEN_COLUMN_PLUS | COB_SCREEN_COLUMN_MINUS)); + & ( COB_SCREEN_LINE_PLUS | COB_SCREEN_LINE_MINUS + | COB_SCREEN_COLUMN_PLUS | COB_SCREEN_COLUMN_MINUS)); } static int @@ -1919,7 +1919,7 @@ is_recursive_call (cb_tree target) if (CB_LITERAL_P (target)) { target_name = (const char *)(CB_LITERAL(target)->data); } else if (CB_REFERENCE_P (target) - && CB_PROTOTYPE_P (cb_ref (target))) { + && CB_PROTOTYPE_P (cb_ref (target))) { target_name = CB_PROTOTYPE (cb_ref (target))->ext_name; } @@ -12848,7 +12848,6 @@ field_or_literal_or_erase_list: } ; - field_or_literal_or_erase: identifier | basic_literal @@ -12860,7 +12859,6 @@ field_or_literal_or_erase: } ; - display_message_box: MESSAGE _box x_list { @@ -14263,6 +14261,12 @@ examine_format_variant: r = cb_list_add (r, CB_BUILD_FUNCALL_1 ("cob_inspect_before", x)); t = cb_build_tallying_characters (r); break; + /* LCOV_EXCL_START */ + default: + /* This should never happen (and therefore doesn't get a translation) */ + cb_error ("unexpected EXAMINE TALLYING %d", examine_keyword.tallying); + COBC_ABORT (); + /* LCOV_EXCL_STOP */ } cb_emit_inspect ($0, t, TALLYING_CLAUSE); if (replacing_to) { @@ -14301,6 +14305,12 @@ examine_format_variant: r = cb_list_add (r, CB_BUILD_FUNCALL_1 ("cob_inspect_before", from)); t = cb_build_replacing_characters (to, r); break; + /* LCOV_EXCL_START */ + default: + /* This should never happen (and therefore doesn't get a translation) */ + cb_error ("unexpected EXAMINE REPLACING %d", examine_keyword.replacing); + COBC_ABORT (); + /* LCOV_EXCL_STOP */ } cb_emit_inspect ($0, t, REPLACING_CLAUSE); } diff --git a/cobc/reserved.c b/cobc/reserved.c index e80d2d39c..9a534a798 100644 --- a/cobc/reserved.c +++ b/cobc/reserved.c @@ -4811,7 +4811,8 @@ add_amendment (const char *word, const char *fname, const int line, void add_reserved_word (const char *word, const char *fname, const int line) { - char upper_word[COB_MAX_WORDLEN + 1]; + /* max: NAMEA*=NAMEB */ + char upper_word[COB_MAX_WORDLEN + 1 + 1 + COB_MAX_WORDLEN + 1]; size_t word_len = strlen (word) + 1; if (word_len > sizeof (upper_word)) { return; diff --git a/cobc/typeck.c b/cobc/typeck.c index e7df9942f..c6464dbe0 100644 --- a/cobc/typeck.c +++ b/cobc/typeck.c @@ -3118,17 +3118,12 @@ cb_build_const_next (struct cb_field *f) } if (previous->storage != CB_STORAGE_FILE - && previous->storage != CB_STORAGE_LINKAGE) { - p = previous; - while (p->parent) { - p = p->parent; - } - if (!p->flag_external) { + && previous->storage != CB_STORAGE_LINKAGE + && !cb_field_founder(previous)->flag_external) { cb_error (_("VALUE of '%s': %s target is invalid"), f->name, "NEXT"); cb_error (_("target must be in FILE SECTION or LINKAGE SECTION or have the EXTERNAL clause")); return cb_build_numeric_literal (0, "1", 0); } - } /* * Compute the size of the last and all its parent fields, diff --git a/libcob/ChangeLog b/libcob/ChangeLog index 1d7949907..c541d5187 100644 --- a/libcob/ChangeLog +++ b/libcob/ChangeLog @@ -228,6 +228,7 @@ * screenio.c (cob_exit_screen): ensure to not end COB_EXIT_MESSAGE on mouse-move + * common.c (cob_sys_exit_proc): fix compiler warning 2022-08-19 Simon Sobisch diff --git a/libcob/common.c b/libcob/common.c index 90cd87cce..483df94da 100644 --- a/libcob/common.c +++ b/libcob/common.c @@ -5838,6 +5838,7 @@ cob_sys_exit_proc (const void *dispo, const void *pptr) struct exit_handlerlist *hp; struct exit_handlerlist *h; unsigned char install_flag; + /* only initialized to silence -Wmaybe-uninitialized */ unsigned char priority = 0; int (**p)(void); diff --git a/tests/ChangeLog b/tests/ChangeLog index bfad7c8b2..f72052466 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -31,6 +31,10 @@ * atlocal.in: added callgrind run for in-depth performance checks which can be activated by setting CGSUFFIX variable +2022-09-21 Simon Sobisch + + * atlocal_valgrind, atlocal_win: updated to match atlocal.in + 2022-07-28 Simon Sobisch * atlocal.in: option to run part of the testsuite via perf -stat diff --git a/tests/atlocal_valgrind b/tests/atlocal_valgrind index 1c196e0c0..97400ae3f 100644 --- a/tests/atlocal_valgrind +++ b/tests/atlocal_valgrind @@ -115,10 +115,10 @@ unset LANG FLAGS="-debug -Wall ${COBOL_FLAGS} -fno-diagnostics-show-option" COBC="${COBC} -std=default" COMPILE="${COBC} -x ${FLAGS}" -COMPILE_ONLY="${COBC} -fsyntax-only ${FLAGS}" +COMPILE_ONLY="${COBC} -fsyntax-only ${FLAGS} -Wno-unsupported" COMPILE_MODULE="${COBC} -m ${FLAGS}" -# test runner for manual tests, content may be changed by the user +# test runner for manual tests, content may be adjusted by the user RUN_PROG_MANUAL="${abs_builddir}/run_prog_manual.sh" # unset option if not internally set in this script @@ -186,7 +186,7 @@ for cobenv in $(${LOCAL_ENV} ${ABS_COBCRUN} --runtime-conf \ done # prevent multiple calls by caching the output -${LOCAL_ENV} ${ABS_COBC} --info > info.out +${LOCAL_ENV} ${ABS_COBC} --verbose --info > info.out # ... and also unset for the compiler if test "$GNUCOBOL_TEST_LOCAL" != "1"; then @@ -292,7 +292,4 @@ COB_SCHEMA_DIR="." && export COB_SCHEMA_DIR DB_HOME="" && export DB_HOME # For the very rare cases where cobc/libcob may need to know if they're running in test mode: -case $0 in - */testsuite) COB_IS_RUNNING_IN_TESTMODE=1 && export COB_IS_RUNNING_IN_TESTMODE;; - *) unset COB_IS_RUNNING_IN_TESTMODE;; -esac +COB_IS_RUNNING_IN_TESTMODE=1 && export COB_IS_RUNNING_IN_TESTMODE diff --git a/tests/atlocal_win b/tests/atlocal_win index cf939824a..1b901496a 100644 --- a/tests/atlocal_win +++ b/tests/atlocal_win @@ -55,7 +55,7 @@ COMPILE="${COBC} -x ${FLAGS}" COMPILE_ONLY="${COBC} -fsyntax-only ${FLAGS} -Wno-unsupported" COMPILE_MODULE="${COBC} -m ${FLAGS}" -# test runner for manual tests, content may be changed by the user +# test runner for manual tests, content may be adjusted by the user RUN_PROG_MANUAL="${abs_builddir}/run_prog_manual.sh" # unset option if not internally set in this script @@ -119,7 +119,7 @@ for cobenv in $(${LOCAL_ENV} ${COBCRUN} --runtime-conf \ done # prevent multiple calls by caching the output -${LOCAL_ENV} ${COBC} --info > info.out +${LOCAL_ENV} ${COBC} --verbose --info > info.out # ... and also unset for the compiler if test "$GNUCOBOL_TEST_LOCAL" != "1"; then @@ -217,7 +217,4 @@ COB_SCHEMA_DIR="." && export COB_SCHEMA_DIR DB_HOME="" && export DB_HOME # For the very rare cases where cobc/libcob may need to know if they're running in test mode: -case $0 in - */testsuite) COB_IS_RUNNING_IN_TESTMODE=1 && export COB_IS_RUNNING_IN_TESTMODE;; - *) unset COB_IS_RUNNING_IN_TESTMODE;; -esac +COB_IS_RUNNING_IN_TESTMODE=1 && export COB_IS_RUNNING_IN_TESTMODE