Skip to content

Commit

Permalink
Merge SVN 4708
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jul 10, 2024
1 parent ef7c1d8 commit 5aaa9eb
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 34 deletions.
7 changes: 7 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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 <simonsobisch@gnu.org>

* parser.y (examine_format_variant): fix compiler warning

2022-09-01 Nicolas Berthier <nicolas.berthier@ocamlpro.com>

FR #18 support EXAMINE statement
Expand Down Expand Up @@ -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 <simonsobisch@gnu.org>

Expand Down
10 changes: 5 additions & 5 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand All @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
26 changes: 18 additions & 8 deletions cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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;
}

Expand Down Expand Up @@ -12848,7 +12848,6 @@ field_or_literal_or_erase_list:
}
;


field_or_literal_or_erase:
identifier
| basic_literal
Expand All @@ -12860,7 +12859,6 @@ field_or_literal_or_erase:
}
;


display_message_box:
MESSAGE _box x_list
{
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion cobc/reserved.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 2 additions & 7 deletions cobc/typeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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 <simonsobisch@gnu.org>

Expand Down
1 change: 1 addition & 0 deletions libcob/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 4 additions & 0 deletions tests/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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 <simonsobisch@gnu.org>

* atlocal_valgrind, atlocal_win: updated to match atlocal.in

2022-07-28 Simon Sobisch <simonsobisch@gnu.org>

* atlocal.in: option to run part of the testsuite via perf -stat
Expand Down
11 changes: 4 additions & 7 deletions tests/atlocal_valgrind
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
9 changes: 3 additions & 6 deletions tests/atlocal_win
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 5aaa9eb

Please sign in to comment.