mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
Up until these changes, temporary intermediate alphanumeric string variables have been allocated on the stack. With the design change to a larger limit, that's no longer practical. Such variables are now placed on the heap, and we now have to take pains to free() that memory when we are done with it. gcc/cobol/ChangeLog: * gcobc: Adjust how -fPIC is applied, and other refinements. * gcobol.1: Documentation. * genapi.cc (parser_statement_end): New function. Deallocates temp char strings from the heap. (initialize_variable_internal): Ignore temp char strings. (compare_binary_binary): Formatting. (parser_end_program): Formatting. (parser_init_list): Formatting. (parser_exit_program): Formatting. (program_end_stuff): Formatting. (parser_exit): Formatting. (parser_perform_conditional): Formatting. (perform_outofline_before_until): Formatting. (parser_file_add): Formatting. (mh_source_is_literalA): Formatting. (psa_new_var_decl): Make cblc_field_t for intermediate_e alphanumerics program-static. (parser_symbol_add): Eliminate unnecessary code when type!=FldConditional; change handling of intermediate_e for FldAlphanumerics. * genapi.h (parser_end_program): New declaration. (parser_exit): Formatting. (parser_exit_program): Formatting. (parser_statement_end): New declaration. * lexio.cc (parse_replace_pairs): Change CDF handling. (cdftext::lex_open): Likewise. (cdftext::process_file): Likewise. * parse.y: Changes to MAXIMUM_ALPHA_LENGTH; refine return value types for various intrinsic functions; some CDF handling. * parse_ante.h (MAXLENGTH_FORMATTED_DATE): Eliminate constant. (MAXLENGTH_FORMATTED_TIME): Likewise. (MAXLENGTH_CALENDAR_DATE): Likewise. (MAXLENGTH_FORMATTED_DATETIME): Likewise. (new_alphanumeric): No longer takes a capacity. (intrinsic_return_field): New declaration. (struct ffi_args_t): Changed debug message. (is_among): New declaration. * parse_util.h (intrinsic_return_field): New function. Works with the modified function_descrs[] table. * scan.l: Modified scanning. * scan_ante.h (class input_file_status_t): Likewise. (verify_ws): Likewise. (is_refmod): Likewise. * symbols.cc (symbols_update): Improved comment about a debug message. (symbol_temporaries): New function for temporaries on the heap that will have to be deallocated. (symbol_temporary_alphanumerics): Likewise. (new_temporary_impl): Eliminate MAXIMUM_ALPHA_LENGTH from template. (new_alphanumeric): Eliminate capacity as a parameter. * symbols.h (cbl_dialect_str): Formatting. (MAXIMUM_ALPHA_LENGTH): Change comment and value. (IBM_MAXIMUM_ALPHA_LENGTH): Put parentheses around "size_t(1)<<31". (symbol_temporaries): New declaration. (symbol_temporary_alphanumerics): New declaration. (struct function_descr_t): New comment on ret_type. (new_alphanumeric): New declaration. * util.cc (class cdf_directives_t): CDF processing. (cobol_set_indicator_column): Likewise. (cdf_push_source_format): Likewise. (cdf_pop_source_format): Likewise. (parent_names): Likewise. (cobol_filename): Likewise. (cobol_lineno): Likewise. (cobol_filename_restore): Likewise. libgcobol/ChangeLog: * intrinsic.cc (string_to_dest): Move call to __gg__adjust_dest_size(). (__gg__char): Likewise. (__gg__current_date): Likewise. (__gg__formatted_current_date): Likewise. (__gg__formatted_date): Likewise. (__gg__formatted_datetime): Likewise. (__gg__formatted_time): Likewise. (change_case): Likewise. (__gg__trim): Likewise; fix memory leak. (__gg__reverse): Move call to __gg__adjust_dest_size(). (__gg__locale_compare): Likewise (__gg__locale_date): Likewise (__gg__locale_time): Likewise (__gg__locale_time_from_seconds): Likewise * libgcobol.cc (format_for_display_internal): Make the results of intermediate FldNumericBin5 look nice to a human. (init_var_both): Move call to __gg__adjust_dest_size(). (__gg__get_argc): Move call to __gg__adjust_dest_size(). (__gg__get_argv): Move call to __gg__adjust_dest_size(). (__gg__get_command_line): Move call to __gg__adjust_dest_size(). (__gg__adjust_dest_size): Properly handle intermediate_e allocations. (__gg__adjust_encoding): Move call to __gg__adjust_dest_size(). (__gg__module_name): Move call to __gg__adjust_dest_size(). (__gg__refer_from_string): Move call to __gg__adjust_dest_size(). (__gg__refer_from_psz): Move call to __gg__adjust_dest_size(). (__gg__convert): Move call to __gg__adjust_dest_size(). * posix/shim/lseek.cc: Changes to extended functions. * posix/shim/open.cc (posix_opent): Likewise. (posix_open): Likewise. * posix/udf/posix-open.cbl: Likewise. * posix/udf/posix-read.cbl: Likewise. * posix/udf/posix-write.cbl: Likewise. * xmlparse.cc (sayso): Change to debug message. * posix/udf/posix-ftruncate.cbl: New file.
The libgcobol is intended for use entirely and solely by executables created from COBOL source code by the GCOBOL "COBOL for GCC" front end. libgcobol.a can be staticly linked in, but it makes for very large binaries. We tend to use that for debugging the GCOBOL compiler, and not much else Many of the functions in the library are called by the executable code generated by the GCOBOL compiler through GIMPLE tags, and thus prototypes -- which are part of the C/C++ programming paradigm -- are not used. Both the calling program and the called program use the extern "C" construction so that the linker can find the functions, and they need to agree ahead of time about the meaning of passed parameters.