Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into gc4
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jun 8, 2024
2 parents f36dcda + 859723c commit 4bf4302
Show file tree
Hide file tree
Showing 31 changed files with 1,558 additions and 421 deletions.
4 changes: 2 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ Open Plans:
still applied;
File name mapping now applies both to COBOL statements and CALLable
CBL_ and C$ file routines.

** Screen I/O: initial mouse support (for details see runtime.cfg),
use of CURSOR clause in SPECIAL-NAMES for positioning on ACCEPT

Expand Down Expand Up @@ -522,7 +522,7 @@ Open Plans:
not included in -Wall any more
-Wno-ignored-error allows to suppress messages that normally would be an
error and are only allowed because they are never executed
-Wcorresponding is now enabled by default
-Wimplicit-define and -Wcorresponding are now enabled by default

-f[no]-diagnostics-show-option, enabled by default, shows the
command line option responsible for the diagnostic message
Expand Down
3 changes: 3 additions & 0 deletions build_aux/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ autoreconf $AC_OPTS $MAINPATH > $msgs 2>&1; ret=$?
# Filter aminclude_static as those are only used _within_ another
# check so reporting as portability problem is only noise.
# This has the effect of redirecting some error messages to stdout.
# to be moved to the Makefile - currently only usable for bootstrap,
# but should be done on autogen, too

awk '/^aminclude_static[.]am:/ { msg = msg sep $0; sep = "\n"; next }
/Makefile[.]am.+aminclude_static.am.+from here/ {
msg = ""; sep = ""; next }
msg { print msg > "/dev/stderr"; msg = "" }
{ print }' $msgs
rm -rf $msgs

if test $ret -ne 0; then
echo; echo "ERROR, autoreconf returned $ret - aborting bootstrap" && exit $ret
Expand Down
5 changes: 2 additions & 3 deletions build_aux/create_win_dist.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# create_win_dist.sh gnucobol
#
# Copyright (C) 2016-2017,2019 Free Software Foundation, Inc.
# Copyright (C) 2016-2017,2019-2020 Free Software Foundation, Inc.
# Written by Simon Sobisch
#
# This file is part of GnuCOBOL.
Expand Down Expand Up @@ -65,10 +65,9 @@ cp "$EXTSRCDIR/tests/atlocal_win" "$EXTWINDISTDIR/tests/atlocal_win" || exit 2
olddir="$(pwd)"
cd "$EXTWINDISTDIR" || exit 3

# rename templates for faster setup
# rename template for faster setup
cd build_windows || exit 5
mv "config.h.in" "config.h"
mv "defaults.h.in" "defaults.h"
cd ..

# remove content not necessary for windows-only distribution --> breaks make dist[check]
Expand Down
35 changes: 32 additions & 3 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,19 @@
'memcpy' to speed up the process
If size is not known until run time then emit call to cob_init_table

2020-11-20 Simon Sobisch <[email protected]>

* pplex.l (ppinput): fixed processing after "line not terminated"

2020-11-19 Simon Sobisch <[email protected]>

FR #53 TURN directive and -fno-ec=NAME/-fec=NAME - finish
* cobc.c (turn_ec_for_table): correct handling for EC-ALL
* cobc.c (cobc_turn_ec): handling EC-USER as PENDING
* cobc.c (process_command_line), cobc.h: handle -debug before all the
flags and exception options it sets, allowing to remove its internal
explicit_set flag

2020-11-18 Ron Norman <[email protected]>

* codegen.c,typeck.c: Generated code for INITIALIZE computes the actual
Expand Down Expand Up @@ -1270,6 +1283,14 @@
* config.def: added possible values for assign-clause and
screen-section-rules.

2020-07-21 Simon Sobisch <[email protected]>

* pplex.l, ppparse.y: implemented CHECKNUM/NOCHECKNUM,
preparation for SPZERO
* ppparse.y: improved error handling for broken IF/ELIF
directives by consuming as much errors as possible and
emitting a "false"

2020-07-19 Edward Hart <[email protected]>

* cobc.c, typeck.c: added support for JSON-C as JSON handler.
Expand Down Expand Up @@ -1326,6 +1347,13 @@
* cobc.c (compare_prepare): fixed bug #569: stop copying into cmp_line
when line length exceeds CB_LINE_LENGTH.

2020-06-30 Simon Sobisch <[email protected]>

