Skip to content

Commit

Permalink
Merge SVN 4970
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Sep 13, 2024
1 parent 5ce3f69 commit 93543a9
Show file tree
Hide file tree
Showing 24 changed files with 281 additions and 240 deletions.
12 changes: 9 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,13 @@ Open Plans:
** the option -g does not longer imply -fsource-location; but it auto-includes
references to the COBOL-paragraphs to further ease source level debugging

** -fsource-location generates source references to copyboooks in DATA
DIVISION, enabling to inspect the initial VALUE setting as well as
"list"ing those copybooks with a source level debugger

** new flag -fstack-extended (implied with --debug and --dump) to include
the origin of entrypoints and PERFORM, this is used for the internal
stack trace on abort and can be used for source level debugging
stack trace on abort and can be used for improved source level debugging

** new options to ensure structured code-flow:
-fsection-exit-check to ensure sections don't "fall through" (are always
Expand Down Expand Up @@ -450,12 +454,14 @@ Open Plans:
as well as during debugging were extended, for example each executed WHEN,
VARYING and UNTIL phrases are now seen

** condition-names are made available for source-level debugging

** cobc's parsing time was significantly reduced for big programs

** execution times were significantly reduced for the following:
INSPECT that use big COBOL fields (multiple KB)
MOVE and comparisions (especially with enabled runtime checks, to
optimize those a re-compile is needed)
MOVE and comparisions in general (especially with enabled runtime
checks, to optimize those a re-compile is needed)
CALL data-item, and first time for each CALL
ACCEPT DATE/TIME/DAY, most if numeric items are accepted
datetime related FUNCTIONs
Expand Down
29 changes: 23 additions & 6 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
* tree.c: Change to use cb_max_binary instead of constant
* typeck.c: Change to use cb_max_binary instead of constant

2023-01-30 Simon Sobisch <[email protected]>

* parser.y (usage_clause_screen_report), typeck.c (validate_usage): have
REPORT and SCREEN section only expecting the possibly USAGEs instead all
removing the need to check for bad USAGE later

2023-01-28 Simon Sobisch <[email protected]>

* codeoptim.c: adjusted inline functions (cob_cmp_packed_int,
Expand Down Expand Up @@ -92,6 +98,23 @@
out of bounds
* codeoptim.c: Fix cob_check_subscript_inline for min subscript value

2023-01-19 Simon Sobisch <[email protected]>

* help.c (cobc_print_usage): fixed msgid to match bin/cobcrun.c
* flag.def: use correct option names in help output
* config.def: fixed typos and spacing in msgids
* flag.def: removed duplicated msgid - those are printed in help.c only
* typeck.c (cb_emit_goto_entry), tree.h, parser.y: dropped duplicated
function and msgid, using cb_emit_goto instead
* parser.y (_goto_depending), typeck.c (cb_emit_goto): check via use of
numeric_identifier in the parser instead of postponed checking
* parser.y (assign_clause), typeck.c (cb_check_numeric_value,
cb_validate_collating, validate_assign_name,
cb_check_integer_value, error_if_not_int_field_or_has_pic_p):
dropped very similar msgids using standard ones for the checks
* tree.c (get_category_from_arguments, get_number_in_parentheses): msgid
related changes

2023-01-18 Simon Sobisch <[email protected]>

* parser.y (cb_default_colseq, build_default_colseq, setup_default_colseq):
Expand Down Expand Up @@ -7436,12 +7459,6 @@

* Report Writer module

201?-??-?? Sergey Kashyrin <[email protected]>

* codeoptim.c : Fixed bug in COB_ADD_PACKED_INT.
Computing COMP-3 failed in MSVC-build versions,
in output_storage() calls '%' should be '%%'.

2012-05-09 Simon Sobisch <[email protected]>

* cobc.c: Added conversion for enabling options in WIN style
Expand Down
30 changes: 15 additions & 15 deletions cobc/config.def
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2012, 2014-2022 Free Software Foundation, Inc.
Copyright (C) 2001-2012, 2014-2023 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch, Edward Hart

This file is part of GnuCOBOL.
Expand Down Expand Up @@ -80,11 +80,11 @@ CB_CONFIG_BOOLEAN (cb_align_opt, "align-opt",

CB_CONFIG_ANY (signed int, cb_default_byte, "defaultbyte",
_("default initialization for fields without VALUE, may be one of\n"
" * character in quotes\n"
" * decimal 0..255 representing a character\n"
" * \"init\" to initialize to PICTURE/USAGE\n"
" * \"none\" to do no explicit initialization\n"
" * default: \"init\""))
" * character in quotes\n"
" * decimal 0..255 representing a character\n"
" * \"init\" to initialize to PICTURE/USAGE\n"
" * \"none\" to do no explicit initialization\n"
" * default: \"init\""))

