]> git.ipfire.org Git - thirdparty/gcc.git/commit
cobol: Auto-detect source format; some FldLiteralN; infer gcobc name. [PR119337]
authorRobert Dubner <rdubner@symas.com>
Sat, 10 May 2025 22:05:29 +0000 (18:05 -0400)
committerRobert Dubner <rdubner@symas.com>
Sat, 10 May 2025 22:49:13 +0000 (18:49 -0400)
commita3f5aac402a7ef721e1e832f96ed77ec21f5a25c
treec5c841cca818dfaf7555daa1751ddf1d9a00d580
parentba9d228a92057d3b839e7ea32b12c93fcfc5ff1e
cobol: Auto-detect source format; some FldLiteralN; infer gcobc name. [PR119337]

This commit includes changes to the parser's auto-detection heuristic for source
code formatting.  The heuristic now examines the line containing "program-id" to
determine whether the code is in ISO "fixed-form reference format", or ISO
"free-form reference format", or the IBM "extended source format".

Changes to the parser also changes to token processing.

On the code generation side, there are some changes that begin to process
numeric literals in order generate more efficient code using information known
at compilation time.

gcc/cobol/ChangeLog:

PR cobol/119337

* Make-lang.in: Change how $(FLEX) is invoked.
* cdf.y: Change parser tokens.
* gcobc: Changed how name is inferred for PR119337
* gcobol.1: Documentation for SOURCE format heuristic
* genapi.cc: Eliminate __gg__odo_violation.
(parser_display_field): Change comment.
* genutil.cc:Eliminate __gg__odo_violation.
(REFER): New macro for analyzing subscript/refmod calculations.
(get_integer_value): Likewise.
(get_data_offset): Eliminate __gg__odo_violation.
(scale_by_power_of_ten_N): Eliminate unnecessary var_decl_rdigits operation.
(refer_is_clean): Check for FldLiteralN.
(REFER_CHECK): Eliminate.
(refer_refmod_length): Streamline var_decl_rdigits processing.
(refer_fill_depends): Likewise.
(refer_offset): Streamline processing when FldLiteralN.
(refer_size): Tag with REFER macro.
(refer_size_dest): Likewise.
(refer_size_source): Likewise.
* genutil.h (get_integer_value): Delete declaration for odo_violation;
change comment for get_integer_value
(REFER_CHECK): Delete declaration.
(refer_check): Delete #define.
* lexio.cc (is_fixed_format): Changes for source format auto-detect.
(is_reference_format): Likewise.
(check_source_format_directive): Likewise.
(valid_sequence_area): Likewise.
(is_p): Likewise.
(is_program_id): Likewise.
(likely_nist_file): Likewise.
(infer_reference_format): Likewise.
(cdftext::free_form_reference_format): Likewise.
* parse.y: Token changes.
* parse_ante.h (class tokenset_t):  Likewise.
(class current_tokens_t):  Likewise.
(cmd_or_env_special_of): Likewise.
* scan.l:  Likewise.
* scan_ante.h (bcomputable): Likewise.
(keyword_alias_add): Likewise.
(struct bint_t): Likewise.
(binary_integer_usage): Likewise.
(binary_integer_usage_of): Likewise.
* scan_post.h (start_condition_str): Likewise.
* symbols.cc (symbol_table_init): Formatting.
* symbols.h (struct cbl_field_data_t): Add "input" method to field_data_t.
(keyword_alias_add): Add forward declaration.
(binary_integer_usage_of): Likewise.
* token_names.h: Change list of tokens.
* util.cc (iso_cobol_word): Change list of COBOL reserved words.

libgcobol/ChangeLog:

* common-defs.h (ec_cmp): Delete "getenv("match_declarative")" calls.
(enabled_exception_match): Delete "getenv("match_declarative")" calls.
* libgcobol.cc: Eliminate __gg__odo_violation.

gcc/testsuite/ChangeLog:

* cobol.dg/group1/simple-if.cob: Make explicitly >>SOURCE FREE
20 files changed:
gcc/cobol/Make-lang.in
gcc/cobol/cdf.y
gcc/cobol/gcobc
gcc/cobol/gcobol.1
gcc/cobol/genapi.cc
gcc/cobol/genutil.cc
gcc/cobol/genutil.h
gcc/cobol/lexio.cc
gcc/cobol/parse.y
gcc/cobol/parse_ante.h
gcc/cobol/scan.l
gcc/cobol/scan_ante.h
gcc/cobol/scan_post.h
gcc/cobol/symbols.cc
gcc/cobol/symbols.h
gcc/cobol/token_names.h
gcc/cobol/util.cc
gcc/testsuite/cobol.dg/group1/simple-if.cob
libgcobol/common-defs.h
libgcobol/libgcobol.cc