FR #53 TURN directive - finished command line variant as -fno-ec/-fec
* cobc.c, flag.def, help.c: renamed -fdisable-ec/-fenable-ec
* cobc.c: removed the need to use EC- prefix in the name for -f[no-]ec
* flag.def, help.c: fixed some help output

2020-06-30 Edward Hart <[email protected]>

* typeck.c (validate_move): refactored.
Expand Down Expand Up @@ -1373,14 +1401,15 @@
2020-06-23 Edward Hart <[email protected]>

FR #53 TURN directive
* cobc.c, cobc.h: completed initial implementation on disabling ECs.
* cobc.c, cobc.h: completed initial implementation on disabling ECs
on command line with -fdisable-ec=NAME -fenable-ec=NAME
* cobc.c, cobc.h, parser.y, ppparse.y, scanner.l: completed initial
implementation of >>TURN.
implementation of >>TURN

2020-06-22 Simon Sobisch <[email protected]>

* cobc.c, cobc.h, flag.def, ppparse.y: draft work on >>TURN and
disabling exceptions (FR #53).
disabling exceptions (FR #53)

2020-06-22 Simon Sobisch <[email protected]>

Expand Down
82 changes: 38 additions & 44 deletions cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ struct list_files *cb_current_file = NULL;
struct cob_time current_compile_time = { 0 };
struct tm current_compile_tm = { 0 };

#if 0 /* RXWRXW - source format */
char *source_name = NULL;
#endif

enum cb_format cb_source_format = CB_FORMAT_FIXED;
#if 0 /* ancient OSVS registers that need special runtime handling - low priority */
enum cb_current_date current_date = CB_DATE_MDY;
Expand Down Expand Up @@ -1517,32 +1513,25 @@ turn_ec_for_table (struct cb_exception *table, const size_t table_len,
{
size_t i;

if (ec.code & 0x00FF) {
/* Set individual level-1 EC */
if (ec.code == CB_EXCEPTION_CODE (COB_EC_ALL)) {
/* EC-ALL - level-1 EC to set all ECs */
for (i = 0; i < table_len; ++i) {
if (table[i].code == ec.code) {
table[i].enable = to_on_off;
table[i].explicit_enable_val = 1;
break;
}
table[i].enable = to_on_off;
}
} else if (ec.code != 0) {
/*
Simon: ToDo: Group activation; check occurences of
EC-generation
*/
} else if ((ec.code & 0x00FF) == 0) {
/* Set all ECs subordinate to level-2 EC */
for (i = 0; i < table_len; ++i) {
if ((table[i].code & 0xFF00) == ec.code) {
table[i].enable = to_on_off;
table[i].explicit_enable_val = 1;
}
}
} else {
/* EC-ALL; set all ECs */
/* Set individual level-3 EC */
for (i = 0; i < table_len; ++i) {
table[i].enable = to_on_off;
table[i].explicit_enable_val = 1;
if (table[i].code == ec.code) {
table[i].enable = to_on_off;
break;
}
}
}
}
Expand Down Expand Up @@ -1615,11 +1604,6 @@ ec_duped (struct cb_text_list *ec_list, struct cb_text_list *ec,
return 0;
}

/*
Simon: ToDo: Move save/restore of activated exceptions before
preparse; after C generation A dynamic save (only if changed)
and restore (only if set) would be nice
*/
unsigned int
cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree loc)
{
Expand All @@ -1638,6 +1622,15 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l
for (i = 0; i < len; ++i) {
upme[i] = cb_toupper (upme[i]);
}

/* User specified exception (always nonfatal, compared by name) */
if (!strncmp (ec->text, "EC-USER", 7)) {
/* TODO: EC-USER[NAME] not supported yet, maybe addd as table
of strings or hash into the generated program */
CB_PENDING ("EC-USER");
return 1;
}

/* extract exception code via text comparison */
ec_idx = 0;
for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) {
Expand All @@ -1648,7 +1641,6 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l
}

/* Error if not a known exception name */
/* TO-DO: What about EC-USER? */
if (ec_idx == 0) {
cb_error_x (loc, _("invalid exception-name: %s"),
ec->text);
Expand All @@ -1659,7 +1651,7 @@ cobc_turn_ec (struct cb_text_list *ec_list, const cob_u32_t to_on_off, cb_tree l
return 1;
}

if (!strncmp(CB_EXCEPTION_NAME(ec_idx), "EC-I-O", 6)) {
if (!strncmp (CB_EXCEPTION_NAME(ec_idx), "EC-I-O", 6)) {
if (turn_ec_io (cb_exception_table[ec_idx], to_on_off,
loc, &ec)) {
return 1;
Expand Down Expand Up @@ -2874,7 +2866,8 @@ process_command_line (const int argc, char **argv)
}
#endif

/* First run of getopt: handle std/conf and all listing options
/* First run of getopt: handle std/conf and all listing options, along
with grouping options that should not override other entries (as --debug)
We need to postpone single configuration flags as we need
a full configuration to be loaded before */
cob_optind = 1;
Expand Down Expand Up @@ -3106,6 +3099,13 @@ process_command_line (const int argc, char **argv)
cobc_early_exit (EXIT_FAILURE);
}

/* debug: Turn on all exception conditions */
if (cobc_wants_debug) {
for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) {
CB_EXCEPTION_ENABLE (i) = 1;
}
}

/* dump implies extra information (may still be disabled later) */
if (cb_flag_dump != COB_DUMP_NONE) {
cb_flag_source_location = 1;
Expand Down Expand Up @@ -3837,6 +3837,13 @@ process_command_line (const int argc, char **argv)
cobc_main_free (output_name_buff);
}

/* debug: Turn on all exception conditions
-> drop note about this after hanling exit_option and general problems */
if (cobc_wants_debug && verbose_output > 1) {
fputs (_ ("all runtime checks are enabled"), stderr);
fputc ('\n', stderr);
}

/* Set relaxed syntax configuration options if requested */
/* part 1: relaxed syntax compiler configuration option */
if (cb_relaxed_syntax_checks) {
Expand Down Expand Up @@ -3941,19 +3948,6 @@ process_command_line (const int argc, char **argv)
}
#endif

/* debug: Turn on all exception conditions */
if (cobc_wants_debug) {
for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) {
if (!CB_EXCEPTION_EXPLICIT (i)) {
CB_EXCEPTION_ENABLE (i) = 1;
}
}
if (verbose_output > 1) {
fputs (_("all runtime checks are enabled"), stderr);
fputc ('\n', stderr);
}
}

/* If C debug, do not strip output */
if (cb_source_debugging) {
strip_output = 0;
Expand Down Expand Up @@ -4134,7 +4128,7 @@ process_filename (const char *filename)
#if defined(__OS400__)
extension[0] == 0
#else
cb_strcasecmp (extension, COB_OBJECT_EXT) == 0
cb_strcasecmp (extension, COB_OBJECT_EXT) == 0
#if defined(_WIN32)
|| cb_strcasecmp (extension, "lib") == 0
#endif
Expand All @@ -4160,8 +4154,8 @@ process_filename (const char *filename)
fn->preprocess = cobc_main_strdup (fn->source);
} else if (output_name && cb_compile_level == CB_LEVEL_PREPROCESS) {
fn->preprocess = cobc_main_strdup (output_name);
} else if (save_all_src || save_temps ||
cb_compile_level == CB_LEVEL_PREPROCESS) {
} else if (save_all_src || save_temps
|| cb_compile_level == CB_LEVEL_PREPROCESS) {
fn->preprocess = cobc_main_stradd_dup (fbasename, ".i");
} else {
fn->preprocess = cobc_main_malloc (COB_FILE_MAX);
Expand Down
6 changes: 6 additions & 0 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -11925,6 +11925,12 @@ output_module_init_function (struct cb_program *prog)
if (cb_flag_trace) {
opt |= COB_MODULE_TRACE;
}
#if 0 /* currently unused */
if (cobc_wants_debug
|| cb_flag_dump) {
opt |= COB_MODULE_DEBUG;
}
#endif
output_line ("module->flag_debug_trace |= %d;", opt);
}
output_line ("module->flag_dump_sect = 0x%02X;", cb_flag_dump);
Expand Down
5 changes: 4 additions & 1 deletion cobc/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,10 @@ validate_any_length_item (struct cb_field *f)
return 1;
}

/* CHECKME: Why do we increase the reference counter here and not in another place? */
/* CHECKME: Why do we increase the reference counter here
(to ensure the field is generated)?
Better would be to add the check for 'f->count != 0' to the place
where it possibly is missing... */
f->count++;
return 0;
}
Expand Down
Loading

0 comments on commit 4bf4302

Please sign in to comment.