CB_CONFIG_ANY (enum cb_std_def, cb_std_define, "standard-define", NULL) /* Used Standard (set via -std) */

Expand Down Expand Up @@ -200,24 +200,24 @@ CB_CONFIG_BOOLEAN (cb_xml_parse_xmlss, "xml-parse-xmlss",

CB_CONFIG_BOOLEAN (cb_areacheck, "areacheck",
_("check contents of Area A (when reference format supports Area A enforcement),\n"
" enabled checks include:\n"
" * division, section, paragraph names, level indicators (FD, SD, RD, and CD),\n"
" and toplevel numbers (01 and 77) must start in Area A;\n"
" * statements must not start in Area A; and\n"
" * separator periods must not be within Area A"))
" enabled checks include:\n"
" * division, section, paragraph names, level indicators (FD, SD, RD, and CD),\n"
" and toplevel numbers (01 and 77) must start in Area A;\n"
" * statements must not start in Area A; and\n"
" * separator periods must not be within Area A"))

/* Support flags */

CB_CONFIG_SUPPORT (cb_comment_paragraphs, "comment-paragraphs",
_("comment paragraphs in IDENTIFICATION DIVISION (AUTHOR, DATE-WRITTEN, ...)"))

CB_CONFIG_SUPPORT (cb_control_division, "control-division",
_("CONTROL DIVISION"))
"CONTROL DIVISION")

/* Enables literals as replacement operands. */
CB_CONFIG_SUPPORT (cb_partial_replace_when_literal_src, "partial-replace-when-literal-src",
_("apply partial replacing with literal source operand even when it replaces with spaces only;\n"
" * \"skip\" prevents such replacements"))
" * \"skip\" prevents such replacements"))

CB_CONFIG_SUPPORT (cb_memory_size_clause, "memory-size-clause",
_("MEMORY-SIZE clause"))
Expand Down Expand Up @@ -261,7 +261,7 @@ CB_CONFIG_SUPPORT (cb_special_names_clause, "special-names-clause",
_("SPECIAL-NAMES clause"))

CB_CONFIG_SUPPORT (cb_goto_statement_without_name, "goto-statement-without-name",
_("GOTO statement without name"))
_("GO TO statement without name"))

CB_CONFIG_SUPPORT (cb_stop_literal_statement, "stop-literal-statement",
_("STOP-literal statement"))
Expand Down Expand Up @@ -433,7 +433,7 @@ CB_CONFIG_SUPPORT (cb_continue_after, "continue-after",
_("AFTER phrase in CONTINUE statement"))

CB_CONFIG_SUPPORT (cb_goto_entry, "goto-entry",
_("ENTRY FOR GOTO and GOTO ENTRY statements"))
_("ENTRY FOR GO TO and GO TO ENTRY statements"))

CB_CONFIG_SUPPORT (cb_depending_on_not_fixed, "depending-on-not-fixed", _("depending-on-not-fixed"))

Expand Down
15 changes: 11 additions & 4 deletions cobc/error.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2012, 2014-2022 Free Software Foundation, Inc.
Copyright (C) 2001-2012, 2014-2023 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch
This file is part of GnuCOBOL.
Expand Down Expand Up @@ -860,8 +860,11 @@ cb_syntax_check_x (cb_tree x, const char *fmt, ...)
}

/**
* verify if the given compiler option is supported by the current std/configuration
* verify if the given compiler option is supported by the current
* std/configuration/command line options;
* \param x tree whose position is used for raising warning/errors
* \param tag feature checked
* \param feature text variant, used for warning/error messages
* \return 1 = ok/warning/obsolete, 0 = skip/ignore/error/unconformable
*/
unsigned int
Expand Down Expand Up @@ -915,8 +918,12 @@ cb_verify_x (const cb_tree x, const enum cb_support tag, const char *feature)
}

