Skip to content

Commit

Permalink
Merged revisions 4628, 4630-4635, 4637-4639, 4644-4646, 4652, 4653, 4…
Browse files Browse the repository at this point in the history
…655-4658, 4663 from branches/gnucobol-3.x:

........
build_windows: adjusted svn properties (global-ignores instead of single ones)
........
preparation for CANCEL ALL [feature-requests:#164]

runtime part mostly missing, too much effort for now, compiler part finished
........
minor cleanup related to resolving COBOL modules

* bin/cobcrun.c: no module name check (done in libcob now)
* libcob/call.c:
  * (cob_resolve_internal): added check for module name length, fixed compiler warnings
  * call.c (cob_call): switched argument table from dynamic allocation to stack allocation
fixed [bugs:#844] stack-based buffer overflow found with fuzzing

cobc/tree.c (literal_for_diagnostic): fixed #844 stack-based buffer overflow
........
follow-up to [r4625] "move of defaultbyte from flag to dialect option"

NEWS entry added

cobc:
* config.def, config.c: changed defaultbyte option from "INT" to ANY" with explicit check for "init" (GnuCOBOL default behavior, in r4625 as "ignore", now also allowing to set it after it was set different) and "none" (in preparation of missing feature, for now => implicit 0)

config:
* set defaultbyte to "none" for standard COBOL, 32 to " "
........
literal handling overhaul, first time working national literals

cobc:
* scanner.l (read_literal): do the necessary conversion for national literals (simple approach, only working with source in iso-8859-15 or plain ascii)
* typeck.c (get_value): return correct numeric value for national (utf16) literals
* tree.c (cb_build_intrinsic): fixed optimized length generation for national fields and literals
* typeck.c (cb_validate_program_environment): refactored, reducing variable scope and extracted (validate_alphabet) and (check_class_duplicates); call the later depending on cb_warn_additional, no need to test if the final result is ignored
* typeck.c (validate_alphabet): adjustments for national literals, now partially supported
* scanner.l: moved static literal_error to local variable, passing it (to error_literal); return a valid literal in case of literal errors (intead of cb_error_node) to prevent spurious follow-up errors on their use
........
follow-up to [r4625] "move of defaultbyte from flag to dialect option"

config:
* ibm-strict.conf, mvs-strict.conf, gcos-strict.conf, bs2000-strict.conf: adjusted defaultbyte to 0
........
Merged revisions 4548-4549,4553-4554,4624-4625 from trunk:

Fix for BIT-WISE ops on Bigendian
........
added test for internal initialize for WORKING-STORAGE - revival of [bugs:#694]
........
Fix codegen issues
........
Fix for WORKING Initialize with OCCURS/VALUE
........
Improve INITIALIZE - more later
........
Move defaultbyte from flag.def to config.def
........
add preliminary support for DEFAULT SECTION

cobc:
* pplex.l, parser.y: parse DISPLAY and ACCEPT statements in DEFAULT SECTION (GCOS 7 extension)
........
add support for more source formats

[feature-requests:#29] support for ACUCOBOL-GT Terminal format
[feature-requests:#230] support for X/Open Free-form format

* NEWS: added news entry for source formats
* configure.ac: check for __attribute__((pure))

cobc:
* cobc.h, cobc.c: extend cb_format enum with VARIABLE, TERMINAL, XOPEN, XCARD, CRT, and COBOLX source formats
* cobc.c, flag.def: add new flag -fformat
* ppparse.y: extend SOURCEFORMAT directive
* cobc.h, cobc.c, pplex.l (cobc_get_indicator_column, cobc_get_text_column, cobc_get_indicator, cobc_get_margin_a, cobc_get_margin_b): encapsulate source format-related variables with pure functions
* cobc.c: drop source format-related macros
* cobc.h, pplex.l (cobc_deciph_source_format, cobc_set_source_format, cobc_get_source_format): encapsulate source format configuration into preprocessor lexer
* pplex.l (ppinput): add support for ACU terminal and X/Open indicators, as well as floating margin B
* pplex.l (check_listing): do not output sequence number of short lines
* cobc.h: define function purity attribute COB_A_PURE
* cobc.c (cobc_print_info): silence a warning with string indexing

doc:
* gnucobol.texi: document newly supported source formats
........
add support for CONTROL DIVISION (with SUBSTITUTION SECTION only)

cobc:
* pplex.l, ppparse.y: add support for CONTROL DIVISION (GCOS 7 extension); only SUBSTITUTION SECTION is handled yet
* config.def: new control-division option

config:
* general: added option control-division
........
compiler speedup

cobc/field.c.c (cb_resolve_redefines): always search candidate with (small) word list first, instead of checking the complete parent for a same name with case-insensitive name comparison
........
fixed syntax check for DISPLAY AT

cobc/typeck.c (numeric_children_screen_pos_type): ignore redefined fields
........
allow DEPENDING clause in RECORD CONTAINS

cobc:
* config.def, parser.y: allow DEPENDING clause in RECORD CONTAINS

config:
* general: added option record-contains-depending-clause

Co-authored-by: David Declerck <[email protected]>
........
add GCOS-specific device name mnemonics

cobc:
* config.def, typeck.c (cb_emit_accept_name, cb_build_display_name): rely on new option device-mnemonics (boolean) instead of standard-define to accept device name mnemonics for DISPLAY and ACCEPT
* parser.y, reserved.c, scanner.l, typeck.c: add GCOS-specific mnemonics ALTERNATE-CONSOLE, ALTERNATE CONSOLE and TERMINAL

config:
* general: added config option device-mnemonics (boolean)

Co-athored-by: David Declerck <[email protected]>
........
libcob/strings.c (cob_unstring_into): minor performance-tweak for UNSTRING with a single DELIMITED BY phrase
........
parse WITH CONVERSION clause for DISPLAY statement

cobc:
* parser.y: allow the WITH CONVERSION clause right after DISPLAY (ignored)

Co-authored-by: David Declerck <[email protected]>
........
[feature-requests:#137] support literal operands in partial replacing phrases

cobc:
* ppparse.y (literal_token): support SPACE or SPACES figurative constant as second operand of partial replacing phrases
* pplex.l, ppparse.y, config.h: support COPY and REPLACE statements with partial REPLACING operands specified using literals
* config.def: new option partial-replacing-with-literal
* cobc.h, pplex.l (ppparse_verify): feature verification while in ppparse.y
* pplex.l (ppparse_error): shift newline counter by one when reporting an error when in ppparse.y

config:
* general: added option partial-replacing-with-literal
........
factorize some code in the compiler

cobc:
* ppparse.y (unquote, fix_filename): factorize code for unquotation of alphanumeric literals
........
add support for the STOP ERROR statement

config:
* general: add a stop-error-statement option

cobc:
* config.def, parser.y: add support for the STOP ERROR statement

libcob:
* common.c, common.h (cob_stop_error): new function for STOP ERROR statement

Co-authored-by: Fabrice Le Fessant <[email protected]>
........
  • Loading branch information
ddeclerck committed Jun 20, 2024
1 parent 4c1e43f commit b6c64f2
Show file tree
Hide file tree
Showing 53 changed files with 2,421 additions and 801 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@

* configure.ac: check for PDC_free_memory_allocations

2022-07-06 Nicolas Berthier <[email protected]>

* configure.ac: Check for __attribute__((pure))

2022-06-21 Simon Sobisch <[email protected]>

* configure.ac: always build INDEXED handlers as separate libraries,
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ Open Plans:
** in 64-bit environments, the maximum field size was increased from
268435456 bytes (999999998 bytes for OCCURS UNBOUNDED) to 2 GB

** the call-stack on error / in the dump file now contains all parameters given
to the program via command line options, if any

** in case of any runtime features being used that are not available an error
is generated during compile (may be reduced to a warning by -Wunsupported
or be suppressed by -Wno-unsupported) and if the feature is actually used
Expand Down
4 changes: 4 additions & 0 deletions bin/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* cobfile.c: fixed compiler warnings -Wunused-result
* cobfile.c: handle --quiet to output less progress info

2022-07-15 Simon Sobisch <[email protected]>

* cobcrun.c: no module name check (done in libcob now)

2022-06-28 Simon Sobisch <[email protected]>

* cobcrun.c: added -dumpversion (called from libcob)
Expand Down
25 changes: 12 additions & 13 deletions bin/cobcrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,24 +419,23 @@ main (int argc, char **argv)
return 1;
}

if (strlen (argv[arg_shift]) > COB_MAX_NAMELEN) {
/* note: we allow up to COB_MAX_WORDLEN for relaxed syntax... */
fprintf (stderr, _("%s: PROGRAM name exceeds %d characters"), argv[0], COB_MAX_NAMELEN);
putc ('\n', stderr);
fflush (stderr);
return 1;
}

/* Initialize the COBOL system, resolve the PROGRAM name */
/* and invoke, wrapped in a STOP RUN, if found */
/* note: we use cob_init_nomain here as there are no functions */
/* linked here we want to provide for the COBOL environment */
/* Initialize the COBOL system, ... */
/* Note: we use cob_init_nomain here as there are no functions
linked here we want to provide for the COBOL environment */
cob_init_nomain (argc - arg_shift, &argv[arg_shift]);
if (print_runtime_wanted) {
print_runtime_conf ();
putc ('\n', stdout);
}
/* Note: cob_resolve_cobol takes care for call errors, no need to check here */
/* ... verify and resolve the PROGRAM name, ... */
/* Note: cob_resolve_cobol takes care for call errors,
because of the last parameter; no need to check here afterwards;
another program may use "0" and check for function pointer != NULL */
unifunc.funcvoid = cob_resolve_cobol (argv[arg_shift], 0, 1);

/* ... then invoke, wrapped in a STOP RUN */
/* Note: we requested a program exit if resolving had issues,
so are only still running if we have a a valid, _likely_ COBOL
function to execute */
cob_stop_run (unifunc.funcint());
}
160 changes: 147 additions & 13 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,74 @@
* tree.c (cb_build_picture), tree.h: return cb_picture instead of cb_tree
as all but one caller directly use it that way

2022-07-14 Matthew Remacle <[email protected]>

* tree.c (literal_for_diagnostic): fixed #844 stack-based buffer overflow

2022-07-14 Simon Sobisch <[email protected]>

* config.def, config.c: changed defaultbyte option from "INT" to ANY"
with explicit check for "init" (GnuCOBOL default behavior, now also
allowing to set it after it was set different) and "none" (in
preparation of missing feature, for now => implicit 0)

2022-07-12 Simon Sobisch <[email protected]>

* scanner.l (read_literal): do the necessary conversion for national
literals (simple approach, only working with source in iso-8859-15
or plain ascii)
* typeck.c (get_value): return correct numeric value for national
(utf16) literals
* tree.c (cb_build_intrinsic): fixed optimized length generation for
national fields and literals
* typeck.c (cb_validate_program_environment): refactored,
reducing variable scope and extracted (validate_alphabet) and
(check_class_duplicates); call the later depending on
cb_warn_additional, no need to test if the final result is ignored
* typeck.c (validate_alphabet): adjustments for national literals,
now partially supported
* scanner.l: moved static literal_error to local variable,
passing it (to error_literal); return a valid literal in case of
literal errors (intead of cb_error_node) to prevent spurious
follow-up errors on their use

2022-07-08 Simon Sobisch <[email protected]>

* parser.y (cancel_body): preparation for CANCEL ALL

2022-07-06 Nicolas Berthier <[email protected]>

* cobc.h: define function purity attribute COB_A_PURE
* cobc.h, cobc.c, pplex.l (cobc_get_indicator_column,
cobc_get_text_column, cobc_get_indicator, cobc_get_margin_a,
cobc_get_margin_b): encapsulate source format-related variables with
pure functions
* cobc.c: drop source format-related macros
* cobc.c (cobc_print_info): silence a warning with string indexing

2022-07-05 Nicolas Berthier <[email protected]>

* pplex.l, parser.y: parse DISPLAY and ACCEPT statements in DEFAULT
SECTION (GCOS 7 extension)

2022-07-04 Nicolas Berthier <[email protected]>

FR #29 support for ACUCOBOL-GT Terminal format
FR #230 support for X/Open Free-form format
* cobc.h, cobc.c: extend cb_format enum with VARIABLE, TERMINAL, XOPEN,
XCARD, CRT, and COBOLX source formats
* ppparse.y: extend SOURCEFORMAT directive
* cobc.c: drop IS_DEBUG_LINE macro to improve support for new source
formats
* cobc.c, flag.def: add new flag -fformat and remove flag
indicator-column
* cobc.h, pplex.l (cobc_deciph_source_format, cobc_set_source_format,
cobc_get_source_format): encapsulate source format configuration into
preprocessor lexer
* pplex.l (ppinput): add support for ACU terminal and X/Open indicators,
as well as floating margin B
* pplex.l (check_listing): do not output sequence number of short lines

2022-07-01 Simon Sobisch <[email protected]>

* field.c (validate_blank_when_zero): iterate over pic->str
Expand All @@ -257,18 +325,34 @@

* cobc.c, help.c: added -dumpversion

2022-06-27 Simon Sobisch <[email protected]>

* typeck.c (numeric_children_screen_pos_type): ignore redefined
fields
* field.c (cb_resolve_redefines): always search candidate with (small)
word list first, instead of checking the complete parent for a same
name with case-insensitive name comparison

2022-06-24 Nicolas Berthier <[email protected]>

* cobc.c, config.def, flag.def, ppparse.y: requalify indicator-column as
a flag instead of a dialect option

2022-06-17 Nicolas Berthier <[email protected]>

* config.def, typeck.c (cb_emit_accept_name, cb_build_display_name):
rely on new option device-mnemonics (boolean) instead of
standard-define to accept device name mnemonics for DISPLAY and ACCEPT

2022-06-10 Ron Norman <[email protected]>

* flag.def,config.def : Moved defaultbyte from flag to config
* cobc.h,help.c,codegen.c : Add define CB_CONFIG_SINT as signed 'int'
* config.c (cb_config_entry): for CB_INT check for a single character
Also check for word 'ignore' and make no changes

2022-06-10 Ron Norman <[email protected]>

* codegen.c : Improvement of code emitted for INITIALIZE of tables
Initial table values, then clear next,
then propagate through remainder of the table
Initial table values, then clear next,
then propagate through remainder of the table

2022-05-31 Simon Sobisch <[email protected]>

Expand Down Expand Up @@ -319,6 +403,11 @@
* cobc.c (process_translate) [HAVE_8DOT3_FILENAMES]: fixed
missing variable definition

2022-03-29 Nicolas Berthier <[email protected]>

* ppparse.y (literal_token): support SPACE or SPACES figurative
constant as second operand of partial replacing phrases

2022-03-28 Ron Norman <[email protected]>

* cobc.c : Added calls to cobc_getenv_path which will check for
Expand All @@ -335,6 +424,10 @@
* tree.c (cb_init_parse_constants), tree.h, cobc.c: renamed
from cb_init_constants

2022-03-11 Fabrice Le Fessant <[email protected]>

* config.def, parser.y: add support for the STOP ERROR statement

2022-03-10 Simon Sobisch <[email protected]>

* pplex.l (next_word_is_comment_paragraph_name): extracted from (ppinput)
Expand Down Expand Up @@ -389,15 +482,57 @@
* codegen.c: removed check for "has condition a reference" or disabled
this within [COB_TREE_DEBUG]

2022-02-07 David Declerck <[email protected]>

* config.def, parser.y: allow DEPENDING clause in RECORD CONTAINS

2022-02-06 Ron Norman <[email protected]>

* codegen.c: if verb changes then emit trace/debug code, too

2022-02-04 David Declerck <[email protected]>

* cobc.c, cobc.h, config.def, pplex.l, ppparse.y: make the
indicator column configurable

2022-02-04 David Declerck <[email protected]>

* parser.y, reserved.c, scanner.l, typeck.c: Add GCOS-specific mnemonics
ALTERNATE-CONSOLE, ALTERNATE CONSOLE and TERMINAL

2022-02-04 David Declerck <[email protected]>

* parser.y: allow the WITH CONVERSION clause right after DISPLAY (ignored)

2022-01-28 Fabrice Le Fessant <[email protected]>

* warning.def, pplex.l: split warning for missing newlines, it now
can be disabled by -Wno-missing-newline instead of -Wno-others

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

* typeck.c (cb_emit_write): changed configuration check and warning
for cb_sequential_advancing to dialect variant

2022-01-27 Nicolas Berthier <[email protected]>

* pplex.l, ppparse.y: add support for CONTROL DIVISION (GCOS 7
extension); only SUBSTITUTION SECTION is handled yet
* config.def: new control-division option

2022-01-25 Nicolas Berthier <[email protected]>

* pplex.l, ppparse.y, config.h: support COPY and REPLACE
statements with partial REPLACING operands specified using
literals
* config.def: new option partial-replacing-with-literal
* cobc.h, pplex.l (ppparse_verify): feature verification while in
ppparse.y
* pplex.l (ppparse_error): shift newline counter by one when
reporting an error when in ppparse.y
* ppparse.y (unquote, fix_filename): factorize code for
unquotation of alphanumeric literals

2022-01-25 Ron Norman <[email protected]>

* field.c: Check that COMP-X size does not exceed what is supported
Expand Down Expand Up @@ -550,7 +685,6 @@
WRITE ADVANCING was used then default to LINE SEQUENTIAL
* typeck.c: If ORGANIZATION not specific and WRITE ADVANCING default
to LINE SEQUENTIAL based on 'record-sequential-advancing'


2021-11-08 Ron Norman <[email protected]>

Expand Down Expand Up @@ -4804,7 +4938,7 @@

* tree.c (cb_name_1): output name for USER FUNCTIONs

2017-01-11 M�rio Matos <[email protected]>
2017-01-11 Mário Matos <[email protected]>

* codegen.c (output_entry_function):
fixed bug #349 (compatibility for C89 / _MSC_VER < 1800) - moved
Expand Down Expand Up @@ -6637,11 +6771,11 @@
* parser.y, reserved.c, typeck.c: Added parser support for OCCURS DYNAMIC
along with CAPACITY clause as not implemented

2014-09-08 Philipp B�hme <[email protected]>
2014-09-08 Philipp Böhme <[email protected]>

* cobc.c (process) [_MSC_VER]: bugfix in output filter

2014-09-03 Philipp B�hme <[email protected]>
2014-09-03 Philipp Böhme <[email protected]>

* cobc.c, cobc.h: added cobc_free() function
(Own freeing functions for debugging purposes.
Expand Down Expand Up @@ -6689,11 +6823,11 @@
* pplex.l: fixed bug #86 whitespace handling for IDENTIFICATION DIVISION
and DEBUGGING MODE

2014-07-10 Philipp B�hme <[email protected]>
2014-07-10 Philipp Böhme <[email protected]>

* typeck.c (cb_emit_sort_init): calculation of table key offset fixed

2014-07-02 Philipp B�hme <[email protected]>
2014-07-02 Philipp Böhme <[email protected]>

* cobc.c [_MSC_VER]: filter output of cl.exe (instead of redirecting to
NUL), errors are printed in non-verbose mode now; new: (read_buffer_line)
Expand Down Expand Up @@ -6732,7 +6866,7 @@

* parser.y: Added extension "USE AT PROGRAM START/END" as not implemented

2014-05-14 Philipp B�hme <[email protected]>
2014-05-14 Philipp Böhme <[email protected]>

* cobc.c: Catch and treat error when no disc space is available for
output files
Expand All @@ -6745,7 +6879,7 @@

* parser.y: Added extension "GOBACK/EXIT PROGRAM RETURNING/GIVING x"

2014-04-29 Philipp B�hme <[email protected]>
2014-04-29 Philipp Böhme <[email protected]>

* codeoptim.c: Fixed bug in COB_ADD_PACKED_INT.
Computing COMP-3 failed in MSVC-build versions,
Expand Down
Loading

0 comments on commit b6c64f2

Please sign in to comment.