aboutsummaryrefslogtreecommitdiff
path: root/gcc/cobol
AgeCommit message (Collapse)AuthorFilesLines
14 daysDaily bump.GCC Administrator1-0/+12
2025-09-05cobol: Improved handling of COBOL Special Registers.Robert Dubner3-73/+52
COBOL Special Registers (e.g., RETURN-CODE; DEBUG-ITEM) are implemented as global variables. These changes define them with the prefix "__ggsr__" in their variable names so that the GDB-COBOL debugger can identify them. The creation and handling of such variables has been streamlined with the introduction of the "register_e" cbl_field_t::attr bit. gcc/cobol/ChangeLog: * genapi.cc (trace1_init): Prepend two internal variables with underscore. (initialize_variable_internal): Use new register_e attribute. (psa_global): Use "__ggsr__" prefix to identify special registers (parser_symbol_add): Use new register_e attribute. * symbols.cc (cbl_field_attr_str): Likewise. (symbol_table_init): Likewise. (is_register_field): Eliminated in favor of (attr & register_e). * symbols.h (is_register_field): Likewise. libgcobol/ChangeLog: * common-defs.h (enum cbl_field_attr_t): Define register_e. * constants.cc (struct cblc_field_t): Define special registers with "__ggsr__" prefix.
2025-08-21Daily bump.GCC Administrator1-0/+7
2025-08-19cobol: Eliminate errors that cause valgrind messages.Robert Dubner3-2/+15
gcc/cobol/ChangeLog: * genutil.cc (get_binary_value): Fix a comment. * parse.y: udf_args_valid(): Fix loc calculation. * symbols.cc (assert): extend_66_capacity(): Avoid assert(e < e2) in -O0 build until symbol_table expansion is fixed. libgcobol/ChangeLog: * libgcobol.cc (format_for_display_internal): Handle NumericDisplay properly. (compare_88): Fix memory access error. (__gg__unstring): Likewise.
2025-08-16Daily bump.GCC Administrator1-0/+9
2025-08-15cobol: Eliminate a run-time structure type that is no longer used.Robert Dubner3-28/+0
gcc/cobol/ChangeLog: * genapi.h (parser_call_exception_end): Remove obsolete comment. * structs.cc (create_cbl_enabled_exception_t): Remove cbl_enabled_exception_type_node; remove create_cbl_enabled_exception_t(). (create_our_type_nodes): Likewise. * structs.h (GTY): Likewise.
2025-08-14Daily bump.GCC Administrator1-0/+8
2025-08-13cobol: Implement and use faster __gg__packed_to_binary() routine.Robert Dubner1-42/+18
The new routine uses table lookups more effectively, and avoids __int128 arithmetic until necessary. gcc/cobol/ChangeLog: * genutil.cc (get_binary_value): Use the new routine. libgcobol/ChangeLog: * libgcobol.cc (get_binary_value_local): Use the new routine. * stringbin.cc (int_from_string): Removed. (__gg__packed_to_binary): Implement new routine. * stringbin.h (__gg__packed_to_binary): Likewise.
2025-08-12cobol: Implement faster zoned decimal to binary conversion.Robert Dubner1-205/+51
Replace " value *= 10; value += digit" routines with a new one that does two digits at a time and avoids __int128 calculations until they are necessary. These changes also clean up the conversion behavior when a digit is not valid. gcc/cobol/ChangeLog: * genutil.cc (get_binary_value): Use the new routine. libgcobol/ChangeLog: * libgcobol.cc (int128_to_field): Use the new routine. (get_binary_value_local): Use the new routine. (format_for_display_internal): Formatting. (__gg__get_file_descriptor): Likewise. * stringbin.cc (string_from_combined): Formatting. (packed_from_combined): Likewise. (int_from_string): New routine. (__gg__numeric_display_to_binary): Likewise. * stringbin.h (__gg__numeric_display_to_binary): Likewise.
2025-08-13Daily bump.GCC Administrator1-0/+9
2025-08-11cobol: Bring EBCDIC NumericDisplay variables into IBM compliance.Robert Dubner3-346/+221
The internal representation of Numeric Display (ND) zoned decimal variables when operating in EBCDIC mode has been brought into compliance with IBM conventions. This requires changes to data input, data output, internal conversion of zoned decimal to binary, and variable assignment. gcc/cobol/ChangeLog: * genapi.cc (compare_binary_binary): Formatting. (cobol_compare): Formatting. (mh_numeric_display): Rewrite "move ND to ND" algorithm. (initial_from_initial): Proper initialization of EBCDIC ND variables. * genmath.cc (fast_add): Delete comment. * genutil.cc (get_binary_value): Modify for updated EBCDIC. libgcobol/ChangeLog: * common-defs.h (NUMERIC_DISPLAY_SIGN_BIT): New comment; new constant. (EBCDIC_MINUS): New constant. (EBCDIC_PLUS): Likewise. (EBCDIC_ZERO): Likewise. (EBCDIC_NINE): Likewise. (PACKED_NYBBLE_PLUS): Likewise. (PACKED_NYBBLE_MINUS): Likewise. (PACKED_NYBBLE_UNSIGNED): Likewise. (NUMERIC_DISPLAY_SIGN_BIT_ASCII): Likewise. (NUMERIC_DISPLAY_SIGN_BIT_EBCDIC): Likewise. (SEPARATE_PLUS): Likewise. (SEPARATE_MINUS): Likewise. (ZONED_ZERO): Likewise. (ZONE_SIGNED_EBCDIC): Likewise. * configure: Regenerate. * libgcobol.cc (turn_sign_bit_on): Handle new EBCDIC sign convention. (turn_sign_bit_off): Likewise. (is_sign_bit_on): Likewise. (int128_to_field): EBCDIC NumericDisplay conversion. (get_binary_value_local): Likewise. (format_for_display_internal): Likewise. (normalize_id): Likewise. (__gg__inspect_format_1): Convert EBCDIC negative numbers to positive. * stringbin.cc (packed_from_combined): Quell cppcheck warning. gcc/testsuite/ChangeLog: * cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out: Change test for updated handling of Numeric Display variables.
2025-08-08Daily bump.GCC Administrator1-0/+10
2025-08-07cobol: Improve binary-to-string conversion.Robert Dubner6-9/+9
COBOL often requires the conversion of binary integers to string of characters. These changes replace a naive routine that peels decimal digits from a binary value one digit at a time, with a divide-and-conquer algorithm that is twice as fast even for a couple of digits, and is about eight times faster past ten digits. Included here are some minor fixes to the lexer and parser. gcc/cobol/ChangeLog: * cbldiag.h (location_dump): Source code formatting. * parse.y: error_msg formatting. * scan.l: Remove UTF-8 character from regex pattern. * scan_ante.h (numstr_of): error_msg formatting. * show_parse.h (class ANALYZE): Suppress cppcheck error. * util.cc (cbl_field_t::report_invalid_initial_value): error_msg formatting. libgcobol/ChangeLog: * Makefile.am: Include new stringbin.cc file. * Makefile.in: Regenerated. * libgcobol.cc (__gg__power_of_ten): Improve error message. (__gg__binary_to_string): Deleted. (__gg__binary_to_string_internal): Deleted. (int128_to_field): Use new conversion routine. (__gg__move): Use new conversion routine. * stringbin.cc: New file. Implements new conversion routine. * stringbin.h: New file. Likewise.
2025-08-03Daily bump.GCC Administrator1-0/+7
2025-08-02cobol: Use %td in error_msg in 3 spotsJakub Jelinek3-5/+5
On Thu, Jul 31, 2025 at 11:33:07PM +0200, Jakub Jelinek via Gcc wrote: > > this was all described in excruciating detail in the patch submission > > > > https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687385.html > > > > and the commit message. > > Looking at that patch, the dbgmsg change looks correct (dbgmsg is > ATTRIBUTE_PRINTF_1), while the last 3 hunks are suboptimal, they should > really use %td and keep the ptrdiff_t arguments without casts. Here it is in patch form. I couldn't find other similar casts in calls to ATTRIBUTE_GCOBOL_DIAG functions. 2025-08-02 Jakub Jelinek <jakub@redhat.com> * parse.y (intrinsic): Use %td format specifier with no cast on argument instead of %ld with cast to long. * scan_ante.h (numstr_of): Likewise. * util.cc (cbl_field_t::report_invalid_initial_value): Likewise.
2025-08-02Daily bump.GCC Administrator1-0/+8
2025-08-01cobol: Minor changes to quiet cppcheck warnings. [PR119324]Robert Dubner4-10/+12
gcc/cobol/ChangeLog: PR cobol/119324 * cbldiag.h (location_dump): Inline suppression of knownConditionTrueFalse. * genapi.cc (parser_statement_begin): Combine two if() statements. * genutil.cc (get_binary_value): File-level suppression of duplicateBreak. * symbols.cc (symbol_elem_cmp): File-level suppression of duplicateBreak.
2025-08-01Daily bump.GCC Administrator1-0/+8
2025-07-31cobol: Eliminate various errors. [PR120244]Robert Dubner3-13/+25
The following coding errors were located by running extended tests through valgrind. These changes repair the errors. gcc/cobol/ChangeLog: PR cobol/120244 * genapi.cc (get_level_88_domain): Increase array size for final byte. (psa_FldLiteralA): Use correct length in build_string_literal call. * scan.l: Use a loop instead of std:transform to avoid EOF overrun. * scan_ante.h (binary_integer_usage): Use a variable-length buffer.
2025-07-26Daily bump.GCC Administrator1-0/+14
2025-07-25diagnostics: convert diagnostic_t to enum class diagnostics::kindDavid Malcolm1-12/+22
No functional change intended. gcc/ChangeLog: * Makefile.in: Replace diagnostic.def with diagnostics/kinds.def. * config/aarch64/aarch64.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * config/i386/i386-options.cc: Likewise. * config/s390/s390.cc: Likewise. * diagnostic-core.h: Replace typedef diagnostic_t with enum class diagnostics::kind in diagnostics/kinds.h and include it. * diagnostic-global-context.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostics/buffering.cc: Likewise. * diagnostics/buffering.h: Likewise. * diagnostics/context.h: Likewise. * diagnostics/diagnostic-info.h: Likewise. * diagnostics/html-sink.cc: Likewise. * diagnostic.def: Move to... * diagnostics/kinds.def: ...here and update for diagnostic_t becoming enum class diagnostics::kind. * diagnostics/kinds.h: New file, based on material in diagnostic-core.h. * diagnostics/lazy-paths.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * diagnostics/option-classifier.cc: Likewise. * diagnostics/option-classifier.h: Likewise. * diagnostics/output-spec.h: Likewise. * diagnostics/paths-output.cc: Likewise. * diagnostics/sarif-sink.cc: Likewise. * diagnostics/selftest-context.cc: Likewise. * diagnostics/selftest-context.h: Likewise. * diagnostics/sink.h: Likewise. * diagnostics/source-printing.cc: Likewise. * diagnostics/text-sink.cc: Likewise. * diagnostics/text-sink.h: Likewise. * gcc.cc: Likewise. * libgdiagnostics.cc: Likewise. * lto-wrapper.cc: Likewise. * opts-common.cc: Likewise. * opts-diagnostic.h: Likewise. * opts.cc: Likewise. * rtl-error.cc: Likewise. * substring-locations.cc: Likewise. * toplev.cc: Likewise. gcc/ada/ChangeLog: * gcc-interface/trans.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/analyzer/ChangeLog: * pending-diagnostic.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * program-point.cc: Likewise. gcc/c-family/ChangeLog: * c-common.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * c-format.cc: Likewise. * c-lex.cc: Likewise. * c-opts.cc: Likewise. * c-pragma.cc: Likewise. * c-warn.cc: Likewise. gcc/c/ChangeLog: * c-errors.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * c-parser.cc: Likewise. * c-typeck.cc: Likewise. gcc/cobol/ChangeLog: * util.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/cp/ChangeLog: * call.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * constexpr.cc: Likewise. * cp-tree.h: Likewise. * decl.cc: Likewise. * error.cc: Likewise. * init.cc: Likewise. * method.cc: Likewise. * module.cc: Likewise. * parser.cc: Likewise. * pt.cc: Likewise. * semantics.cc: Likewise. * typeck.cc: Likewise. * typeck2.cc: Likewise. gcc/d/ChangeLog: * d-diagnostic.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/fortran/ChangeLog: * cpp.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * error.cc: Likewise. * options.cc: Likewise. gcc/jit/ChangeLog: * dummy-frontend.cc: Update for diagnostic_t becoming enum class diagnostics::kind. gcc/m2/ChangeLog: * gm2-gcc/m2linemap.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * gm2-gcc/rtegraph.cc: Likewise. gcc/rust/ChangeLog: * backend/rust-tree.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * backend/rust-tree.h: Likewise. * resolve/rust-ast-resolve-expr.cc: Likewise. * resolve/rust-ice-finalizer.cc: Likewise. * resolve/rust-ice-finalizer.h: Likewise. * resolve/rust-late-name-resolver-2.0.cc: Likewise. gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update for diagnostic_t becoming enum class diagnostics::kind. * gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise. * gcc.dg/plugin/location_overflow_plugin.cc: Likewise. * lib/gcc-dg.exp: Likewise. libcpp/ChangeLog: * internal.h: Update comment for diagnostic_t becoming enum class diagnostics::kind. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: rename diagnostic_option_id to diagnostics::option_id and move ↵David Malcolm1-1/+1
to its own header No functional change intended. gcc/c-family/ChangeLog: * c-common.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. * c-common.h: Likewise. * c-cppbuiltin.cc: Likewise. * known-headers.cc: Likewise. * known-headers.h: Likewise. gcc/c/ChangeLog: * c-decl.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. * c-errors.cc: Likewise. * c-tree.h: Likewise. gcc/cobol/ChangeLog: * util.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. gcc/cp/ChangeLog: * cp-tree.h: Update for renaming of diagnostic_option_id to diagnostics::option_id. * decl.cc: Likewise. * error.cc: Likewise. * name-lookup.cc: Likewise. gcc/ChangeLog: * diagnostic-core.h: Include "diagnostics/option-id.h". (struct diagnostic_option_id): Move there, renaming to diagnostics::option_id. * diagnostic-global-context.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostics/context.h: Likewise. * diagnostics/diagnostic-info.h: Likewise. * diagnostics/lazy-paths.cc: Likewise. * diagnostics/option-classifier.cc: Likewise. * diagnostics/option-classifier.h: Likewise. * diagnostics/option-id.h: New file, taken from material in diagnostic-core.h. * diagnostics/selftest-context.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. * diagnostics/selftest-context.h: Likewise. * ipa-pure-const.cc: Likewise. * lto-wrapper.cc: Likewise. * opts-common.cc: Likewise. * opts-diagnostic.h: Likewise. * opts.cc: Likewise. * substring-locations.cc: Likewise. * substring-locations.h: Likewise. gcc/fortran/ChangeLog: * cpp.cc: Update for renaming of diagnostic_option_id to diagnostics::option_id. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25diagnostics: move diagnostic_metadata to diagnostics::metadataDavid Malcolm1-8/+0
renamed: gcc/diagnostic-metadata.h -> gcc/diagnostics/metadata.h No functional change intended. gcc/analyzer/ChangeLog: * diagnostic-manager.cc: Update for move of diagnostic_metadata to diagnostics::metadata. * kf.cc: Likewise. * pending-diagnostic.h: Likewise; also, update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h". gcc/cobol/ChangeLog: * util.cc: Remove redundant #includes gcc/ChangeLog: * diagnostic-core.h: Update for move of diagnostic_metadata to diagnostics::metadata. * diagnostic-format-html.cc: Likewise; also, update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h". * diagnostic-format-sarif.cc: Likewise. * diagnostic-format-text.cc: Likewise. * diagnostic-global-context.cc: Likewise. * diagnostic.cc: Likewise. * diagnostic.h: Likewise. * diagnostic-metadata.h: Move to... * diagnostics/metadata.h: ...here, updating header guard. (class diagnostic_metadata): Move to... (class diagnostics::metadata): ...here. Drop redundant "diagnostics::" qualifiers. * libgdiagnostics.cc: : Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h", and update for move of diagnostic_metadata to diagnostics::metadata. * selftest-diagnostic.cc: Update for move of diagnostic_metadata to diagnostics::metadata. * selftest-diagnostic.h: Likewise. gcc/rust/ChangeLog: * rust-diagnostics.cc: Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h", and update for move of diagnostic_metadata to diagnostics::metadata. gcc/testsuite/ChangeLog: * gcc.dg/plugin/analyzer_cpython_plugin.cc: : Update #include for move of "diagnostic-metadata.h" to "diagnostics/metadata.h" * gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise. * gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_graphs.cc: Likewise. Also update for move of diagnostic_metadata to diagnostics::metadata. * gcc.dg/plugin/diagnostic_plugin_test_metadata.cc: Likewise. * gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2025-07-25Daily bump.GCC Administrator1-0/+6
2025-07-24cobol: Honor the "-static" command-line option. [PR119231]Robert Dubner1-2/+11
gcc/cobol/ChangeLog: PR cobol/119231 * gcobolspec.cc: (lang_specific_driver): Pass OPT_static through. Handle -static and -static-libgcobol properly. gcc/testsuite/ChangeLog: * cobol.dg/group2/_-static__compilation.cob: Modify for -static warning. * cobol.dg/group2/_-static__compilation.out: Removed.
2025-07-24Daily bump.GCC Administrator1-0/+10
2025-07-23cobol: Tweak adjustments to location_t of GENERIC nodes for PERFORM.Robert Dubner1-0/+7
COBOL has a group of PERFORM statements that require careful adjustments to the location_t elements of the GENERIC nodes so that the COBOL-aware version of GDB behaves properly. These changes are in service of that goal. gcc/cobol/ChangeLog: * genapi.cc (leave_procedure): Adjust location_t for PERFORM. (parser_perform_times): Likewise. (internal_perform_through_times): Likewise. (perform_outofline_before_until): Likewise. (perform_outofline_after_until): Likewise. (perform_outofline_testafter_varying): Likewise. (perform_outofline_before_varying): Likewise.
2025-07-22Daily bump.GCC Administrator1-0/+135
2025-07-21cobol: Improved linemap and diagnostic handling; PIC validation. [PR120402]Robert Dubner18-233/+806
Implementation of PICTURE string validation for PR120402. Expanded some printf format attributes. Improved debugging and diagnostic messages. Improved linemap and line location tracking in support of diagnostic messages and location_t tagging of GENERIC nodes for improved GDB-COBOL performance. Assorted changes to eliminate cppcheck warnings. Co-Authored-By: James K. Lowden <jklowden@cobolworx.com> Co-Authored-By: Robert Dubner <rdubner@symas.com> gcc/cobol/ChangeLog: PR cobol/120402 * Make-lang.in: Elminate commented-out scripting. * cbldiag.h (_CBLDIAG_H): Change #if 0 to #if GCOBOL_GETENV (warn_msg): Add printf attributes. (location_dump): Add debugging message. * cdf.y: Improved linemap tracking. * genapi.cc (treeplet_fill_source): const attribute for formal parameter. (insert_nop): Created to consolidate var_decl_nop writes. (build_main_that_calls_something): Move generation to the end of executable. (level_88_helper): Formatting. (parser_call_targets_dump): Formatting. (function_pointer_from_name): const attribute for formal parameter. (parser_initialize_programs): const attribute for formal parameter. (parser_statement_begin): Improved linemap handling. (section_label): Improved linemap handling. (paragraph_label): Improved linemap handling. (pseudo_return_pop): Improved linemap handling. (leave_procedure): Formatting. (parser_enter_section): Improved linemap handling. (parser_enter_paragraph): Improved linemap handling. (parser_perform): Formatting. (parser_leave_file): Move creation of main() to this routine. (parser_enter_program): Move creation of main from here to leave_file. (parser_accept): Formatting. const attribute for formal parameter. (parser_accept_command_line): const attribute for formal parameter. (parser_accept_command_line_count): const attribute for formal parameter. (parser_accept_envar): Likewise. (parser_set_envar): Likewise. (parser_display): Likewise. (get_exhibit_name): Implement EXHIBIT verb. (parser_exhibit): Likewise. (parser_sleep): const attribute for formal parameter. (parser_division): Improved linemap handling. (parser_classify): const attribute for formal parameter. (create_iline_address_pairs): Improved linemap handling. (parser_perform_start): Likewise. (perform_inline_until): Likewise. (perform_inline_testbefore_varying): Likewise. (parser_perform_until): Likewise. (parser_perform_inline_times): Likewise. (parser_intrinsic_subst): const attribute for formal parameter. (parser_file_merge): Formatting. (create_and_call): Improved linemap handling. (mh_identical): const attribute for formal parameter. (mh_numeric_display): const attribute for formal parameter. (mh_little_endian): Likewise. (mh_source_is_group): Likewise. (psa_FldLiteralA): Formatting. * genapi.h (parser_accept): const attribute for formal parameter. (parser_accept_envar): Likewise. (parser_set_envar): Likewise. (parser_accept_command_line): Likewise. (parser_accept_command_line_count): Likewise. (parser_add): Likewise. (parser_classify): Likewise. (parser_sleep): Likewise. (parser_exhibit): Likewise. (parser_display): Likewise. (parser_initialize_programs): Likewise. (parser_intrinsic_subst): Likewise. * gengen.cc (gg_assign): Improved linemap handling. (gg_add_field_to_structure): Likewise. (gg_define_from_declaration): Likewise. (gg_build_relational_expression): Likewise. (gg_goto_label_decl): Likewise. (gg_goto): Likewise. (gg_printf): Likewise. (gg_fprintf): Likewise. (gg_memset): Likewise. (gg_memchr): Likewise. (gg_memcpy): Likewise. (gg_memmove): Likewise. (gg_strcpy): Likewise. (gg_strcmp): Likewise. (gg_strncmp): Likewise. (gg_return): Likewise. (chain_parameter_to_function): Likewise. (gg_define_function): Likewise. (gg_get_function_decl): Likewise. (gg_call_expr): Likewise. (gg_call): Likewise. (gg_call_expr_list): Likewise. (gg_exit): Likewise. (gg_abort): Likewise. (gg_strlen): Likewise. (gg_strdup): Likewise. (gg_malloc): Likewise. (gg_realloc): Likewise. (gg_free): Likewise. (gg_set_current_line_number): Likewise. (gg_get_current_line_number): Likewise. (gg_insert_into_assembler): Likewise. (token_location_override): Likewise. (gg_token_location): Likewise. * gengen.h (location_from_lineno): Likewise. (gg_set_current_line_number): Likewise. (gg_get_current_line_number): Likewise. (gg_token_location): Likewise. (current_token_location): Likewise. (current_location_minus_one): Likewise. (current_location_minus_one_clear): Likewise. (token_location_override): Likewise. * genmath.cc (fast_divide): const attribute for formal parameter. * genutil.cc (get_and_check_refstart_and_reflen): Likewise. (get_data_offset): Likewise. (refer_refmod_length): Likewise. (refer_offset): Likewise. (refer_size): Likewise. (refer_size_dest): Likewise. (refer_size_source): Likewise. (qualified_data_location): Likewise. * genutil.h (refer_offset): Likewise. (refer_size_source): Likewise. (refer_size_dest): Likewise. (qualified_data_location): Likewise. * parse.y: EVALUATE token; Implement EXHIBIT verb; Improved linemap handling. * parse_ante.h (input_file_status_notify): Improved linemap handling. (location_set): Likewise. * scan.l: PICTURE string validation. * scan_ante.h (class picture_t): PICTURE string validation. (validate_picture): Likewise. * symbols.cc (symbol_currency): Revised default currency handling. * symbols.h (symbol_currency): Likewise. * util.cc (location_from_lineno): Improved linemap handling. (current_token_location): Improved linemap handling. (current_location_minus_one): Improved linemap handling. (current_location_minus_one_clear): Improved linemap handling. (gcc_location_set_impl): Improved linemap handling. (warn_msg): Improved linemap handling. * util.h (cobol_lineno): Improved linemap handling.
2025-07-16Daily bump.GCC Administrator1-0/+7
2025-07-15c, c++: Extend -Wunused-but-set-* warnings [PR44677]Jakub Jelinek1-8/+0
The -Wunused-but-set-* warnings work by using 2 bits on VAR_DECLs & PARM_DECLs, TREE_USED and DECL_READ_P. If neither is set, we typically emit -Wunused-variable or -Wunused-parameter warning, that is for variables which are just declared (including initializer) and completely unused. If TREE_USED is set and DECL_READ_P is unset, -Wunused-but-set-* warnings are emitted, i.e. for variables which can appear on the lhs of an assignment expression but aren't actually used elsewhere. The DECL_READ_P marking is done through mark_exp_read called from lots of places (e.g. lvalue to rvalue conversions etc.). LLVM has an extension on top of that in that it doesn't count pre/post inc/decrements as use (i.e. DECL_READ_P for GCC). The following patch does that too, though because we had the current behavior for 11+ years already and lot of people is -Wunused-but-set-* warning free in the current GCC behavior and not in the clang one (including GCC sources), it allows users to choose. Furthermore, it implements another level, where also var @= expr uses of var (except when it is also used in expr) aren't counted as DECL_READ_P. I think it would be nice to also handle var = var @ expr or var = expr @ var but unfortunately mark_exp_read is then done in both FEs during parsing of var @ expr or expr @ var and the code doesn't know it is rhs of an assignment with var as lhs. The patch works mostly by checking if DECL_READ_P is clear at some point and then clearing it again after some operation which might have set it. -Wunused or -Wall or -Wunused -Wextra or -Wall -Wextra turn on the 3 level of the new warning (i.e. the one which ignores also var++, ++var etc. as well as var @= expr), so does -Wunused-but-set-{variable,parameter}, but users can use explicit -Wunused-but-set-{variable,parameter}={1,2} to select a different level. 2025-07-15 Jakub Jelinek <jakub@redhat.com> Jason Merrill <jason@redhat.com> PR c/44677 gcc/ * common.opt (Wunused-but-set-parameter=, Wunused-but-set-variable=): New options. (Wunused-but-set-parameter, Wunused-but-set-variable): Turn into aliases. * common.opt.urls: Regenerate. * diagnostic-spec.cc (nowarn_spec_t::nowarn_spec_t): Use OPT_Wunused_but_set_variable_ instead of OPT_Wunused_but_set_variable and OPT_Wunused_but_set_parameter_ instead of OPT_Wunused_but_set_parameter. * gimple-ssa-store-merging.cc (find_bswap_or_nop_1): Remove unused but set variable tmp. * ipa-strub.cc (pass_ipa_strub::execute): Cast named_args to (void) if ATTR_FNSPEC_DECONST_WATERMARK is not defined. * doc/invoke.texi (Wunused-but-set-parameter=, Wunused-but-set-variable=): Document new options. (Wunused-but-set-parameter, Wunused-but-set-variable): Adjust documentation now that they are just aliases. gcc/c-family/ * c-opts.cc (c_common_post_options): Change warn_unused_but_set_parameter and warn_unused_but_set_variable from 1 to 3 if they were set only implicitly. * c-attribs.cc (build_attr_access_from_parms): Remove unused but set variable nelts. gcc/c/ * c-parser.cc (c_parser_unary_expression): Clear DECL_READ_P after default_function_array_read_conversion for -Wunused-but-set-{parameter,variable}={2,3} on PRE{IN,DE}CREMENT_EXPR argument. (c_parser_postfix_expression_after_primary): Similarly for POST{IN,DE}CREMENT_EXPR. * c-decl.cc (pop_scope): Use OPT_Wunused_but_set_variable_ instead of OPT_Wunused_but_set_variable. (finish_function): Use OPT_Wunused_but_set_parameter_ instead of OPT_Wunused_but_set_parameter. * c-typeck.cc (mark_exp_read): Handle {PRE,POST}{IN,DE}CREMENT_EXPR and don't handle it when cast to void. (build_modify_expr): Clear DECL_READ_P after build_binary_op for -Wunused-but-set-{parameter,variable}=3. gcc/cp/ * cp-gimplify.cc (cp_fold): Clear DECL_READ_P on lhs of MODIFY_EXPR after cp_fold_rvalue if it wasn't set before. * decl.cc (poplevel): Use OPT_Wunused_but_set_variable_ instead of OPT_Wunused_but_set_variable. (finish_function): Use OPT_Wunused_but_set_parameter_ instead of OPT_Wunused_but_set_parameter. * expr.cc (mark_use): Clear read_p for {PRE,POST}{IN,DE}CREMENT_EXPR cast to void on {VAR,PARM}_DECL for -Wunused-but-set-{parameter,variable}={2,3}. (mark_exp_read): Handle {PRE,POST}{IN,DE}CREMENT_EXPR and don't handle it when cast to void. * module.cc (trees_in::fn_parms_fini): Remove unused but set variable ix. * semantics.cc (finish_unary_op_expr): Return early for PRE{IN,DE}CREMENT_EXPR. * typeck.cc (cp_build_unary_op): Clear DECL_READ_P after mark_lvalue_use for -Wunused-but-set-{parameter,variable}={2,3} on PRE{IN,DE}CREMENT_EXPR argument. (cp_build_modify_expr): Clear DECL_READ_P after cp_build_binary_op for -Wunused-but-set-{parameter,variable}=3. gcc/go/ * gofrontend/gogo.cc (Function::export_func_with_type): Remove unused but set variable i. gcc/cobol/ * gcobolspec.cc (lang_specific_driver): Remove unused but set variable n_cobol_files. gcc/testsuite/ * c-c++-common/Wunused-parm-1.c: New test. * c-c++-common/Wunused-parm-2.c: New test. * c-c++-common/Wunused-parm-3.c: New test. * c-c++-common/Wunused-parm-4.c: New test. * c-c++-common/Wunused-parm-5.c: New test. * c-c++-common/Wunused-parm-6.c: New test. * c-c++-common/Wunused-var-7.c (bar, baz): Expect warning on a. * c-c++-common/Wunused-var-19.c: New test. * c-c++-common/Wunused-var-20.c: New test. * c-c++-common/Wunused-var-21.c: New test. * c-c++-common/Wunused-var-22.c: New test. * c-c++-common/Wunused-var-23.c: New test. * c-c++-common/Wunused-var-24.c: New test. * g++.dg/cpp26/name-independent-decl1.C (foo): Expect one set but not used warning. * g++.dg/warn/Wunused-parm-12.C: New test. * g++.dg/warn/Wunused-parm-13.C: New test. * g++.dg/warn/Wunused-var-2.C (f2): Expect set but not used warning on parameter x and variable a. * g++.dg/warn/Wunused-var-40.C: New test. * g++.dg/warn/Wunused-var-41.C: New test. * gcc.dg/memchr-3.c (test_find): Change return type from void to int, and add return n; statement. * gcc.dg/unused-9.c (g): Move dg-bogus to the correct line and expect a warning on i.
2025-07-15Daily bump.GCC Administrator1-0/+69
2025-07-14cobol: Eliminate cppcheck warnings in gcc/cobol .cc files.Robert Dubner15-150/+177
These changes eliminate various cppcheck warnings, mostly involving C-Style casting and applying "const" to various variables and formal parameters. Some tab characters were eliminated, and some lines were trimmed to seventy-nine characters. gcc/cobol/ChangeLog: * cobol1.cc (cobol_langhook_handle_option): Eliminate cppcheck warnings. * dts.h: Likewise. * except.cc (cbl_enabled_exceptions_t::dump): Likewise. * gcobolspec.cc (lang_specific_driver): Likewise. * genapi.cc (parser_file_merge): Likewise. * gengen.cc (gg_unique_in_function): Likewise. (gg_declare_variable): Likewise. (gg_peek_fn_decl): Likewise. (gg_define_function): Likewise. * genmath.cc (set_up_on_exception_label): Likewise. (set_up_compute_error_label): Likewise. (arithmetic_operation): Likewise. (fast_divide): Likewise. * genutil.cc (get_and_check_refstart_and_reflen): Likewise. (get_depending_on_value_from_odo): Likewise. (get_data_offset): Likewise. (get_binary_value): Likewise. (process_this_exception): Likewise. (copy_little_endian_into_place): Likewise. (refer_is_clean): Likewise. (refer_fill_depends): Likewise. * genutil.h (process_this_exception): Likewise. (copy_little_endian_into_place): Likewise. (refer_is_clean): Likewise. * lexio.cc (check_push_pop_directive): Likewise. (check_source_format_directive): Likewise. (location_in): Likewise. (lexer_input): Likewise. (cdftext::lex_open): Likewise. (lexio_dialect_mf): Likewise. (valid_sequence_area): Likewise. (cdftext::free_form_reference_format): Likewise. (cdftext::segment_line): Likewise. * lexio.h (struct span_t): Likewise. * scan_ante.h (trim_location): Likewise. * symbols.cc (symbol_elem_cmp): Likewise. (symbol_alphabet): Likewise. (end_of_group): Likewise. (cbl_field_t::attr_str): Likewise. (symbols_update): Likewise. (symbol_typedef_add): Likewise. (symbol_field_add): Likewise. (new_temporary_impl): Likewise. (symbol_label_section_exists): Likewise. (symbol_program_callables): Likewise. (file_status_status_of): Likewise. * symfind.cc (is_data_field): Likewise. (finalize_symbol_map2): Likewise. (class in_scope): Likewise. (symbol_match2): Likewise. * util.cc (get_current_dir_name): Likewise. (gb4): Likewise. (class cdf_directives_t): Likewise. (cbl_field_t::report_invalid_initial_value): Likewise. (literal_subscript_oob): Likewise. (cbl_refer_t::str): Likewise. (date_time_fmt): Likewise. (class unique_stack): Likewise. (cobol_set_pp_option): Likewise. (cobol_filename): Likewise. (cobol_filename_restore): Likewise. (gcc_location_set_impl): Likewise. (ydferror): Likewise. (error_msg_direct): Likewise. (yyerror): Likewise. (cbl_unimplemented_at): Likewise.
2025-07-14Daily bump.GCC Administrator1-0/+70
2025-07-13cobol: Minor changes to genapi.cc to eliminate CPPCHECK warnings.Robert Dubner7-196/+326
Several hundred cppcheck warnings were eliminated. Most of these changes were replacing C-style casts, checking for NULL pointers, establishing some variables and formal parameters as const, and moving some variables around to tidy up their scopes. One memory leak was found and eliminated as a result of the cppcheck. gcc/cobol/ChangeLog: * Make-lang.in: Eliminate the .cc.o override. * genapi.cc (level_88_helper): Eliminate cppcheck warning. (get_level_88_domain): Likewise. (get_class_condition_string): Likewise. (parser_call_targets_dump): Likewise. (parser_compile_ecs): Likewise. (initialize_variable_internal): Likewise. (move_tree): Likewise. (combined_name): Likewise. (assembler_label): Likewise. (find_procedure): Likewise. (parser_perform): Likewise. (parser_perform_times): Likewise. (internal_perform_through): Likewise. (internal_perform_through_times): Likewise. (psa_FldLiteralN): Likewise. (psa_FldBlob): Likewise. (parser_accept): Likewise. (parser_accept_exception): Likewise. (parser_accept_exception_end): Likewise. (parser_accept_command_line): Likewise. (parser_accept_envar): Likewise. (parser_display_internal): Likewise. (parser_display): Likewise. (parser_assign): Likewise. (parser_initialize_table): Likewise. (parser_arith_error): Likewise. (parser_arith_error_end): Likewise. (parser_division): Likewise. (label_fetch): Likewise. (parser_label_label): Likewise. (parser_label_goto): Likewise. (parser_perform_start): Likewise. (parser_perform_conditional): Likewise. (parser_perform_conditional_end): Likewise. (parser_perform_until): Likewise. (parser_file_delete): Likewise. (parser_intrinsic_subst): Likewise. (create_lsearch_address_pairs): Likewise. (parser_bsearch_start): Likewise. (is_ascending_key): Likewise. (parser_sort): Likewise. (parser_file_sort): Likewise. (parser_return_start): Likewise. (parser_file_merge): Likewise. (parser_string_overflow): Likewise. (parser_unstring): Likewise. (parser_string): Likewise. (parser_call_exception): Likewise. (create_and_call): Likewise. (mh_identical): Likewise. (move_helper): Likewise. (binary_initial_from_float128): Likewise. (initial_from_initial): Likewise. (psa_FldLiteralA): Likewise. (parser_local_add): Likewise. (parser_symbol_add): Likewise. * genapi.h (parser_display): Likewise. * gengen.cc (gg_call_expr): Explict check for NULL_TREE. (gg_call): Likewise. * show_parse.h (SHOW_PARSE_LABEL_OK): Likewise. (TRACE1_FIELD_VALUE): Likewise. (CHECK_FIELD): Likewise. (CHECK_FIELD2): Likewise. (CHECK_LABEL): Likewise. * util.cc (cbl_internal_error): Apply [[noreturn]] attribute. * util.h (cbl_internal_error): Likewise. libgcobol/ChangeLog: * common-defs.h (PTRCAST): Moved here from libgcobol.h. * libgcobol.h (PTRCAST): Deleted.
2025-07-12Daily bump.GCC Administrator1-0/+9
2025-07-11cobol: Fix build on 32-bit Darwin [PR120621]Rainer Orth4-6/+6
Bootstrapping trunk with 32-bit-default on Mac OS X 10.11 (i386-apple-darwin15) fails: /vol/gcc/src/hg/master/local/gcc/cobol/lexio.cc: In static member function 'static void cdftext::process_file(filespan_t, int, bool)': /vol/gcc/src/hg/master/local/gcc/cobol/lexio.cc:1859:14: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=] 1859 | dbgmsg("%s:%d: line " HOST_SIZE_T_PRINT_UNSIGNED ", opening %s on fd %d", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1860 | __func__, __LINE__,mfile.lineno(), | ~~~~~~~~~~~~~~ | | | size_t {aka long unsigned int} In file included from /vol/gcc/src/hg/master/local/gcc/system.h:1244, from /vol/gcc/src/hg/master/local/gcc/cobol/cobol-system.h:61, from /vol/gcc/src/hg/master/local/gcc/cobol/lexio.cc:33: /vol/gcc/src/hg/master/local/gcc/hwint.h:135:51: note: format string is defined here 135 | #define HOST_SIZE_T_PRINT_UNSIGNED "%" GCC_PRISZ "u" | ~~~~~~~~~~~~~~^ | | | unsigned int | %" GCC_PRISZ "lu On Darwin, size_t is always long unsigned int. However, unsigned int and long unsigned int are both 32-bit, so hwint.h selects %u for the format. As documented there, the arg needs to be cast to fmt_size_t to avoid the error. This isn't an issue on other 32-bit platforms like Solaris/i386 or Linux/i686 since they use unsigned int for size_t. /vol/gcc/src/hg/master/local/gcc/cobol/parse.y: In function 'int yyparse()': /vol/gcc/src/hg/master/local/gcc/cobol/parse.y:10215:36: error: format '%zu' expects argument of type 'size_t', but argument 4 has type 'int' [-Werror=format=] 10215 | error_msg(loc, "FUNCTION %qs has " | ^~~~~~~~~~~~~~~~~~~ 10216 | "inconsistent parameter type %zu (%qs)", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10217 | keyword_str($1), p - args.data(), name_of(p->field) ); | ~~~~~~~~~~~~~~~ | | | int The arg (p - args.data())) is ptrdiff_t (int on 32-bit Darwin), while the %zu format expect size_t (long unsigned int). The patch therefore casts the ptrdiff_t arg to long and prints it as such. There are two more instances of the same problem: /vol/gcc/src/hg/master/local/gcc/cobol/util.cc: In member function 'void cbl_field_t::report_invalid_initial_value(const YYLTYPE&) const': /vol/gcc/src/hg/master/local/gcc/cobol/util.cc:905:80: error: format '%zu' expects argument of type 'size_t', but argument 6 has type 'int' [-Werror=format=] 905 | error_msg(loc, "%s cannot represent VALUE %qs exactly (max %c%zu)", | ~~^ | | | long unsigned int | %u 906 | name, data.initial, '.', pend - p); | ~~~~~~~~ | | | int In file included from /vol/gcc/src/hg/master/local/gcc/cobol/scan.l:48: /vol/gcc/src/hg/master/local/gcc/cobol/scan_ante.h: In function 'int numstr_of(const char*, radix_t)': /vol/gcc/src/hg/master/local/gcc/cobol/scan_ante.h:152:25: error: format '%zu' expects argument of type 'size_t', but argument 4 has type 'int' [-Werror=format=] 152 | error_msg(yylloc, "significand of %s has more than 36 digits (%zu)", input, nx); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~ | | | int Fixed in the same way. Bootstrapped without regressions on i386-apple-darwin15, x86_64-apple-darwin, i386-pc-solaris2.11, amd64-pc-solaris2.11, i686-pc-linux-gnu, and x86_64-pc-linux-gnu. 2025-06-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> gcc/cobol: PR cobol/120621 * lexio.cc (parse_replace_pairs): Cast mfile.lineno() to fmt_size_t. * parse.y (intrinsic): Print ptrdiff_t using %ld, cast arg to long. * scan_ante.h (numstr_of): Print nx using %ld, cast arg to long. * util.cc (cbl_field_t::report_invalid_initial_value): Print ptrdiff_t using %ld, cast arg to long.
2025-07-11Daily bump.GCC Administrator1-0/+59
2025-07-10cobol: Add PUSH and POP to CDF.James K. Lowden17-1275/+1540
Introduce cdf_directives_t class to centralize management of CDF state. Move existing CDF state variables and functions into the new class. gcc/cobol/ChangeLog: PR cobol/120765 * cdf.y: Extend grammar for new CDF syntax, relocate dictionary. * cdfval.h (cdf_dictionary): Use new CDF dictionary. * dts.h: Remove useless assignment, note incorrect behavior. * except.cc: Remove obsolete EC state. * gcobol.1: Document CDF in its own section. * genapi.cc (parser_statement_begin): Use new EC state function. (parser_file_merge): Same. (parser_check_fatal_exception): Same. * genutil.cc (get_and_check_refstart_and_reflen): Same. (get_depending_on_value_from_odo): Same. (get_data_offset): Same. (process_this_exception): Same. * lexio.cc (check_push_pop_directive): New function. (check_source_format_directive): Restrict regex search to 1 line. (cdftext::free_form_reference_format): Use new function. * parse.y: Define new CDF tokens, use new CDF state. * parse_ante.h (cdf_tokens): Use new CDF state. (redefined_token): Same. (class prog_descr_t): Remove obsolete CDF state. (class program_stack_t): Same. (current_call_convention): Same. * scan.l: Recognize new CDF tokens. * scan_post.h (is_cdf_token): Same. * symbols.h (cdf_current_tokens): Change current_call_convention to return void. * token_names.h: Regenerate. * udf/stored-char-length.cbl: Use new PUSH/POP CDF functionality. * util.cc (class cdf_directives_t): Define cdf_directives_t. (current_call_convention): Same. (cdf_current_tokens): Same. (cdf_dictionary): Same. (cdf_enabled_exceptions): Same. (cdf_push): Same. (cdf_push_call_convention): Same. (cdf_push_current_tokens): Same. (cdf_push_dictionary): Same. (cdf_push_enabled_exceptions): Same. (cdf_push_source_format): Same. (cdf_pop): Same. (cdf_pop_call_convention): Same. (cdf_pop_current_tokens): Same. (cdf_pop_dictionary): Same. (cdf_pop_enabled_exceptions): Same. (cdf_pop_source_format): Same. * util.h (cdf_push): Declare cdf_directives_t. (cdf_push_call_convention): Same. (cdf_push_current_tokens): Same. (cdf_push_dictionary): Same. (cdf_push_enabled_exceptions): Same. (cdf_push_source_format): Same. (cdf_pop): Same. (cdf_pop_call_convention): Same. (cdf_pop_current_tokens): Same. (cdf_pop_dictionary): Same. (cdf_pop_source_format): Same. (cdf_pop_enabled_exceptions): Same. libgcobol/ChangeLog: * common-defs.h (cdf_enabled_exceptions): Use new CDF state.
2025-07-10Daily bump.GCC Administrator1-0/+78
2025-07-09cobol: Development round-up. [PR120765, PR119337, PR120794]Robert Dubner18-1601/+2012
This collection of changes reflects development by both Jim Lowden and Bob Dubner. It includes fixes to the cobcd script; refinements to the multiple- period syntax; changes to the parser; implementation of DISPLAY/ACCEPT to and from ENVIRONMENT-NAME, ENVIRONMENT-VALUE, ARGUMENT-NUMBER, ARGUMENT-VALUE and minor changes to genapi.cc to cut down on the number of cppcheck warnings. Co-authored-by: James K. Lowden <jklowden@cobolworx.com> Co-authored-by: Robert Dubner <rdubner@symas.com> gcc/cobol/ChangeLog: PR cobol/120765 PR cobol/119337 PR cobol/120794 * Make-lang.in: Take control of the .cc.o rule. * cbldiag.h (error_msg_direct): New declaration. (gcc_location_dump): Forward declaration. (location_dump): Use gcc_location_dump. * cdf.y: Change some tokens. * gcobc: Change dialect handling. * genapi.cc (parser_call_targets_dump): Temporarily remove from service. (parser_compile_dcls): Combine temporary arrays. (get_binary_value_from_float): Apply const to one parameter. (depending_on_value): Localize a boolean variable. (normal_normal_compare): Likewise. (cobol_compare): Eliminate cppcheck warning. (combined_name): Apply const to an input parameter. (parser_perform): Apply const to a variable. (parser_accept): Improve handling of special_name_t parameter and the exception conditions. (parser_display): Improve handling of speciat_name_t parameter; use the os_filename[] string when appropriate. (program_end_stuff): Rename shadowing variable. (parser_division): Consolidate temporary char[] arrays. (parser_file_start): Apply const to a parameter. (inspect_replacing): Likewise. (parser_program_hierarchy): Rename shadowing variable. (mh_identical): Apply const to parameters. (float_type_of): Likewise. (picky_memcpy): Likewise. (mh_numeric_display): Likewise. (mh_little_endian): Likewise. (mh_source_is_group): Apply static to a variable it. (move_helper): Quiet a cppcheck warning. * genapi.h (parser_accept): Add exceptions to declaration. (parser_accept_under_discussion): Add declaration. (parser_display): Change to std::vector; add exceptions to declaration. * lexio.cc (cdf_source_format): Improve source code location handling. (source_format_t::infer): Likewise. (is_fixed_format): Likewise. (is_reference_format): Likewise. (left_margin): Likewise. (right_margin): Likewise. (cobol_set_indicator_column): Likewise. (include_debug): Likewise. (continues_at): Likewise. (indicated): Likewise. (check_source_format_directive): Likewise. (cdftext::free_form_reference_format): Likewise. * parse.y: Tokens; program and function names; DISPLAY and ACCEPT handling. * parse_ante.h (class tokenset_t): Removed. (class current_tokens_t): Removed. (field_of): Removed. * scan.l: Token handling. * scan_ante.h (level_found): Comment. * scan_post.h (start_condition_str): Remove cast author_state:. * symbols.cc (symbols_update): Change error message. (symbol_table_init): Correct and reorder entries. (symbol_unresolved_file_key): New function definition. (cbl_file_key_t::deforward): Change error message. * symbols.h (symbol_unresolved_file_key): New declaration. (keyword_tok): New function. (redefined_token): New function. (class current_tokens_t): New class. * symfind.cc (symbol_match): Revise error message. * token_names.h: Reorder and change numbers in comments. * util.cc (class cdf_directives_t): New class. (cobol_set_indicator_column): New function. (cdf_source_format): New function. (gcc_location_set_impl): Improve column handling in token_location. (gcc_location_dump): New function. (class temp_loc_t): Modify constructor. (error_msg_direct): New function. * util.h (class source_format_t): New class. libgcobol/ChangeLog: * libgcobol.cc (__gg__accept_envar): ACCEPT/DISPLAY environment variables. (accept_envar): Likewise. (default_exception_handler): Refine system log entries. (open_syslog): Likewise. (__gg__set_env_name): ACCEPT/DISPLAY environment variables. (__gg__get_env_name): ACCEPT/DISPLAY environment variables. (__gg__get_env_value): ACCEPT/DISPLAY environment variables. (__gg__set_env_value): ACCEPT/DISPLAY environment variables. (__gg__fprintf_stderr): Adjust __attribute__ for printf. (__gg__set_arg_num): ACCEPT/DISPLAY command-line arguments. (__gg__accept_arg_value): ACCEPT/DISPLAY command-line arguments. (__gg__get_file_descriptor): DISPLAY on os_filename[] /dev device.
2025-07-02Daily bump.GCC Administrator1-0/+8
2025-07-01cobol: Respect error in cobol.install-common.James K. Lowden1-1/+1
If GCOBOL_INSTALL_NAME fails to install, do not install GCOBC_INSTALL_NAME. gcc/cobol/ChangeLog: * Make-lang.in: Use && instead of semicolon between commands.
2025-07-01cobol: Repair printf format of size_t.Robert Dubner1-1/+1
gcc/cobol/ChangeLog: * parse.y: printf() of size_t is %zu, not %ld.
2025-07-01Daily bump.GCC Administrator1-0/+48
2025-06-30cobol: Revise diagnostic linemap management.James K. Lowden13-341/+439
Update linemap filename before location in both parsers. Rely on parser to update linemap. Lexer maintains location. Various small syntax corrections and extensions. PR cobol/120772 PR cobol/120779 PR cobol/120790 PR cobol/120791 PR cobol/120794 gcc/cobol/ChangeLog: * gcobc: Supply -fPIC for shared objects. * genapi.cc (linemap_add): Delete empty macro. (parser_enter_file): Do not call linemap_add. (parser_leave_file): Same. * gengen.cc (location_from_lineno): Remove function. * lexio.cc (parse_replacing_term): Allow empty term. (cdftext::process_file): Always append to output. (cdftext::segment_line): Output #line directives. * lexio.h (struct span_t): Count lines in span. * parse.y: Revamp REPOSITORY, and minor syntax extensions. * parse_ante.h (input_file_status_notify): Update linemap filename before location. (intrinsic_token_of): Declare. (parser_move_carefully): Support MOVE pointer. * parse_util.h (intrinsic_token_of): New function. * scan.l: New EOF logic, accept NOT=, own yylloc and yylineno. * scan_ante.h (class enter_leave_t): Do not store newline count. (cdf_location_set): Remove declaration. (ydfltype_of): New function. (update_location): Accept location parameter. (reset_location): New function. (YY_USER_ACTION): Use update_location(). (YY_USER_INIT): Update CDF location. (verify_ws): New function. (wait_for_the_child): Removed. * symbols.h (cobol_fileline_set): return line number. * util.cc (valid_move): Use range-based for loop. (struct input_file_t): Remove line_map pointer. (class unique_stack): New peek() member function. (cobol_lineno_save): Rename to overload cobol_lineno(). (cobol_lineno): Replaces cobol_lineno_save(). (cobol_filename): Return void. (location_from_lineno): New function used by genapi.cc. (cdf_location_set): Remove. (matched_length): No change. (cobol_fileline_set): Return line number. (fisspace): Remove extra semicolon. (fisprint): Same. * util.h (cobol_filename_restore): Return void. (cobol_lineno_save): Remove declaration. (cobol_lineno): Declare.
2025-06-30Daily bump.GCC Administrator1-0/+68
2025-06-29cobol: Normalize generating and using function_decls.Robert Dubner8-416/+569
Because COBOL doesn't require function prototypes, it is possible to, for example, CALL "getcwd" USING <parameters> and then later CALL "getcwd" USING <parameters> RETURNING <alphanumeric> The second call "knows" that the return value is a char*, but the first one does not. So, the first one gets a default return value type of SSIZE_t, which later needs to be replaced with CHAR_P. These [all too] extensive changes ensure that all references to a particular function use the same function_decl, and take measures to make sure that one function_decl is back-modified, if necessary, with the best return value type. gcc/cobol/ChangeLog: * Make-lang.in: Incorporate gcobol.clean. * except.cc (cbl_enabled_exceptions_t::dump): Update debug message. * genapi.cc (gg_attribute_bit_get): Formatting. (file_static_variable): Formatting. (trace1_init): Formatting. (build_main_that_calls_something): Normalize function_decl use. (parser_call_target): Likewise. (set_call_convention): Likewise. (parser_call_target_convention): Likewise. (parser_call_targets_dump): Likewise. (function_handle_from_name): Likewise. (function_pointer_from_name): Likewise. (parser_initialize_programs): Likewise. (parser_statement_begin): Formatting. (parser_leave_file): Use function_decl FIFO. (enter_program_common): Normalize function_decl use. (parser_enter_program): Normalize function_decl use. (tree_type_from_field_type): Normalize function_decl use. (is_valuable): Comment. (pe_stuff): Change name to program_end_stuff. (program_end_stuff): Likewise. (parser_exit): Likewise. (parser_division): Normalize function_decl use. (create_and_call): Normalize function_decl use. (parser_call): Normalize function_decl use. (parser_set_pointers): Normalize function_decl use. (parser_program_hierarchy): Normalize function_decl use. (psa_FldLiteralA): Defeat attempt to re-use literals. (Fails on some aarch64). (parser_symbol_add): Error message formatting. * genapi.h: Formatting. * gengen.cc (struct cbl_translation_unit_t): Add function_decl FIFO. (show_type): Rename to gg_show_type. (gg_show_type): Correct an error message. (gg_assign): Formatting; change error handling. (gg_modify_function_type): Normalize function_decl use. (gg_define_function_with_no_parameters): Fold into gg_defint_function(). (function_decl_key): Normalize function_decl use. (gg_peek_fn_decl): Normalize function_decl use. (gg_build_fn_decl): Normalize function_decl use. (gg_define_function): Normalize function_decl use. (gg_tack_on_function_parameters): Remove. (gg_finalize_function): Normalize function_decl use. (gg_leaving_the_source_code_file): Normalize function_decl use. (gg_call_expr_list): Normalize function_decl use. (gg_trans_unit_var_decl): Normalize function_decl use. (gg_insert_into_assemblerf): New function; formatting. * gengen.h (struct gg_function_t): Eliminate "is_truly_nested" flag. (gg_assign): Incorporate return value. (gg_define_function): Normalize function_decl use. (gg_define_function_with_no_parameters): Eliminate. (gg_build_fn_decl): Normalize function_decl use. (gg_peek_fn_decl): Normalize function_decl use. (gg_modify_function_type): Normalize function_decl use. (gg_call_expr_list): Normalize function_decl use. (gg_get_function_decl): Normalize function_decl use. (location_from_lineno): Prefix with "extern". (gg_open): Likewise. (gg_close): Likewise. (gg_get_indirect_reference): Likewise. (gg_insert_into_assembler): Likewise. (gg_insert_into_assemblerf): Likewise. (gg_show_type): New declaration. (gg_leaving_the_source_code_file): New declaration. * parse.y: Format debugging message. * parse_ante.h: Normalize function_decl use.
2025-06-21Daily bump.GCC Administrator1-0/+11
2025-06-20cobol: Correct diagnostic strings for 32-bit builds.James K. Lowden4-22/+26
Avoid %z for printf-family. Cast pid_t to long. Avoid use of YYUNDEF for old Bison versions. PR cobol/120621 gcc/cobol/ChangeLog: * genapi.cc (parser_compile_ecs): Cast argument to unsigned long. (parser_compile_dcls): Same. (parser_division): RAII. (inspect_tally): Cast argument to unsigned long. * lexio.cc (cdftext::lex_open): Cast pid_t to long. * parse.y: hard-code values for old versions of Bison, and message format. * scan_ante.h (wait_for_the_child): Cast pid_t to long.