/**
* verify if the given compiler option is supported by the current std/configuration
* current position is used for raising warning/errors
* verify if the given compiler option is supported by the current
* std/configuration/command line options;
* current position is used for raising warning/errors,
*
* \param tag feature checked
* \param feature text variant, used for warning/error messages
* \returns 1 = ok/warning/obsolete, 0 = skip/ignore/error/unconformable
*/
unsigned int
Expand Down
53 changes: 24 additions & 29 deletions cobc/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,24 +1604,8 @@ validate_usage (struct cb_field * const f)
{
cb_tree x = CB_TREE (f);

if (f->storage == CB_STORAGE_REPORT
&& f->usage != CB_USAGE_DISPLAY
&& f->usage != CB_USAGE_NATIONAL) {
cb_error_x (CB_TREE(f),
_("%s item '%s' should be USAGE DISPLAY"),
enum_explain_storage (f->storage), cb_name (x));
return 1;
}

if (f->storage == CB_STORAGE_SCREEN
&& f->usage != CB_USAGE_DISPLAY
&& f->usage != CB_USAGE_NATIONAL
&& f->usage != CB_USAGE_CONTROL) {
cb_error_x (CB_TREE(f),
_("%s item '%s' should be USAGE DISPLAY"),
enum_explain_storage (f->storage), cb_name (x));
return 1;
}
/* note: we check for "only accaptable USAGE" for SCREEN and REPORT SECTION
indirectly in the parser (we used to check for DISPLAY here) */

switch (f->usage) {
case CB_USAGE_BINARY:
Expand Down Expand Up @@ -1687,7 +1671,7 @@ validate_justified_right (const struct cb_field * const f)
&& f->pic->category != CB_CATEGORY_ALPHANUMERIC
&& f->pic->category != CB_CATEGORY_BOOLEAN
&& f->pic->category != CB_CATEGORY_NATIONAL) {
cb_error_x (x, _("'%s' cannot have JUSTIFIED RIGHT"), cb_name (x));
cb_error_x (x, _("'%s' cannot have JUSTIFIED RIGHT clause"), cb_name (x));
}
}

Expand Down Expand Up @@ -1860,15 +1844,17 @@ error_value_figurative_constant(const struct cb_field * const f)
{
cb_tree first_value = get_first_value (f);
if (first_value && cb_is_figurative_constant (first_value)) {
cb_error_x (CB_TREE (f), _("VALUE may not contain a figurative constant"));
cb_error_x (CB_TREE (f),
_("VALUE may not contain a figurative constant"));
}
}

static void
error_both_full_and_justified (const struct cb_field * const f)
{
if ((f->screen_flag & COB_SCREEN_FULL) && f->flag_justified) {
cb_error_x (CB_TREE (f), _("cannot specify both FULL and JUSTIFIED"));
cb_error_x (CB_TREE (f),
_("cannot specify both %s and %s"), "FULL", "JUSTIFIED");
}
}

Expand All @@ -1880,8 +1866,8 @@ warn_from_to_using_without_pic (const struct cb_field * const f)
const cb_tree x = CB_TREE (f);
/* TO-DO: Change to dialect option */
cb_warning_x (cb_warn_additional, x,
_("'%s' has FROM, TO or USING without PIC; PIC will be implied"),
cb_name (x));
_("'%s' has FROM, TO or USING without PIC; PIC will be implied"),
cb_name (x));
/* TO-DO: Add setting of PIC below here or move warnings to the code which sets the PIC */
return 1;
} else {
Expand All @@ -1897,8 +1883,8 @@ warn_pic_for_numeric_value_implied (const struct cb_field * const f)
const cb_tree x = CB_TREE (f);
/* TO-DO: Change to dialect option */
cb_warning_x (cb_warn_additional, x,
_("'%s' has numeric VALUE without PIC; PIC will be implied"),
cb_name (x));
_("'%s' has numeric VALUE without PIC; PIC will be implied"),
cb_name (x));
/* TO-DO: Add setting of PIC below here or move warnings to the code which sets the PIC */
return 1;
} else {
Expand All @@ -1910,7 +1896,7 @@ static void
error_both_pic_and_value (const struct cb_field * const f)
{
if (f->pic && f->values) {
cb_error_x (CB_TREE (f), _("cannot specify both PIC and VALUE"));
cb_error_x (CB_TREE (f), _("cannot specify both %s and %s"), "PIC", "VALUE");
}
}

Expand Down Expand Up @@ -3084,6 +3070,12 @@ compute_size (struct cb_field *f)
f->size++;
}
break;
case CB_USAGE_NATIONAL:
if (f->pic == NULL) {
break;
}
f->size = f->pic->size * COB_NATIONAL_SIZE;
break;
case CB_USAGE_PACKED:
if (f->pic == NULL)
break;
Expand Down Expand Up @@ -3144,8 +3136,9 @@ compute_size (struct cb_field *f)
break;
/* LCOV_EXCL_START */
default:
cobc_err_msg (_("unexpected USAGE: %d"),
(int)f->usage);
/* as this is an unexpected message, only for requested reports,
leave untranslated */
cobc_err_msg ("unexpected USAGE: %d", (int)f->usage);
COBC_ABORT ();
/* LCOV_EXCL_STOP */
}
Expand Down Expand Up @@ -3764,7 +3757,9 @@ cb_get_usage_string (const enum cb_usage usage)
return "CONTROL";
/* LCOV_EXCL_START */
default:
cb_error (_("unexpected USAGE: %d"), usage);
/* as this is an unexpected message, only for requested reports,
leave untranslated */
cb_error ("unexpected USAGE: %d", usage);
COBC_ABORT ();
/* LCOV_EXCL_STOP */
}
Expand Down
15 changes: 8 additions & 7 deletions cobc/flag.def
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,13 @@ CB_FLAG_NQ (1, "callfh", 9,
CB_FLAG_NQ (1, "sqlschema", 11, /* stored in cb_sqldb_schema */
_(" -fsqlschema=<name> define database schema name"))

/* note: suppressed help to have it local to --debug */
/* note: suppressed help and no translation here to have it local to --debug
FIXME: find a better way to handle that */
CB_FLAG_NQ (0, "ec", 14,
_(" -fec=<exception-name>\tenable code generation for <exception-name>,\n"
" sets -fsource-location"))
" -fec=<exception-name>\tenable code generation for <exception-name>,\n"
" sets -fsource-location")
CB_FLAG_NQ (0, "no-ec", 17,
_(" -fno-ec=<exception-name>\tdisable code generation for <exception-name>"))
" -fno-ec=<exception-name>\tdisable code generation for <exception-name>")

CB_FLAG_NQ (1, "ebcdic-table", 16,
_(" -febcdic-table=<cconv-table>/<file>\tEBCDIC/ASCII translation table\n"
Expand Down Expand Up @@ -122,7 +123,7 @@ CB_FLAG (cb_flag_stack_on_heap, 0, "stack-on-heap",

CB_FLAG (cb_flag_stack_extended, 1, "stack-extended",
_(" -fstack-extended store origin of entrypoints and PERFORM\n"
" * turned on by -debug/-dump"))
" * turned on by --debug/-fdump"))

CB_FLAG_ON (cb_flag_fast_math, 0, "fast-math",
_(" -ffast-math Disables emitting faster arithmetic logic"))
Expand Down Expand Up @@ -156,7 +157,7 @@ CB_FLAG (cb_flag_debugging_line, 1, "debugging-line",

CB_FLAG (cb_flag_source_location, 1, "source-location",
_(" -fsource-location generate source location code\n"
" * turned on by -debug/-ftraceall/-fec/-dump"))
" * turned on by --debug/-ftraceall/-fec/-fdump"))

CB_FLAG (cb_flag_implicit_init, 1, "implicit-init",
_(" -fimplicit-init automatic initialization of the COBOL runtime system"))
Expand All @@ -167,7 +168,7 @@ CB_FLAG_ON (cb_flag_recursive_check, 1, "recursive-check",

CB_FLAG (cb_flag_stack_check, 1, "stack-check",
_(" -fstack-check PERFORM stack checking\n"
" * turned on by -debug/-g"))
" * turned on by --debug/-g"))

CB_FLAG (cb_flag_section_exit_check, 1, "section-exit-check",
_(" -fsection-exit-check check that code execution does not leave the scope of SECTIONs"))
Expand Down
11 changes: 7 additions & 4 deletions cobc/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ cobc_print_usage (char * prog)
"or (preferably) use the issue tracker via the home page."),
"[email protected]");
putchar ('\n');
puts (_("GnuCOBOL home page: <https://www.gnu.org/software/gnucobol/>"));
puts (_("General help using GNU software: <https://www.gnu.org/gethelp/>"));
printf (_("GnuCOBOL home page: <%s>"), "https://www.gnu.org/software/gnucobol/");
putchar ('\n');
printf (_("General help using GNU software: <%s>"), "https://www.gnu.org/gethelp/");
putchar ('\n');
}

void
Expand Down Expand Up @@ -84,13 +86,14 @@ cobc_print_usage_common_options (void)
" see configuration files in directory config"));
puts (_(" -F, --free use free source format (alias for -fformat=free)"));
puts (_(" --fixed use fixed source format (default; alias for\n"
" -fformat=fixed)"));
" -fformat=fixed)"));
puts (_(" -O, -O2, -O3, -Os enable optimization"));
puts (_(" -O0 disable optimization"));
puts (_(" -g enable C compiler debug and stack check"));
puts (_(" -d, --debug enable all run-time error checking,\n"
" equal to -fstack-check -fec=EC-ALL"));
/* duplicated here from flags.def to place it next to -debug */
/* "duplicated" from flags.def where output is suppressed and untranslated,
to place it next to --debug in the help output */
puts (_(" -fec=<exception-name>\tenable code generation for <exception-name>,\n"
" see --list-exceptions for the possible values,\n"
" sets -fsource-location"));
Expand Down
Loading

0 comments on commit 93543a9

Please sign in to comment.