Hi! Right now it is not possible to even build cross-compilers from 32-bit architectures to e.g. x86_64-linux or aarch64-linux, even from little-endian ones.
The following patch attempts to fix that. There were various issues seen e.g. trying to build i686-linux -> x86_64-linux cross-compiler (so still 64-bit libgcobol, but the compiler is 32-bit). 1) warning about >> 32 shift of size_t, on 32-bit arches size_t is 32-bit and so the shift is UB; fixed by doing (new_size>>16)>>16 so that it ors in >> 32 when new_size is 64-bit and 0 when it is 32-bit 2) enum cbl_field_attr_t was using size_t as underlying type, but has various bitmasks which require full 64-bit type; changed this to uint64_t underlying type and using unsigned long long in the structure; various routines which operate with those attributes had to be changed also to work with uint64_t instead of size_t 3) on i686-linux, config.h can #define _FILE_OFFSET_BITS 64 or similar macros; as documented, those macros have to be defined before including first C library header, but some sources included cobol-system.h which includes config.h only after various other headers; this resulted in link failures, as ino_t was sometimes unsigned long and sometines unsigned long long, depending on whether config.h was included first or not, and e.g. cobol_filename uses ino_t argument 4) lots of places used %ld or %lx *printf format specifers with size_t arguments; that works only if size_t is unsigned long, but not when it is unsigned int or unsigned long long or some other type; now while ISO C99 has %zd or %zx to print size_t and C++14 includes C99 (or C11?), while for the C++ headers the C++ compilers typically have full control over it and so support everything in C++14 (e.g. libstdc++ in GCC 5.1+ or libc++ if not too old), for C library we are dependent on the system C library (note, on the host for the compiler side). And not all hosts support C99 in their C libraries; so instead of just changing it to %zd or %zx, I'm changing it to what we use elsewhere in GCC, HOST_SIZE_T_PRINT_{DEC,UNSIGNED,HEX_PURE} or GCC_PRISZ macros in the *printf family format string and casts of the size_t arguments to fmt_size_t. Note, if not using the C library *printf family (e.g. in dbgmsg, sprintf, snprintf, fprintf, etc.) but the GCC diagnostic code (e.g. err_msg, error, warning, yywarn, ...), then %zd/%zu is supported and on the other side HOST_SIZE_T_PRINT_{DEC,UNSIGNED,HEX_PURE} etc. macros shouldn't be used (for two reasons, because it is unnecessary when %zd/%zu is guaranteed to be supported there because GCC has control over that and more importantly because it breaks translations, both extraction of the to be translated strings and we don't want to have different messages, once with %lld, once with %ld, once with just %d or %I64d depending on host, translators couldn't translate it all). 5) see above, there were already tons of %zd/%zu or %3zu etc. format specifers in *printf format strings, this patch changes those too 6) I've noticed dbgmsg wasn't declared with printf attribute, which resulted in bugs where format specifiers didn't match actually passed types of arguments The following patch passed bootstrap/regtest on x86_64-linux (including cobol, make check-cobol is clean) and built fine also as i686-linux to x86_64-linux cross, in that case I see a few test FAILures, but nothing huge: === cobol Summary === # of expected passes 2991 # of unexpected failures 78 # of expected failures 6 The FAILs are: FAIL: cobol.dg/group1/declarative_1.cob -O0 execution test FAIL: FUNCTION_BIGGER-POINTER__2_.out output file test FAIL: IBM_dialect_COMP_redefined_by_POINTER_as_64-bit.out output file test FAIL: cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_ISO_Example_1.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_ISO_Example_2.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_ISO_Example_3.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_ISO_Example_4.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_ISO_Example_5-f.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_ISO_Example_5-r.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_ISO_Example_5.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob -O0 execution test FAIL: cobol.dg/group2/INSPECT_TRAILING.cob -O0 execution test and can send the *.log/*.sum file if it helps, but I'd hope it can be resolved incrementally because the patch is already way too big. Ok for trunk? 2025-04-05 Jakub Jelinek <ja...@redhat.com> PR cobol/119364 libgcobol/ * valconv.cc (__gg__realloc_if_necessary): Use (new_size>>16)>>16; instead of new_size>>32; to avoid warnings on 32-bit hosts. * common-defs.h (enum cbl_field_attr_t): Use uint64_t as underlying type rather than size_t. * gcobolio.h (cblc_field_t): Change attr member type from size_t to unsigned long long. gcc/cobol/ * util.cc (is_numeric_edited): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" and cast corresponding argument to fmt_size_t. (normalize_picture): Use GCC_PRISZ instead of "z" and pass address of fmt_size_t var to sscanf and copy afterwards. (cbl_refer_t::str): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" and cast corresponding argument to fmt_size_t. (struct move_corresponding_field): Likewise. (valid_move): Likewise. (locally_unique): Likewise. (procedure_definition_add): Likewise. (ambiguous_reference): Likewise. (find_corresponding::find_corresponding): Likewise. (corresponding_fields): Likewise. (unique_stack::push): Likewise. (cobol_filename): Likewise. * lexio.cc: Include config.h first. (recognize_replacements): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" and cast corresponding argument to fmt_size_t. (check_source_format_directive): Likewise. (parse_replacing_pair): Use size_t(0) instead of 0UL in span_t construction. (parse_replace_pairs): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" or HOST_SIZE_T_PRINT_DEC instead of "%zd" and cast corresponding argument to fmt_size_t. (parse_copy_directive): Likewise. (parse_replace_last_off): Likewise. (parse_replace_text): Likewise. (bytespan_t::append): Likewise. (cdftext::map_file): Likewise. (cdftext::process_file): Likewise. * symfind.cc (dump_symbol_map2): Likewise. (dump_symbol_map_value): Likewise. (field_structure): Likewise. (build_symbol_map): Likewise. (is_name::dump_key): Likewise. (symbol_match2): Likewise. (symbol_find): Likewise. (symbol_find_of): Likewise. * cdf.y: Likewise. * symbols.cc: Include config.h first. (cbl_field_t::set_attr): Return uint64_t rather than size_t and replace size_t(attr) with uint64_t(attr). (cbl_field_t::clear_attr): Likewise. (update_block_offsets): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" or HOST_SIZE_T_PRINT_DEC instead of "%zd" and cast corresponding argument to fmt_size_t. (symbol_field_capacity): Likewise. (symbol_find_odo_debug): Likewise. (symbols_dump): Likewise. (calculate_capacity): Likewise. (verify_block): Likewise. (field_str): Likewise. (symbols_update): Likewise. (symbol_field_forward): Likewise. (numeric_group_attrs): Return uint64_t rather than size_t and change inherit variable to from size_t to uint64_t. (symbol_field_add): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" or HOST_SIZE_T_PRINT_DEC instead of "%zd" and cast corresponding argument to fmt_size_t. (symbol_file_record_sizes): Likewise. (new_literal_add): Likewise. (temporaries_t::dump): Likewise. (temporaries_t::~temporaries_t): Likewise. (cbl_field_t::internalize): Likewise. (cbl_label_t::str): Likewise. (symbol_label_add): Likewise. (symbol_program_add): Likewise. (symbol_forward_names): Likewise. (symbol_forward_to): Likewise. (cbl_file_key_t::deforward): Likewise. (cbl_file_key_t::str): Likewise. * gengen.cc (show_type): Use PRId64 instead of "ld". (gg_unique_in_function): Use HOST_SIZE_T_PRINT_DEC instead of %ld and cast corresponding argument to fmt_size_t. * scan.l: Add %top section with #include "config.h". * genmath.cc (parser_add): Use HOST_SIZE_T_PRINT_DEC instead of %ld and cast corresponding argument to fmt_size_t. (parser_subtract): Likewise. * parse.y: Include "config.h" before <fstream>. Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" and cast corresponding argument to fmt_size_t. Change type of sign_attrs, group_sign and type_implies from size_t to uint64_t. (ast_call): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" or HOST_SIZE_T_PRINT_DEC instead of "%zd" and cast corresponding argument to fmt_size_t. (perform_t::ec_labels_t::new_label): Likewise. (ast_add): Likewise. (stringify_src_t::dump): Likewise. (lang_check_failed): Likewise. (numstr2i): Use GCC_PRISZ instead of "z" and pass address of temporary with fmt_size_t type to sscanf and then copy it over. (dump_spans): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" or HOST_SIZE_T_PRINT_DEC instead of "%zd" and cast corresponding argument to fmt_size_t. (initialize_statement): Likewise. (dump_inspect_oper): Likewise. (new_literal): Likewise. (literal_subscripts_valid): Likewise. (eval_subject_t::label): Likewise. * genapi.cc (level_88_helper): Likewise. (parser_call_targets_dump): Likewise. (combined_name): Use HOST_SIZE_T_PRINT_DEC instead of "%ld" and cast corresponding argument to fmt_size_t. (section_label): Likewise. (paragraph_label): Likewise. (leave_procedure): Likewise. (parser_perform): Likewise. (parser_perform_times): Likewise. (internal_perform_through): Likewise. (internal_perform_through_times): Likewise. (parser_enter_program): Likewise. (parser_init_list_size): Likewise. (parser_init_list): Likewise. (psa_FldLiteralN): Likewise. (psa_FldBlob): Likewise. (parser_assign): Likewise. (parser_free): Pass p->field->name to dbgmsg. (parser_division): Use HOST_SIZE_T_PRINT_DEC instead of "%ld" and cast corresponding argument to fmt_size_t. (perform_outofline_before_until): Likewise. (perform_outofline_after_until): Likewise. (perform_outofline_testafter_varying): Likewise. (perform_outofline_before_varying): Likewise. (perform_inline_testbefore_varying): Likewise. (parser_inspect): Change n_operations parameter type from unsigned long to size_t. (parser_intrinsic_callv): Use HOST_SIZE_T_PRINT_DEC instead of "%zd" and cast corresponding argument to fmt_size_t. (parser_bitop): Use HOST_SIZE_T_PRINT_HEX_PURE instead of "%lx" and cast corresponding argument to fmt_size_t. (parser_bitwise_op): Likewise. (parser_program_hierarchy): Use HOST_SIZE_T_PRINT_DEC instead of "%ld" and cast corresponding argument to fmt_size_t. (parser_set_handled): Use HOST_SIZE_T_PRINT_HEX_PURE instead of "%lx" and cast corresponding argument to fmt_size_t. (parser_set_numeric): Use HOST_SIZE_T_PRINT_DEC instead of "%ld" and cast corresponding argument to fmt_size_t. (psa_global): Likewise. Use HOST_SIZE_T_PRINT_HEX_PURE instead of "%lx" and cast corresponding argument to fmt_size_t. (psa_new_var_decl): Use HOST_SIZE_T_PRINT_DEC instead of "%ld" and cast corresponding argument to fmt_size_t. (parser_symbol_add): Use HOST_SIZE_T_PRINT_DEC instead of "%zd" or HOST_SIZE_T_PRINT_HEX_PURE instead of "%lx" and cast corresponding argument to fmt_size_t. * cdf-copy.cc: Include "config.h" first. * scan_ante.h (trim_location): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or "%d" and cast corresponding argument to fmt_size_t. * structs.cc (create_cblc_field_t): Use ULONGLONG instead of SIZE for "attr". * cbldiag.h (dbgmsg): Add ATTRIBUTE_PRINTF_1. * gcobolspec.cc (lang_specific_driver): Use HOST_SIZE_T_PRINT_DEC instead of "%ld" and cast corresponding argument to fmt_size_t. * parse_ante.h (literal_of): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" or HOST_SIZE_T_PRINT_DEC instead of "%zd" and cast corresponding argument to fmt_size_t. (evaluate_elem_t::dump): Likewise. (arith_t::another_pair): Likewise. (current_t::end_program): Likewise. (file_add): Likewise. (implicit_paragraph): Likewise. (implicit_section): Likewise. (data_division_ready): Use HOST_SIZE_T_PRINT_DEC instead of "%d" and cast corresponding argument to fmt_size_t. * symbols.h (struct cbl_field_t): Change attr member type from size_t to uint64_t. (cbl_field_t::set_attr): Change return type from size_t to uint64_t. (cbl_field_t::clear_attr): Likewise. (function_descr_t::init): Use HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" or GCC_PRISZ instead of "z" or HOST_SIZE_T_PRINT_DEC instead of "%zd" and cast corresponding argument to fmt_size_t. (cbl_perform_tgt_t::dump): Likewise. (numeric_group_attrs): Change return type from size_t to uint64_t. --- libgcobol/valconv.cc.jj 2025-04-05 15:37:29.731054891 +0200 +++ libgcobol/valconv.cc 2025-04-05 15:38:05.024579514 +0200 @@ -67,7 +67,7 @@ __gg__realloc_if_necessary(char **dest, new_size |= new_size>>4; new_size |= new_size>>8; new_size |= new_size>>16; - new_size |= new_size>>32; + new_size |= (new_size>>16)>>16; *dest_size = new_size + 1; *dest = (char *)realloc(*dest, *dest_size); } --- libgcobol/common-defs.h.jj 2025-04-05 15:37:29.439058824 +0200 +++ libgcobol/common-defs.h 2025-04-05 15:38:05.024579514 +0200 @@ -146,7 +146,7 @@ enum cbl_field_type_t { * A field is padded (in the unjustified direction) either with 0 or SPC. * (But maybe the fill character should just be an explicit character.) */ -enum cbl_field_attr_t : size_t { +enum cbl_field_attr_t : uint64_t { none_e = 0x0000000000, figconst_1_e = 0x0000000001, // This needs to be 1 - don't change the position figconst_2_e = 0x0000000002, // This needs to be 2 --- libgcobol/gcobolio.h.jj 2025-04-05 15:37:29.559057208 +0200 +++ libgcobol/gcobolio.h 2025-04-05 15:38:05.024579514 +0200 @@ -55,7 +55,7 @@ typedef struct cblc_field_t struct cblc_field_t *parent;// This field's immediate parent field size_t occurs_lower; // non-zero for a table size_t occurs_upper; // non-zero for a table - size_t attr; // See cbl_field_attr_t + unsigned long long attr; // See cbl_field_attr_t signed char type; // A one-byte copy of cbl_field_type_t signed char level; // This variable's level in the naming heirarchy signed char digits; // Digits specified in PIC string; e.g. 5 for 99v999 --- gcc/cobol/util.cc.jj 2025-03-21 10:09:38.000000000 +0100 +++ gcc/cobol/util.cc 2025-04-05 17:50:02.612120507 +0200 @@ -324,8 +324,9 @@ is_numeric_edited( const char picture[] break; default: numed_message = xasprintf("invalid PICTURE character " - "'%c' at offset %zu in '%s'", - *p, p - picture, picture); + "'%c' at offset " HOST_SIZE_T_PRINT_UNSIGNED + " in '%s'", + *p, (fmt_size_t)(p - picture), picture); break; } @@ -370,10 +371,12 @@ normalize_picture( char picture[] ) assert(pmatch[2].rm_so == pmatch[1].rm_eo + 1); // character paren number p = picture + pmatch[2].rm_so; len = 0; - if( 1 != sscanf(p, "%zu", &len) ) { + fmt_size_t lenf = 0; + if( 1 != sscanf(p, "%" GCC_PRISZ "u", &lenf) ) { dbgmsg("%s:%d: no number found in '%s'", __func__, __LINE__, p); goto irregular; } + len = lenf; if( len == 0 ) { dbgmsg("%s:%d: ZERO length found in '%s'", __func__, __LINE__, p); goto irregular; @@ -985,7 +988,8 @@ cbl_refer_t::subscripts_set( const std:: const char * cbl_refer_t::str() const { static char subscripts[64]; - sprintf(subscripts, "(%u of %zu dimensions)", nsubscript, dimensions(field)); + sprintf(subscripts, "(%u of " HOST_SIZE_T_PRINT_UNSIGNED " dimensions)", + nsubscript, (fmt_size_t)dimensions(field)); char *output = xasprintf("%s %s %s", field? field_str(field) : "(none)", 0 < dimensions(field)? subscripts : "", @@ -1031,10 +1035,10 @@ struct move_corresponding_field { tgt.field = cbl_field_of(symbol_at(elem.second)); if( yydebug ) { - dbgmsg("move_corresponding:%d: SRC: %3zu %s", __LINE__, - elem.first, src.str()); - dbgmsg("move_corresponding:%d: to %3zu %s", __LINE__, - elem.second, tgt.str()); + dbgmsg("move_corresponding:%d: SRC: %3" GCC_PRISZ "u %s", __LINE__, + (fmt_size_t)elem.first, src.str()); + dbgmsg("move_corresponding:%d: to %3" GCC_PRISZ "u %s", __LINE__, + (fmt_size_t)elem.second, tgt.str()); } parser_move(tgt, src); @@ -1138,8 +1142,9 @@ valid_move( const struct cbl_field_t *tg if( yydebug && ! retval ) { auto bad = std::find_if( p, pend, []( char ch ) { return ! ISDIGIT(ch); } ); - dbgmsg("%s:%d: offending character '%c' at position %zu", - __func__, __LINE__, *bad, bad - p); + dbgmsg("%s:%d: offending character '%c' at position " + HOST_SIZE_T_PRINT_UNSIGNED, + __func__, __LINE__, *bad, (fmt_size_t)(bad - p)); } } break; @@ -1444,9 +1449,9 @@ locally_unique( size_t program, const pr procref_base_t full_ref(section_name, ref.paragraph()); if( getenv(__func__) ) { - dbgmsg("%s: %zu for ref %s of '%s' (line %d) " + dbgmsg("%s: " HOST_SIZE_T_PRINT_UNSIGNED " for ref %s of '%s' (line %d) " "in %s of '%s' (as %s of '%s')", __func__, - procedures.count(full_ref), + (fmt_size_t)procedures.count(full_ref), ref.paragraph(), ref.section(), ref.line_number(), key.paragraph(), key.section(), full_ref.paragraph(), full_ref.section() ); @@ -1474,7 +1479,8 @@ procedure_definition_add( size_t program procdef_t key( section_name, paragraph_name, isym ); if( getenv(__func__) ) { - dbgmsg("%s: #%3zu %s of %s", __func__, isym, paragraph_name, section_name); + dbgmsg("%s: #%3" GCC_PRISZ "u %s of %s", + __func__, (fmt_size_t)isym, paragraph_name, section_name); } current_procedure = programs[program].insert( make_pair(key, procedures_t::mapped_type()) ); @@ -1519,9 +1525,10 @@ ambiguous_reference( size_t program ) { is_unique(program, proc.first) ); if( proc.second.end() != ambiguous ) { if( yydebug || getenv("symbol_label_add")) { - dbgmsg("%s: %s of '%s' has %zu potential matches", __func__, + dbgmsg("%s: %s of '%s' has " HOST_SIZE_T_PRINT_UNSIGNED + " potential matches", __func__, ambiguous->paragraph(), ambiguous->section(), - procedures.count(*ambiguous)); + (fmt_size_t)procedures.count(*ambiguous)); } return new procref_t(*ambiguous); } @@ -1585,9 +1592,11 @@ public: symbol_elem_t *rgroup, type_t type ) : lgroup(lgroup), rgroup(rgroup), type(type) { - dbgmsg( "%s:%d: for #%zu %s and #%zu %s on line %d", __func__, __LINE__, - symbol_index(lgroup), cbl_field_of(lgroup)->name, - symbol_index(rgroup), cbl_field_of(rgroup)->name, yylineno ); + dbgmsg( "%s:%d: for #" HOST_SIZE_T_PRINT_UNSIGNED + " %s and #" HOST_SIZE_T_PRINT_UNSIGNED " %s on line %d", + __func__, __LINE__, + (fmt_size_t)symbol_index(lgroup), cbl_field_of(lgroup)->name, + (fmt_size_t)symbol_index(rgroup), cbl_field_of(rgroup)->name, yylineno ); } static bool @@ -1664,8 +1673,9 @@ corresponding_fields( cbl_field_t *lhs, lhsg.a = symbols_begin(field_index(lhs)); lhsg.z = std::find_if( lhsg.a, symbols_end(), next_group(lhsg.a) ); - dbgmsg("%s:%d: examining %zu symbols after %s", __func__, __LINE__, - lhsg.z - lhsg.a, lhs->name); + dbgmsg("%s:%d: examining " HOST_SIZE_T_PRINT_UNSIGNED " symbols after %s", + __func__, __LINE__, + (fmt_size_t)(lhsg.z - lhsg.a), lhs->name); find_corresponding finder( symbol_at(field_index(lhs)), symbol_at(field_index(rhs)), type ); @@ -1673,8 +1683,9 @@ corresponding_fields( cbl_field_t *lhs, output.erase(0); - dbgmsg( "%s:%d: %s and %s have %zu corresponding fields", - __func__, __LINE__, lhs->name, rhs->name, output.size() ); + dbgmsg( "%s:%d: %s and %s have " HOST_SIZE_T_PRINT_UNSIGNED + " corresponding fields", + __func__, __LINE__, lhs->name, rhs->name, (fmt_size_t)output.size() ); return output; } @@ -1793,7 +1804,8 @@ class unique_stack : public std::stack<i "----- ---- --------" "----------------------------------------"); for( const auto& v : c ) { - dbgmsg( " %4zu %4d %s", c.size() - --n, v.lineno, no_wd(wd, v.name) ); + dbgmsg( " %4" GCC_PRISZ "u %4d %s", + (fmt_size_t)(c.size() - --n), v.lineno, no_wd(wd, v.name) ); } } else { dbgmsg("unable to get current working directory: %m"); @@ -1831,7 +1843,8 @@ bool cobol_filename( const char *name, i auto p = old_filenames.find(name); if( p == old_filenames.end() ) { for( auto& elem : old_filenames ) { - dbgmsg("%6zu %-30s", elem.second, elem.first.c_str()); + dbgmsg("%6" GCC_PRISZ "u %-30s", + (fmt_size_t)elem.second, elem.first.c_str()); } cbl_errx( "logic error: missing inode for %s", name); } --- gcc/cobol/lexio.cc.jj 2025-03-18 18:47:19.745709779 +0100 +++ gcc/cobol/lexio.cc 2025-04-05 18:10:14.123753536 +0200 @@ -28,6 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include <ext/stdio_filebuf.h> #include "cobol-system.h" #include "cbldiag.h" @@ -260,9 +261,10 @@ recognize_replacements( filespan_t mfile found = span_t( cm[1].first, cm[1].second ); if( yy_flex_debug ) { size_t n = count_newlines(mfile.data, found.p); - dbgmsg("%s:%d first '%.*s' is on line %zu (offset %zu)", __func__, __LINE__, + dbgmsg("%s:%d first '%.*s' is on line " HOST_SIZE_T_PRINT_UNSIGNED + " (offset " HOST_SIZE_T_PRINT_UNSIGNED ")", __func__, __LINE__, directive.before.size(), directive.before.p, - ++n, found.p - mfile.data); + (fmt_size_t)++n, (fmt_size_t)(found.p - mfile.data)); } } else { dbgmsg("%s:%d not found: '%s' in \n'%.*s'", __func__, __LINE__, @@ -290,8 +292,10 @@ recognize_replacements( filespan_t mfile if( yy_flex_debug ) { size_t n = std::count((const char *)mfile.data, recognized.before.p, '\n'); - dbgmsg( "%s:%d: line %zu @ %zu: '%s'\n/%.*s/%.*s/", __func__, __LINE__, - ++n, next.found.p - mfile.data, + dbgmsg( "%s:%d: line " HOST_SIZE_T_PRINT_UNSIGNED + " @ " HOST_SIZE_T_PRINT_UNSIGNED ": '%s'\n/%.*s/%.*s/", + __func__, __LINE__, + (fmt_size_t)++n, (fmt_size_t)(next.found.p - mfile.data), next.directive.before.p, int(recognized.before.size()), recognized.before.p, int(recognized.after.size()), recognized.after.p ); @@ -308,9 +312,10 @@ recognize_replacements( filespan_t mfile next.found = span_t( cm[1].first, cm[1].second ); size_t n = std::count((const char *)mfile.data, next.found.p, '\n'); if( false ) - dbgmsg("%s:%d next '%.*s' will be on line %zu (offset %zu)", __func__, __LINE__, + dbgmsg("%s:%d next '%.*s' will be on line " HOST_SIZE_T_PRINT_UNSIGNED + " (offset " HOST_SIZE_T_PRINT_UNSIGNED ")", __func__, __LINE__, next.directive.before.size(), next.directive.before.p, - ++n, next.found.p - mfile.data); + (fmt_size_t)++n, (fmt_size_t)(next.found.p - mfile.data)); } pnext = std::min_element(futures.begin(), futures.end()); } @@ -344,8 +349,10 @@ check_source_format_directive( filespan_ break; } mfile.cur = const_cast<char*>(cm[0].second); - dbgmsg( "%s:%d: %s format set, on line %zu", __func__, __LINE__, - indicator.column == 7? "FIXED" : "FREE", mfile.lineno() ); + dbgmsg( "%s:%d: %s format set, on line " HOST_SIZE_T_PRINT_UNSIGNED, + __func__, __LINE__, + indicator.column == 7? "FIXED" : "FREE", + (fmt_size_t)mfile.lineno() ); erase_line(const_cast<char*>(cm[0].first), const_cast<char*>(cm[0].second)); } @@ -722,7 +729,7 @@ parse_replacing_pair( const char *stmt, // This eliminated a compiler warning about "format-overflow" yywarn("CDF syntax error"); } - pair.stmt = span_t(0UL, stmt); + pair.stmt = span_t(size_t(0), stmt); pair.replace = replace_t(); } return pair; @@ -762,9 +769,9 @@ parse_replace_pairs( const char *stmt, c // Report findings. if( false && yy_flex_debug ) { for( size_t i=0; i < cm.size(); i++ ) { - dbgmsg("%s: %s %zu: '%.*s'", __func__, + dbgmsg("%s: %s " HOST_SIZE_T_PRINT_UNSIGNED ": '%.*s'", __func__, cm[i].matched? "Pair" : "pair", - i, + (fmt_size_t)i, cm[i].matched? int(cm[i].length()) : 0, cm[i].matched? cm[i].first : ""); } @@ -823,9 +830,10 @@ parse_replace_pairs( const char *stmt, c } if( yy_flex_debug ) { - dbgmsg( "%s:%d: %s: %zu pairs parsed from '%.*s'", __func__, __LINE__, - parsed.done()? "done" : "not done", - pairs.size(), parsed.stmt.size(), parsed.stmt.p ); + dbgmsg( "%s:%d: %s: " HOST_SIZE_T_PRINT_UNSIGNED " pairs parsed from '%.*s'", + __func__, __LINE__, + parsed.done() ? "done" : "not done", + (fmt_size_t)pairs.size(), parsed.stmt.size(), parsed.stmt.p ); int i = 0; for( const auto& replace : pairs ) { dbgmsg("%s:%d:%4d: '%s' => '%s'", __func__, __LINE__, @@ -907,9 +915,10 @@ parse_copy_directive( filespan_t& mfile if( yy_flex_debug ) { size_t nnl = 1 + count_newlines(mfile.data, copy_stmt.p); size_t nst = 1 + count_newlines(copy_stmt.p, copy_stmt.pend); - dbgmsg("%s:%d: line %zu: COPY directive is %zu lines '%.*s'", + dbgmsg("%s:%d: line " HOST_SIZE_T_PRINT_UNSIGNED + ": COPY directive is " HOST_SIZE_T_PRINT_UNSIGNED " lines '%.*s'", __func__, __LINE__, - nnl, nst, copy_stmt.size(), copy_stmt.p); + (fmt_size_t)nnl, (fmt_size_t)nst, copy_stmt.size(), copy_stmt.p); } } } @@ -922,7 +931,8 @@ parse_copy_directive( filespan_t& mfile outcome.partial_line = span_t(mfile.cur, copy_stmt.p); if( yy_flex_debug ) { - dbgmsg("%zu expressions", std::count(pattern, pattern + sizeof(pattern), '(')); + dbgmsg(HOST_SIZE_T_PRINT_UNSIGNED " expressions", + (fmt_size_t)std::count(pattern, pattern + sizeof(pattern), '(')); int i = 0; for( const auto& m : cm ) { if( m.matched ) @@ -1006,8 +1016,9 @@ parse_replace_last_off( filespan_t& mfil } } - dbgmsg( "%s:%d: line %zu: parsed '%.*s', ", __func__, __LINE__, - mfile.lineno(), int(cm[0].length()), cm[0].first ); + dbgmsg( "%s:%d: line " HOST_SIZE_T_PRINT_UNSIGNED ": parsed '%.*s', ", + __func__, __LINE__, + (fmt_size_t)mfile.lineno(), int(cm[0].length()), cm[0].first ); // Remove statement from input erase_line(const_cast<char*>(cm[0].first), @@ -1039,20 +1050,23 @@ parse_replace_text( filespan_t& mfile ) gcc_assert(mfile.line_length() > 2); if( pend[-1] == '\n' ) pend -= 2; auto len = int(pend - mfile.cur); - dbgmsg("%s:%d: line %zu: parsing '%.*s", __func__, __LINE__, - current_lineno, len, mfile.cur); + dbgmsg("%s:%d: line " HOST_SIZE_T_PRINT_UNSIGNED ": parsing '%.*s", + __func__, __LINE__, + (fmt_size_t)current_lineno, len, mfile.cur); } if( ! regex_search(mfile.ccur(), (const char *)mfile.eodata, cm, re) ) { - dbgmsg( "%s:%d: line %zu: not a REPLACE statement:\n'%.*s'", - __func__, __LINE__, current_lineno, + dbgmsg( "%s:%d: line " HOST_SIZE_T_PRINT_UNSIGNED + ": not a REPLACE statement:\n'%.*s'", + __func__, __LINE__, (fmt_size_t)current_lineno, int(mfile.line_length()), mfile.cur ); return span_t(); } // Report findings. if( yy_flex_debug ) { - dbgmsg("%zu expressions", std::count(pattern, pattern + sizeof(pattern), '(')); + dbgmsg(HOST_SIZE_T_PRINT_UNSIGNED " expressions", + (fmt_size_t)std::count(pattern, pattern + sizeof(pattern), '(')); int i = 0; for( const auto& m : cm ) { if( m.matched ) @@ -1081,8 +1095,10 @@ parse_replace_text( filespan_t& mfile ) replace_directives.push( replacements ); if( yy_flex_debug ) { - dbgmsg( "%s:%d: line %zu: %zu pairs parsed from '%.*s'", __func__, __LINE__, - current_lineno, replacements.size(), int(replace_stmt.size()), replace_stmt.p ); + dbgmsg( "%s:%d: line " HOST_SIZE_T_PRINT_UNSIGNED ": " HOST_SIZE_T_PRINT_UNSIGNED + " pairs parsed from '%.*s'", __func__, __LINE__, + (fmt_size_t)current_lineno, (fmt_size_t)replacements.size(), + int(replace_stmt.size()), replace_stmt.p ); for( const auto& replace : replacements ) { int i = 0; dbgmsg("%s:%d:%4d: '%s' => '%s'", __func__, __LINE__, @@ -1162,8 +1178,9 @@ bytespan_t::append( const char *input, c #if LEXIO auto nq = std::count_if(data, eodata, isquote); dbgmsg("%s:%3d: input ------ '%.*s'", __func__, __LINE__, int(eoinput - input), input); - dbgmsg("%s:%3d: precondition '%.*s' (%zu: %s)", __func__, __LINE__, - int(size()), data, nq, in_string()? "in string" : "not in string"); + dbgmsg("%s:%3d: precondition '%.*s' (" HOST_SIZE_T_PRINT_UNSIGNED ": %s)", + __func__, __LINE__, + int(size()), data, (fmt_size_t)nq, in_string()? "in string" : "not in string"); #endif if( !in_string() ) { // Remove trailing space unless it's part of a literal. while(data < eodata && ISSPACE(eodata[-1])) eodata--; @@ -1561,8 +1578,8 @@ cdftext::map_file( int fd ) { cbl_err( "%s: could not prepare map file from FIFO %d", __func__, input); } - if( false ) dbgmsg("%s: copied %ld bytes from FIFO", - __func__, nout); + if( false ) dbgmsg("%s: copied " HOST_SIZE_T_PRINT_DEC " bytes from FIFO", + __func__, (fmt_size_t)nout); } } } while( S_ISFIFO(sb.st_mode) ); @@ -1772,8 +1789,8 @@ cdftext::process_file( filespan_t mfile, std::copy_if(copied.erased_lines.p, copied.erased_lines.pend, ofs, []( char ch ) { return ch == '\n'; } ); struct { int in, out; filespan_t mfile; } copy; - dbgmsg("%s:%d: line %zu, opening %s on fd %d", __func__, __LINE__, - mfile.lineno(), + dbgmsg("%s:%d: line " HOST_SIZE_T_PRINT_UNSIGNED ", opening %s on fd %d", + __func__, __LINE__,mfile.lineno(), copybook.source(), copybook.current()->fd); copy.in = copybook.current()->fd; copy.mfile = free_form_reference_format( copy.in ); --- gcc/cobol/symfind.cc.jj 2025-04-02 12:35:23.490144759 +0200 +++ gcc/cobol/symfind.cc 2025-04-05 17:51:19.219085473 +0200 @@ -147,13 +147,14 @@ dump_symbol_map2( const field_key_t& key for( auto candidate : candidates ) { char *tmp = fields; - fields = xasprintf("%s%s %3zu", tmp? tmp : "", sep, candidate); + fields = xasprintf("%s%s %3" GCC_PRISZ "u", + tmp? tmp : "", sep, (fmt_size_t)candidate); sep[0] = ','; free(tmp); } - dbgmsg( "%s:%d: %3zu %s {%s}", __func__, __LINE__, - key.program, key.name, fields ); + dbgmsg( "%s:%d: %3" GCC_PRISZ "u %s {%s}", __func__, __LINE__, + (fmt_size_t)key.program, key.name, fields ); free(fields); } @@ -179,7 +180,8 @@ dump_symbol_map_value( const char name[] for( ; p != value.second.end(); p++ ) { char *tmp = ancestry; - ancestry = xasprintf("%s%s %3zu", tmp? tmp : "", sep, *p); + ancestry = xasprintf("%s%s %3" GCC_PRISZ "u", + tmp? tmp : "", sep, (fmt_size_t)*p); sep[0] = ','; free(tmp); } @@ -202,8 +204,8 @@ field_structure( symbol_elem_t& sym ) { if( getenv(__func__) && sym.type == SymField ) { const auto& field = *cbl_field_of(&sym); - dbgmsg("%s: #%zu %s: '%s' is_data_field: %s", __func__, - symbol_index(&sym), cbl_field_type_str(field.type), field.name, + dbgmsg("%s: #" HOST_SIZE_T_PRINT_UNSIGNED " %s: '%s' is_data_field: %s", __func__, + (fmt_size_t)symbol_index(&sym), cbl_field_type_str(field.type), field.name, is_data_field(sym)? "yes" : "no" ); } if( !is_data_field(sym) ) return none; @@ -234,8 +236,8 @@ field_structure( symbol_elem_t& sym ) { } if( getenv(__func__) && yydebug ) { - dbgmsg( "%s:%d: '%s' has %zu ancestors", __func__, __LINE__, - elem.first.c_str(), elem.second.size() ); + dbgmsg( "%s:%d: '%s' has " HOST_SIZE_T_PRINT_UNSIGNED " ancestors", __func__, __LINE__, + elem.first.c_str(), (fmt_size_t)elem.second.size() ); dump_symbol_map_value(__func__, elem); } @@ -268,8 +270,9 @@ build_symbol_map() { symbol_map.erase(sym_name_t("")); if( yydebug ) { - dbgmsg( "%s:%d: %zu of %zu symbols inserted into %zu in symbol_map", - __func__, __LINE__, nsym, end, symbol_map.size() ); + dbgmsg( "%s:%d: " HOST_SIZE_T_PRINT_UNSIGNED " of " + HOST_SIZE_T_PRINT_UNSIGNED " symbols inserted into %zu in symbol_map", + __func__, __LINE__, nsym, end, (fmt_size_t)symbol_map.size() ); if( getenv(__func__) ) { for( const auto& elem : symbol_map ) { @@ -298,8 +301,8 @@ public: } protected: void dump_key( const char tag[], const symbol_map_t::key_type& key ) const { - dbgmsg( "symbol_map key: %s { %3zu %3zu %s }", - tag, key.program, key.parent, key.name ); + dbgmsg( "symbol_map key: %s { %3" GCC_PRISZ "u %3" GCC_PRISZ "u %s }", + tag, (fmt_size_t)key.program, (fmt_size_t)key.parent, key.name ); } }; @@ -480,14 +483,16 @@ symbol_match2( size_t program, sep = ""; for( auto field : fields ) { char *partial = fieldstr; - int asret = asprintf(&fieldstr, "%s%s%zu", partial? partial : "", sep, field); + int asret = asprintf(&fieldstr, "%s%s" HOST_SIZE_T_PRINT_UNSIGNED, + partial? partial : "", sep, (fmt_size_t)field); assert(asret); sep = ", "; assert(fieldstr); free(partial); } - dbgmsg("%s: '%s' matches %zu fields: {%s}", __func__, ancestry, fields.size(), fieldstr); + dbgmsg("%s: '%s' matches " HOST_SIZE_T_PRINT_UNSIGNED " fields: {%s}", + __func__, ancestry, (fmt_size_t)fields.size(), fieldstr); free(fieldstr); } free(ancestry); @@ -558,8 +563,8 @@ symbol_find( size_t program, std::list<c return std::pair<symbol_elem_t *, bool>(NULL, false); } if( yydebug ) { - dbgmsg( "%s:%d: '%s' has %zu possible matches", - __func__, __LINE__, names.back(), items.size() ); + dbgmsg( "%s:%d: '%s' has " HOST_SIZE_T_PRINT_UNSIGNED " possible matches", + __func__, __LINE__, names.back(), (fmt_size_t)items.size() ); std::for_each( items.begin(), items.end(), dump_symbol_map_value1 ); } } @@ -588,8 +593,10 @@ symbol_find_of( size_t program, std::lis symbol_map_t input = symbol_match(program, names); if( getenv(__func__) && input.size() != 1 ) { - dbgmsg( "%s:%d: '%s' has %zu candidates for group %zu", - __func__, __LINE__, names.back(), input.size(), group ); + dbgmsg( "%s:%d: '%s' has " HOST_SIZE_T_PRINT_UNSIGNED + " candidates for group " HOST_SIZE_T_PRINT_UNSIGNED, + __func__, __LINE__, names.back(), (fmt_size_t)input.size(), + (fmt_size_t)group ); std::for_each( input.begin(), input.end(), dump_symbol_map_value1 ); } @@ -604,8 +611,8 @@ symbol_find_of( size_t program, std::lis } if( yydebug ) { - dbgmsg( "%s:%d: '%s' has %zu possible matches", - __func__, __LINE__, names.back(), input.size() ); + dbgmsg( "%s:%d: '%s' has " HOST_SIZE_T_PRINT_UNSIGNED " possible matches", + __func__, __LINE__, names.back(), (fmt_size_t)input.size() ); std::for_each( input.begin(), input.end(), dump_symbol_map_value1 ); } --- gcc/cobol/cdf.y.jj 2025-03-25 21:11:06.757409903 +0100 +++ gcc/cobol/cdf.y 2025-04-05 18:16:15.602870786 +0200 @@ -245,8 +245,8 @@ apply_cdf_turn( exception_turns_t& turns %printer { fprintf(yyo, "%s '%s'", keyword_str($$.token), $$.string? $$.string : "<nil>" ); } <cdfarg> -%printer { fprintf(yyo, "%ld '%s'", - $$.number, $$.string? $$.string : "" ); } <cdfval> +%printer { fprintf(yyo, HOST_SIZE_T_PRINT_DEC " '%s'", + (fmt_size_t)$$.number, $$.string? $$.string : "" ); } <cdfval> %type <string> NAME NUMSTR LITERAL PSEUDOTEXT %type <string> LSUB RSUB SUBSCRIPT @@ -828,7 +828,8 @@ defined_cmd( const char arg[] ) if( yydebug ) { if( cdf_name->second.is_numeric() ) { - dbgmsg("%s: added -D %s = %ld", __func__, name, cdf_name->second.as_number()); + dbgmsg("%s: added -D %s = " HOST_SIZE_T_PRINT_DEC, + __func__, name, (fmt_size_t)cdf_name->second.as_number()); } else { dbgmsg("%s: added -D %s = \"%s\"", __func__, name, cdf_name->second.string); } --- gcc/cobol/symbols.cc.jj 2025-04-05 15:37:29.155062649 +0200 +++ gcc/cobol/symbols.cc 2025-04-05 18:16:44.468480915 +0200 @@ -28,6 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" @@ -820,24 +821,24 @@ cbl_field_t::size() const { return field_size(this); } -size_t +uint64_t cbl_field_t::set_attr( cbl_field_attr_t attr ) { if( attr == signable_e ) { if( ! has_attr(attr) && this->var_decl_node != NULL ) { parser_field_attr_set(this, attr); } } - return this->attr |= size_t(attr); + return this->attr |= uint64_t(attr); } -size_t +uint64_t cbl_field_t::clear_attr( cbl_field_attr_t attr ) { if( attr == signable_e ) { if( this->var_decl_node != nullptr && has_attr(attr) ) { parser_field_attr_set(this, attr, false); } } - return this->attr &= ~size_t(attr); + return this->attr &= ~uint64_t(attr); } static uint32_t @@ -895,9 +896,10 @@ update_block_offsets( struct symbol_elem if( getenv(__func__) ) { cbl_field_t *field = cbl_field_of(block); - dbgmsg( "%s: offset is %3zu for %2u %-30s #%3zu P%zu", - __func__, field->offset, field->level, field->name, - symbol_index(block), field->parent ); + dbgmsg( "%s: offset is %3" GCC_PRISZ "u for %2u %-30s " + "#%3" GCC_PRISZ "u P" HOST_SIZE_T_PRINT_UNSIGNED, + __func__, (fmt_size_t)field->offset, field->level, field->name, + (fmt_size_t)symbol_index(block), (fmt_size_t)field->parent ); } struct symbol_elem_t *e = block; @@ -930,9 +932,10 @@ update_block_offsets( struct symbol_elem } if( getenv(__func__) ) { - dbgmsg( "%s: offset is %3zu for %2u %-30s #%3zu P%zu", - __func__, field->offset, field->level, field->name, - symbol_index(e), field->parent ); + dbgmsg( "%s: offset is %3" GCC_PRISZ "u for %2u %-30s " + "#%3" GCC_PRISZ "u P" HOST_SIZE_T_PRINT_UNSIGNED, + __func__, (fmt_size_t)field->offset, field->level, field->name, + (fmt_size_t)symbol_index(e), (fmt_size_t)field->parent ); } if( field->type == FldGroup ) { @@ -1020,8 +1023,8 @@ symbol_field_capacity( const cbl_field_t size_t size = std::accumulate( symbol_at(bog), symbol_at_impl(eog), 0, sym_field_size::capacity ); - if(true) dbgmsg("%s: %02u %s.data.capacity was computed as %zu", __func__, - field->level, field->name, size); + if(true) dbgmsg("%s: %02u %s.data.capacity was computed as " HOST_SIZE_T_PRINT_UNSIGNED, + __func__, field->level, field->name, (fmt_size_t)size); return size; } @@ -1035,14 +1038,15 @@ has_odo( const symbol_elem_t& e ) { struct cbl_field_t * symbol_find_odo_debug( cbl_field_t * field ) { size_t bog = field_index(field), eog = end_of_group(bog); - dbgmsg("%s: %s is #%zu - #%zu of %zu, ends at %s", __func__, - field->name, bog, eog, symbols.nelem, + dbgmsg("%s: %s is #" HOST_SIZE_T_PRINT_UNSIGNED " - #" HOST_SIZE_T_PRINT_UNSIGNED + " of " HOST_SIZE_T_PRINT_UNSIGNED ", ends at %s", __func__, + field->name, (fmt_size_t)bog, (fmt_size_t)eog, (fmt_size_t)symbols.nelem, eog == symbols.nelem? "[end]" : cbl_field_of(symbol_at(eog))->name ); auto e = std::find_if( symbol_at(bog), symbol_at_impl(eog, true), has_odo ); if( e != symbol_at_impl(eog, true) ) { - dbgmsg("%s: %s has ODO at #%zu (return '%s')", __func__, - field->name, symbol_index(e), + dbgmsg("%s: %s has ODO at #" HOST_SIZE_T_PRINT_UNSIGNED " (return '%s')", __func__, + field->name, (fmt_size_t)symbol_index(e), cbl_field_of(e)->name ); } return e == symbol_at_impl(eog, true)? NULL : cbl_field_of(e); @@ -1067,8 +1071,8 @@ symbols_dump( size_t first, bool header if( !yydebug ) return 0; if( header ) { - fprintf(stderr, "Symbol Table has %zu elements\n", - symbols_end() - symbols_begin()); + fprintf(stderr, "Symbol Table has " HOST_SIZE_T_PRINT_UNSIGNED " elements\n", + (fmt_size_t)(symbols_end() - symbols_begin())); } for( struct symbol_elem_t *e = symbols_begin(first); e < symbols_end(); e++ ) { @@ -1076,25 +1080,26 @@ symbols_dump( size_t first, bool header switch(e->type) { case SymFilename: - s = xasprintf("%4zu %-18s %s", e->program, + s = xasprintf("%4" GCC_PRISZ "u %-18s %s", (fmt_size_t)e->program, "Filename", e->elem.filename); break; case SymDataSection: - s = xasprintf("%4zu %-18s line %d", e->program, + s = xasprintf("%4" GCC_PRISZ "u %-18s line %d", (fmt_size_t)e->program, cbl_section_of(e)->name(), cbl_section_of(e)->line); break; case SymFunction: - s = xasprintf("%4zu %-15s %s", e->program, + s = xasprintf("%4" GCC_PRISZ "u %-15s %s", (fmt_size_t)e->program, "Function", e->elem.function.name); break; case SymField: { auto field = cbl_field_of(e); char *odo_str = NULL; if( field->occurs.depending_on != 0 ) { - odo_str = xasprintf("odo %zu", field->occurs.depending_on ); + odo_str = xasprintf("odo " HOST_SIZE_T_PRINT_UNSIGNED, + (fmt_size_t)field->occurs.depending_on ); } ninvalid += cbl_field_of(e)->type == FldInvalid? 1 : 0; - s = xasprintf("%4zu %-18s %s (%s)", e->program, + s = xasprintf("%4" GCC_PRISZ "u %-18s %s (%s)", (fmt_size_t)e->program, cbl_field_type_str(cbl_field_of(e)->type) + 3, field_str(cbl_field_of(e)), odo_str? odo_str : @@ -1102,7 +1107,7 @@ symbols_dump( size_t first, bool header } break; case SymLabel: - s = xasprintf("%4zu %-18s %s", e->program, + s = xasprintf("%4" GCC_PRISZ "u %-18s %s", (fmt_size_t)e->program, "Labe1l", e->elem.label.str()); if( LblProgram == cbl_label_of(e)->type ) { const auto& L = *cbl_label_of(e); @@ -1114,31 +1119,35 @@ symbols_dump( size_t first, bool header } break; case SymSpecial: - s = xasprintf("%4zu %-18s id=%2d, %s", e->program, + s = xasprintf("%4" GCC_PRISZ "u %-18s id=%2d, %s", (fmt_size_t)e->program, "Special", e->elem.special.id, e->elem.special.name); break; case SymAlphabet: - s = xasprintf("%4zu %-18s encoding=%2d, '%s'", e->program, "Alphabet", + s = xasprintf("%4" GCC_PRISZ "u %-18s encoding=%2d, '%s'", + (fmt_size_t)e->program, "Alphabet", int(e->elem.alphabet.encoding), e->elem.alphabet.name); break; case SymFile: - s = xasprintf("%4zu %-18s %-20s", e->program, + s = xasprintf("%4" GCC_PRISZ "u %-18s %-20s", (fmt_size_t)e->program, "File", e->elem.file.name); { char same_as[26] = ""; if( cbl_file_of(e)->same_record_as > 0 ) { - sprintf(same_as, "s%3zu", cbl_file_of(e)->same_record_as); + sprintf(same_as, "s%3" GCC_PRISZ "u", + (fmt_size_t)cbl_file_of(e)->same_record_as); } const char *type = file_org_str(e->elem.file.org); char *part = s; - s = xasprintf("%s %-4s %s %s %s{%zu-%zu} status=#%zu", + s = xasprintf("%s %-4s %s %s %s{" HOST_SIZE_T_PRINT_UNSIGNED "-" + HOST_SIZE_T_PRINT_UNSIGNED "} status=#" + HOST_SIZE_T_PRINT_UNSIGNED, part, same_as, type, e->elem.file.keys_str(), cbl_file_of(e)->varies()? "varies " : "", - cbl_file_of(e)->varying_size.min, - cbl_file_of(e)->varying_size.max, - cbl_file_of(e)->user_status); + (fmt_size_t)cbl_file_of(e)->varying_size.min, + (fmt_size_t)cbl_file_of(e)->varying_size.max, + (fmt_size_t)cbl_file_of(e)->user_status); free(part); } break; @@ -1146,7 +1155,8 @@ symbols_dump( size_t first, bool header dbgmsg("%s: cannot dump symbol type %d", __func__, e->type); continue; } - fprintf(stderr, "%4zu: %s\n", e - symbols_begin(), s); + fprintf(stderr, "%4" GCC_PRISZ "u: %s\n", + (fmt_size_t)(e - symbols_begin()), s); free(s); } return ninvalid; @@ -1258,7 +1268,8 @@ static struct symbol_elem_t * } if(yydebug && group->type != FldGroup) { - dbgmsg("Field #%zu '%s' is not a group", symbol_index(e), group->name); + dbgmsg("Field #" HOST_SIZE_T_PRINT_UNSIGNED " '%s' is not a group", + (fmt_size_t)symbol_index(e), group->name); symbols_dump(symbols.first_program, true); } if( group->type == FldInvalid ) return e; @@ -1373,10 +1384,12 @@ verify_block( const struct symbol_elem_t "", "ndx", "off", "type", "par", "lvl", "name", ds, ds, ds, ds, ds, ds, ds, ds, ds ); } - dbgmsg( "%s:%d: %3zu %3zu %-18s %3zu %02d %-16s %2u/%u/%d = '%s'", - __func__, __LINE__, e - symbols.elems, field->offset, + dbgmsg( "%s:%d: %3" GCC_PRISZ "u %3" GCC_PRISZ "u %-18s " + "%3" GCC_PRISZ "u %02d %-16s %2u/%u/%d = '%s'", + __func__, __LINE__, (fmt_size_t)(e - symbols.elems), + (fmt_size_t)field->offset, cbl_field_type_str(field->type), - field->parent, field->level, field->name, + (fmt_size_t)field->parent, field->level, field->name, field->data.capacity, field->data.digits, field->data.rdigits, field->data.initial? field->data.initial : "(none)" ); } @@ -1534,8 +1547,8 @@ field_str( const cbl_field_t *field ) { for( size_t i=0; i < field->occurs.nkey; i++ ) { updown[i] = field->occurs.keys[i].ascending? 'A' : 'D'; } - snprintf(name, sizeof(name), "%s[%zu]%s", - field->name, field->occurs.ntimes(), updown.data()); + snprintf(name, sizeof(name), "%s[" HOST_SIZE_T_PRINT_UNSIGNED "]%s", + field->name, (fmt_size_t)field->occurs.ntimes(), updown.data()); } } @@ -1544,7 +1557,7 @@ field_str( const cbl_field_t *field ) { char offset[32] = ""; if( field->level > 1 ) { - sprintf( offset, "off%3zu", field->offset ); + sprintf( offset, "off%3" GCC_PRISZ "u", (fmt_size_t)field->offset ); } char parredef = @@ -1611,8 +1624,8 @@ field_str( const cbl_field_t *field ) { }; pend += snprintf(pend, string + sizeof(string) - pend, - "%c%3zu %-6s %c%c%c %2u{%3u,%u,%d = %s} (%s), line %d", - parredef, field->parent, offset, + "%c%3" GCC_PRISZ "u %-6s %c%c%c %2u{%3u,%u,%d = %s} (%s), line %d", + parredef, (fmt_size_t)field->parent, offset, (field->attr & global_e)? 'G' : 0x20, (field->attr & external_e)? 'E' : 0x20, storage_type, @@ -1852,18 +1865,19 @@ symbols_update( size_t first, bool parse field->line, field->level_str(), field->name); } else { - dbgmsg("%s: error: data item %s #%zu '%s' capacity %u rejected", + dbgmsg("%s: error: data item %s #" HOST_SIZE_T_PRINT_UNSIGNED + " '%s' capacity %u rejected", __func__, 3 + cbl_field_type_str(field->type), - isym, field->name, field->data.capacity); + (fmt_size_t)isym, field->name, field->data.capacity); } } return 0; } if(! (field->data.memsize == 0 || field_size(field) <= field->data.memsize) ) { - dbgmsg( "%s:%d: #%zu: invalid: %s", __func__, __LINE__, - symbol_index(p), field_str(cbl_field_of(p)) ); + dbgmsg( "%s:%d: #" HOST_SIZE_T_PRINT_UNSIGNED ": invalid: %s", __func__, __LINE__, + (fmt_size_t)symbol_index(p), field_str(cbl_field_of(p)) ); } assert(field->data.memsize == 0 || field_size(field) <= field_memsize(field)); assert( !(field->data.memsize > 0 && symbol_explicitly_redefines(field)) ); @@ -1986,7 +2000,8 @@ symbol_field_forward( size_t index ) { assert( index < symbols.nelem ); symbol_elem_t *e = symbol_at(index); if( (e->type != SymField) ) { - dbgmsg("%s: logic error: #%zu is %s", __func__, index, symbol_type_str(e->type)); + dbgmsg("%s: logic error: #" HOST_SIZE_T_PRINT_UNSIGNED " is %s", + __func__, (fmt_size_t)index, symbol_type_str(e->type)); } assert(e->type == SymField); @@ -2496,9 +2511,9 @@ symbol_alphabet_add( size_t program, str return symbol_add(&sym); } -size_t +uint64_t numeric_group_attrs( const cbl_field_t *field ) { - static const size_t inherit = signable_e | leading_e | separate_e | big_endian_e; + static const uint64_t inherit = signable_e | leading_e | separate_e | big_endian_e; static_assert(sizeof(cbl_field_t::type) < sizeof(inherit), "need bigger type"); assert(field); if( field->type == FldNumericDisplay || field->type == FldGroup ) { @@ -2593,7 +2608,8 @@ symbol_field_add( size_t program, struct if( (s = getenv(__func__)) != NULL ) { if( s[0] == 'D' ) { for( struct symbol_elem_t *e = symbols_begin(); e < symbols_end(); e++ ) { - fprintf(stderr, "%zu: %s ", e - symbols.elems, symbol_type_str(e->type)); + fprintf(stderr, HOST_SIZE_T_PRINT_UNSIGNED ": %s ", + (fmt_size_t)(e - symbols.elems), symbol_type_str(e->type)); if( e->type == SymField ) { fprintf(stderr, "%s = %s", cbl_field_of(e)->name, cbl_field_of(e)->data.initial); @@ -2602,8 +2618,8 @@ symbol_field_add( size_t program, struct } } - dbgmsg( "%s:%d: %3zu %-18s %02d %-16s %u/%u/%d = '%s'", __func__, __LINE__, - field->offset, + dbgmsg( "%s:%d: %3" GCC_PRISZ "u %-18s %02d %-16s %u/%u/%d = '%s'", + __func__, __LINE__, (fmt_size_t)field->offset, cbl_field_type_str(field->type), field->level, field->name, field->data.capacity, field->data.digits, field->data.rdigits, field->data.initial? field->data.initial : "(none)" ); @@ -3121,9 +3137,10 @@ symbol_file_record_sizes( struct cbl_fil output.max = cbl_field_of(&*p.second)->data.capacity; if( yydebug && getenv(__func__) ) { - dbgmsg("%s: %s: min '%s' %zu, max '%s' %zu", __func__, file->name, - cbl_field_of(&*p.first)->name, output.min, - cbl_field_of(&*p.second)->name, output.max); + dbgmsg("%s: %s: min '%s' " HOST_SIZE_T_PRINT_UNSIGNED ", max '%s' " + HOST_SIZE_T_PRINT_UNSIGNED, __func__, file->name, + cbl_field_of(&*p.first)->name, (fmt_size_t)output.min, + cbl_field_of(&*p.second)->name, (fmt_size_t)output.max); } assert(output.min > 0 && "min record size is 0"); @@ -3351,10 +3368,10 @@ new_literal_add( const char initial[], u static size_t literal_count = 1; sprintf(field->name, - "%s%c_%zd", + "%s%c_" HOST_SIZE_T_PRINT_DEC, "_literal", field->type == FldLiteralA ? 'a' : 'n', - literal_count++); + (fmt_size_t)literal_count++); return parser_symbol_add2(field); } @@ -3383,14 +3400,15 @@ new_literal( uint32_t len, const char in void temporaries_t::dump() const { extern int yylineno; - char *output = xasprintf("%4d: %zu Literals", yylineno, literals.size()); + char *output = xasprintf("%4d: " HOST_SIZE_T_PRINT_UNSIGNED " Literals", + yylineno, (fmt_size_t)literals.size()); for( const auto& elem : used ) { if( ! elem.second.empty() ) { char *so_far = output; - output = xasprintf("%s, %zu %s", + output = xasprintf("%s, " HOST_SIZE_T_PRINT_UNSIGNED " %s", so_far, - elem.second.size(), + (fmt_size_t)elem.second.size(), 3 + cbl_field_type_str(elem.first)); free(so_far); } @@ -3401,7 +3419,8 @@ temporaries_t::dump() const { temporaries_t::~temporaries_t() { if( getenv( "symbol_temporaries_free" ) ) { - dbgmsg("%s: %zu literals", __func__, literals.size()); + dbgmsg("%s: " HOST_SIZE_T_PRINT_UNSIGNED " literals", + __func__, (fmt_size_t)literals.size()); for( const auto& elem : literals ) { const literal_an& key(elem.first); fprintf(stderr, "%c '%s'\n", key.is_quoted? 'Q' : ' ', key.value.c_str()); @@ -3649,7 +3668,8 @@ cbl_field_t::internalize() { const char *eoi = data.initial + data.capacity, *p; char nullitude[64] = "no null"; if( (p = std::find(data.initial, eoi, '\0')) != eoi ) { - sprintf(nullitude, "NUL @ %zu", p - data.initial); + sprintf(nullitude, "NUL @ " HOST_SIZE_T_PRINT_UNSIGNED, + (fmt_size_t)(p - data.initial)); } dbgmsg("%s:%d: before: %-15s %-20s: '%.*s'{%u}, %s", __func__, __LINE__, 3 + cbl_field_type_str(type), name, @@ -3678,7 +3698,8 @@ cbl_field_t::internalize() { const char *eoi = data.initial + data.capacity, *p; char nullitude[64] = "no null"; if( (p = std::find(data.initial, eoi, '\0')) != eoi ) { - sprintf(nullitude, "NUL @ %zu", p - data.initial); + sprintf(nullitude, "NUL @ " HOST_SIZE_T_PRINT_UNSIGNED, + (fmt_size_t)(p - data.initial)); } dbgmsg("%s:%d: after: %-15s %-20s: '%.*s'{%u}, %s", __func__, __LINE__, "", name, @@ -3703,8 +3724,8 @@ cbl_label_t::str() const { buf = xasprintf("%-12s %s top level [%s], line %d", type_str() + 3, name, mangled_name, line); } else { - buf = xasprintf("%-12s %s OF #%zu '%s' [%s], line %d", - type_str() + 3, name, parent, + buf = xasprintf("%-12s %s OF #" HOST_SIZE_T_PRINT_UNSIGNED " '%s' [%s], line %d", + type_str() + 3, name, (fmt_size_t)parent, cbl_label_of(symbol_at(parent))->name, mangled_name, line); } @@ -3806,9 +3827,10 @@ symbol_label_add( size_t program, cbl_la { if( getenv(__func__) ) { const cbl_label_t *L = input; - dbgmsg( "%s:%d: %-5s #%3zu %-9s '%s' of '%s' at line %d", __func__, __LINE__, + dbgmsg( "%s:%d: %-5s #%3" GCC_PRISZ "u %-9s '%s' of '%s' at line %d", + __func__, __LINE__, "input", - size_t(0), + (fmt_size_t)0, L->type_str()+3, L->name, L->parent? cbl_label_of(symbol_at(L->parent))->name : "", @@ -3826,10 +3848,10 @@ symbol_label_add( size_t program, cbl_la if( getenv(__func__) ) { const cbl_label_t *L = label; - dbgmsg( "%s:%d: %-5s #%3zu %-9s '%s' of '%s' at line %d", + dbgmsg( "%s:%d: %-5s #%3" GCC_PRISZ "u %-9s '%s' of '%s' at line %d", __func__, __LINE__, verb, - symbol_elem_of(L) - symbols_begin(), + (fmt_size_t)(symbol_elem_of(L) - symbols_begin()), L->type_str()+3, L->name, L->parent? cbl_label_of(symbol_at(L->parent))->name : "", @@ -3841,7 +3863,8 @@ symbol_label_add( size_t program, cbl_la // Set the program's mangled name, dehyphenated and uniqified by parent index. if( input->type == LblProgram ) { char *psz = cobol_name_mangler(input->name); - input->mangled_name = xasprintf("%s.%zu", psz, input->parent); + input->mangled_name = xasprintf("%s." HOST_SIZE_T_PRINT_UNSIGNED, + psz, (fmt_size_t)input->parent); free(psz); } @@ -3862,8 +3885,9 @@ symbol_label_add( size_t program, cbl_la if( getenv(__func__) ) { const cbl_label_t *L = cbl_label_of(e); - dbgmsg( "%s:%d: added #%3zu %-9s '%s' of '%s' at line %d", __func__, __LINE__, - e - symbols_begin(), + dbgmsg( "%s:%d: added #%3" GCC_PRISZ "u %-9s '%s' of '%s' at line %d", + __func__, __LINE__, + (fmt_size_t)(e - symbols_begin()), L->type_str()+3, L->name, L->parent? cbl_label_of(symbol_at(L->parent))->name : "", @@ -3919,7 +3943,8 @@ symbol_program_add( size_t program, cbl_ // Set the program's mangled name, dehyphenated and uniqified by parent index. char *psz = cobol_name_mangler(input->name); - elem.elem.label.mangled_name = xasprintf("%s.%zu", psz, input->parent); + elem.elem.label.mangled_name = xasprintf("%s." HOST_SIZE_T_PRINT_UNSIGNED, + psz, (fmt_size_t)input->parent); free(psz); e = std::find_if( symbols_begin(program), symbols_end(), @@ -4610,8 +4635,8 @@ symbol_forward_names( size_t ifield ) { for( auto sym = symbols_begin(ifield); sym && sym->type == SymField; ) { const cbl_field_t *field = cbl_field_of(sym); if( !(field->type == FldForward) ) { - dbgmsg("%s:%d: logic error, not FldForward: #%zu %s", - __func__, __LINE__, symbol_index(sym), field_str(field)); + dbgmsg("%s:%d: logic error, not FldForward: #" HOST_SIZE_T_PRINT_UNSIGNED " %s", + __func__, __LINE__, (fmt_size_t)symbol_index(sym), field_str(field)); } assert(field->type == FldForward); @@ -4634,8 +4659,9 @@ symbol_forward_to( size_t fwd ) { if( !elem.second ) { const auto& field = *cbl_field_of(symbols_begin(fwd)); if( yydebug ) - dbgmsg("%s:%d: no symbol found for #%zu %s %s", __func__, __LINE__, - fwd, cbl_field_type_str(field.type), field.name); + dbgmsg("%s:%d: no symbol found for #" HOST_SIZE_T_PRINT_UNSIGNED " %s %s", + __func__, __LINE__, + (fmt_size_t)fwd, cbl_field_type_str(field.type), field.name); return fwd; } @@ -4656,8 +4682,9 @@ cbl_file_key_t::deforward( size_t ifile const auto field = cbl_field_of(symbol_at(ifield)); if( is_forward(field) && yydebug ) { - dbgmsg("%s:%d: key %d: #%zu %s of %s is %s", "deforward", __LINE__, - keys[ifile]++, ifield, field->name, file->name, + dbgmsg("%s:%d: key %d: #" HOST_SIZE_T_PRINT_UNSIGNED " %s of %s is %s", + "deforward", __LINE__, + keys[ifile]++, (fmt_size_t)ifield, field->name, file->name, cbl_field_type_str(field->type) + 3); } @@ -4711,7 +4738,7 @@ cbl_file_key_t::str() const { *p++ = '['; for( auto f = fields; f < fields + nfield; f++) { - auto n = sprintf(p, "%s%zu", sep, *f); + auto n = sprintf(p, "%s" HOST_SIZE_T_PRINT_UNSIGNED, sep, (fmt_size_t)*f); p += n; sep = ", "; } --- gcc/cobol/gengen.cc.jj 2025-04-04 20:51:20.026005093 +0200 +++ gcc/cobol/gengen.cc 2025-04-05 17:06:13.430554980 +0200 @@ -393,13 +393,13 @@ show_type(tree type) case REAL_TYPE: sprintf(ach, - "%3ld-bit REAL", + "%3" PRId64 "-bit REAL", TREE_INT_CST_LOW(TYPE_SIZE(type))); break; case INTEGER_TYPE: sprintf(ach, - "%3ld-bit %s INT", + "%3" PRId64 "-bit %s INT", TREE_INT_CST_LOW(TYPE_SIZE(type)), (TYPE_UNSIGNED(type) ? "unsigned" : " signed")); break; @@ -892,7 +892,8 @@ gg_unique_in_function(const char *var_na char *retval = (char *)xmalloc(strlen(var_name)+32); if( (vs_scope == vs_stack || vs_scope == vs_static) ) { - sprintf(retval, "%s.%ld", var_name, current_function->program_id_number); + sprintf(retval, "%s." HOST_SIZE_T_PRINT_DEC, var_name, + (fmt_size_t)current_function->program_id_number); } else { --- gcc/cobol/scan.l.jj 2025-03-21 10:47:51.864366969 +0100 +++ gcc/cobol/scan.l 2025-04-05 18:44:20.092118991 +0200 @@ -27,6 +27,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +%top{ +#include "config.h" +} %{ #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" --- gcc/cobol/genmath.cc.jj 2025-03-28 17:25:06.216107121 +0100 +++ gcc/cobol/genmath.cc 2025-04-05 17:06:13.432554953 +0200 @@ -725,7 +725,7 @@ parser_add( size_t nC, cbl_num_result_t SHOW_PARSE { SHOW_PARSE_HEADER - fprintf(stderr, " A[%ld]:", nA); + fprintf(stderr, " A[" HOST_SIZE_T_PRINT_DEC "]:", (fmt_size_t)nA); for(size_t i=0; i<nA; i++) { if(i > 0) @@ -737,7 +737,7 @@ parser_add( size_t nC, cbl_num_result_t fprintf(stderr, "%s", format==giving_e? " GIVING" : ""); - fprintf(stderr, " C[%ld]:", nC); + fprintf(stderr, " C[" HOST_SIZE_T_PRINT_DEC "]:", (fmt_size_t)nC); for(size_t i=0; i<nC; i++) { if(i > 0) @@ -1412,7 +1412,7 @@ parser_subtract(size_t nC, cbl_num_resul SHOW_PARSE { SHOW_PARSE_HEADER - fprintf(stderr, " A[%ld]:", nA); + fprintf(stderr, " A[" HOST_SIZE_T_PRINT_DEC "]:", (fmt_size_t)nA); for(size_t i=0; i<nA; i++) { if(i > 0) @@ -1422,7 +1422,7 @@ parser_subtract(size_t nC, cbl_num_resul fprintf(stderr, "%s", A[i].field->name); } - fprintf(stderr, " B[%ld]:", nB); + fprintf(stderr, " B[" HOST_SIZE_T_PRINT_DEC "]:", (fmt_size_t)nB); for(size_t i=0; i<nB; i++) { if(i > 0) @@ -1432,7 +1432,7 @@ parser_subtract(size_t nC, cbl_num_resul fprintf(stderr, "%s", B[i].field->name); } - fprintf(stderr, " C[%ld]:", nC); + fprintf(stderr, " C[" HOST_SIZE_T_PRINT_DEC "]:", (fmt_size_t)nC); for(size_t i=0; i<nC; i++) { if(i > 0) --- gcc/cobol/parse.y.jj 2025-04-03 08:24:02.331236166 +0200 +++ gcc/cobol/parse.y 2025-04-05 18:17:31.902840252 +0200 @@ -28,6 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ %code requires { + #include "config.h" #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" #include "coretypes.h" @@ -278,6 +279,7 @@ } %{ +#include "config.h" #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" #include "coretypes.h" @@ -944,18 +946,20 @@ %printer { fprintf(yyo, "%s (token %d)", keyword_str($$), $$ ); } relop %printer { fprintf(yyo, "'%s'", $$? $$ : "" ); } NAME <string> -%printer { fprintf(yyo, "%s'%.*s'{%zu} %s", $$.prefix, int($$.len), $$.data, $$.len, +%printer { fprintf(yyo, "%s'%.*s'{" HOST_SIZE_T_PRINT_UNSIGNED "} %s", + $$.prefix, int($$.len), $$.data, (fmt_size_t)$$.len, $$.symbol_name()); } <literal> -%printer { fprintf(yyo, "%s (1st of %zu)", +%printer { fprintf(yyo, "%s (1st of " HOST_SIZE_T_PRINT_UNSIGNED ")", $$->targets.empty()? "" : $$->targets.front().refer.field->name, - $$->targets.size() ); } <targets> -%printer { fprintf(yyo, "#%zu: %s", - is_temporary($$)? 0 : field_index($$), + (fmt_size_t)$$->targets.size() ); } <targets> +%printer { fprintf(yyo, "#" HOST_SIZE_T_PRINT_UNSIGNED ": %s", + is_temporary($$)? 0 : (fmt_size_t)field_index($$), $$? name_of($$) : "<nil>" ); } name -%printer { fprintf(yyo, "{%zu-%zu}", $$.min, $$.max ); } <min_max> +%printer { fprintf(yyo, "{" HOST_SIZE_T_PRINT_UNSIGNED "-" HOST_SIZE_T_PRINT_UNSIGNED "}", + (fmt_size_t)$$.min, (fmt_size_t)$$.max ); } <min_max> %printer { fprintf(yyo, "{%s}", $$? "+/-" : "" ); } signed -%printer { fprintf(yyo, "{%s of %zu}", - teed_up_names().front(), teed_up_names().size() ); } qname +%printer { fprintf(yyo, "{%s of " HOST_SIZE_T_PRINT_UNSIGNED "}", + teed_up_names().front(), (fmt_size_t) teed_up_names().size() ); } qname %printer { fprintf(yyo, "{%d}", $$ ); } <number> %printer { fprintf(yyo, "'%s'", $$.string ); } <numstr> %printer { const char *s = string_of($$); @@ -967,9 +971,9 @@ $$.low? (const char*) $$.low : "", $$.high? (const char*) $$.high : "", $$.also? "+" : "" ); } <colseq> -%printer { fprintf(yyo, "{%s, %zu parameters}", +%printer { fprintf(yyo, "{%s, " HOST_SIZE_T_PRINT_UNSIGNED " parameters}", name_of($$.ffi_name->field), !$$.using_params? 0 : - $$.using_params->elems.size()); } call_body + (fmt_size_t)$$.using_params->elems.size()); } call_body %printer { fprintf(yyo, "%s <- %s", data_category_str($$.category), name_of($$.replacement->field)); } init_by @@ -3622,12 +3626,12 @@ data_descr1: level_name // SIGN clause valid only with "S" in picture if( $field->type == FldNumericDisplay && !is_signable($field) ) { - static const size_t sign_attrs = leading_e | separate_e; + static const uint64_t sign_attrs = leading_e | separate_e; static_assert(sizeof(sign_attrs) == sizeof($field->attr), "size matters"); // remove inapplicable inherited sign attributes - size_t group_sign = group_attr($field) & sign_attrs; + uint64_t group_sign = group_attr($field) & sign_attrs; $field->attr &= ~group_sign; if( $field->attr & sign_attrs ) { @@ -3783,7 +3787,7 @@ data_clauses: data_clause // If any implied TYPE bits are on in addition to // type_clause_e, they're in conflict. - static const size_t type_implies = + static const uint64_t type_implies = // ALIGNED clause not implemented blank_zero_clause_e | justified_clause_e | picture_clause_e | sign_clause_e | synched_clause_e | usage_clause_e; @@ -4283,8 +4287,9 @@ usage_clause1: usage COMPUTATIONAL[comp is_numeric(redefined->type) && redefined->size() == 4) { // For now, we allow POINTER to expand a 32-bit item to 64 bits. field->data.capacity = sizeof(void *); - dbgmsg("%s: expanding #%zu %s capacity %u => %u", __func__, - field_index(redefined), redefined->name, + dbgmsg("%s: expanding #" HOST_SIZE_T_PRINT_UNSIGNED + " %s capacity %u => %u", __func__, + (fmt_size_t)field_index(redefined), redefined->name, redefined->data.capacity, field->data.capacity); redefined->embiggen(); @@ -4538,7 +4543,7 @@ sign_clause: sign_is sign_leading sig if( $sign_leading ) { field->attr |= leading_e; } else { - field->attr &= ~size_t(leading_e); // turn off in case inherited + field->attr &= ~uint64_t(leading_e); // turn off in case inherited field->attr |= signable_e; } if( $sign_separate ) field->attr |= separate_e; @@ -11077,10 +11082,11 @@ void ast_call( const YYLTYPE& loc, cbl_r } if( getenv("ast_call") ) { - dbgmsg("%s: calling %s returning %s with %zu args:", __func__, + dbgmsg("%s: calling %s returning %s with " HOST_SIZE_T_PRINT_UNSIGNED + " args:", __func__, name_of(name.field), (returning.field)? returning.field->name : "[none]", - narg); + (fmt_size_t)narg); for( size_t i=0; i < narg; i++ ) { const char *crv = "?"; switch(args[i].crv) { @@ -11089,8 +11095,8 @@ void ast_call( const YYLTYPE& loc, cbl_r case by_content_e: crv = "con"; break; case by_value_e: crv = "val"; break; } - dbgmsg("%s: %4zu: %s @%p %s", __func__, - i, crv, args[i].refer.field, args[i].refer.field->name); + dbgmsg("%s: %4" GCC_PRISZ "u: %s @%p %s", __func__, + (fmt_size_t)i, crv, args[i].refer.field, args[i].refer.field->name); } } parser_call( name, returning, narg, args, except, not_except, is_function ); @@ -11426,7 +11432,7 @@ perform_t::ec_labels_t::new_label( cbl_l { size_t n = 1 + symbols_end() - symbols_begin(); cbl_name_t name; - sprintf(name, "_perf_%s_%zu", role, n); + sprintf(name, "_perf_%s_" HOST_SIZE_T_PRINT_UNSIGNED, role, (fmt_size_t)n); return label_add( type, name, yylineno ); } @@ -11674,8 +11680,9 @@ ast_add( arith_t *arith ) { pA = use_any(arith->A, A); if( getenv(__func__) ) { - dbgmsg("%s:%d: %-12s C{%zu %p} A{%zu %p}", __func__, __LINE__, - arith->format_str(), nC, pC, nA, pA ); + dbgmsg("%s:%d: %-12s C{" HOST_SIZE_T_PRINT_UNSIGNED " %p} A{" + HOST_SIZE_T_PRINT_UNSIGNED " %p}", __func__, __LINE__, + arith->format_str(), (fmt_size_t)nC, pC, (fmt_size_t)nA, pA ); } parser_add( nC, pC, nA, pA, arith->format, arith->on_error, arith->not_error ); @@ -11753,8 +11760,8 @@ struct stringify_src_t : public cbl_stri } static void dump( const cbl_string_src_t& src ) { - dbgmsg( "%s:%d:, %zu inputs delimited by %s:", __func__, __LINE__, - src.ninput, + dbgmsg( "%s:%d:, " HOST_SIZE_T_PRINT_UNSIGNED " inputs delimited by %s:", + __func__, __LINE__, (fmt_size_t)src.ninput, src.delimited_by.field? field_str(src.delimited_by.field) : "SIZE" ); std::for_each(src.inputs, src.inputs + src.ninput, dump_input); } @@ -11906,8 +11913,8 @@ lang_check_failed (const char* file, int void ast_inspect( cbl_refer_t& input, bool backward, ast_inspect_list_t& inspects ) { if( yydebug ) { - dbgmsg("%s:%d: INSPECT %zu operations on %s, line %d", __func__, __LINE__, - inspects.size(), input.field->name, yylineno); + dbgmsg("%s:%d: INSPECT " HOST_SIZE_T_PRINT_UNSIGNED " operations on %s, line %d", + __func__, __LINE__, (fmt_size_t)inspects.size(), input.field->name, yylineno); } std::for_each(inspects.begin(), inspects.end(), dump_inspect); auto array = inspects.as_array(); @@ -12048,6 +12055,7 @@ static REAL_VALUE_TYPE numstr2i( const char input[], radix_t radix ) { REAL_VALUE_TYPE output; size_t integer = 0; + fmt_size_t integerf = 0; int erc=0; switch( radix ) { @@ -12059,7 +12067,8 @@ numstr2i( const char input[], radix_t ra } break; case hexadecimal_e: - erc = sscanf(input, "%zx", &integer); + erc = sscanf(input, "%" GCC_PRISZ "x", &integerf); + integer = integer; real_from_integer (&output, VOIDmode, integer, UNSIGNED); break; case boolean_e: @@ -12291,11 +12300,15 @@ dump_spans( size_t isym, assert( nrange == 0 || nrange == spans.size() ); if( isym != field_index(table) ) { - dbgmsg("%s:%d: isym %zu is not #%zu %02u %s", __func__, __LINE__, - isym, field_index(table), table->level, table->name); - } - dbgmsg( "%s: [%zu] #%zu %s has %zu spans and %zu subtables", - __func__, depth, isym, table->name, nrange, subtables.size() ); + dbgmsg("%s:%d: isym " HOST_SIZE_T_PRINT_UNSIGNED + " is not #" HOST_SIZE_T_PRINT_UNSIGNED " %02u %s", __func__, __LINE__, + (fmt_size_t)isym, (fmt_size_t)field_index(table), table->level, table->name); + } + dbgmsg( "%s: [" HOST_SIZE_T_PRINT_UNSIGNED "] #" HOST_SIZE_T_PRINT_UNSIGNED + " %s has " HOST_SIZE_T_PRINT_UNSIGNED " spans and " HOST_SIZE_T_PRINT_UNSIGNED + " subtables", + __func__, (fmt_size_t)depth, (fmt_size_t)isym, table->name, + (fmt_size_t)nrange, (fmt_size_t)subtables.size() ); for( auto span : spans ) { unsigned int last_level = 0; const char *last_name = "<none>"; @@ -12311,20 +12324,23 @@ dump_spans( size_t isym, return tbl.offset == offset; }); if( p != subtables.end() ) { - sprintf(at_subtable, "(subtable #%zu)", p->isym); + sprintf(at_subtable, "(subtable #" HOST_SIZE_T_PRINT_UNSIGNED ")", + (fmt_size_t)p->isym); } - dbgmsg("\t %02u %-20s to %02u %-20s: %3zu-%zu %s", + dbgmsg("\t %02u %-20s to %02u %-20s: %3" GCC_PRISZ "u-" HOST_SIZE_T_PRINT_UNSIGNED " %s", span.first->level, span.first->name, last_level, last_name, - nrange? ranges[i].first : 1, - nrange? ranges[i].second : 0, + nrange? (fmt_size_t)ranges[i].first : 1, + nrange? (fmt_size_t)ranges[i].second : 0, at_subtable); i++; } if( ! subtables.empty() ) { - dbgmsg("\ttable #%zu has %zu subtables", isym, subtables.size()); + dbgmsg("\ttable #" HOST_SIZE_T_PRINT_UNSIGNED " has " HOST_SIZE_T_PRINT_UNSIGNED + " subtables", (fmt_size_t)isym, (fmt_size_t)subtables.size()); for( auto tbl : subtables ) { - dbgmsg("\t #%zu @ %4zu", tbl.isym, tbl.offset); + dbgmsg("\t #" HOST_SIZE_T_PRINT_UNSIGNED " @ %4" GCC_PRISZ "u", + (fmt_size_t)tbl.isym, (fmt_size_t)tbl.offset); } } } @@ -12390,10 +12406,10 @@ initialize_statement( const cbl_num_resu size_t depth = 0 ) { if( getenv(__func__) ) { - dbgmsg("%s:%d: %2zu: %s (%s%zuR)", - __func__, __LINE__, depth, target.refer.str(), + dbgmsg("%s:%d: %2" GCC_PRISZ "u: %s (%s" HOST_SIZE_T_PRINT_UNSIGNED "R)", + __func__, __LINE__, (fmt_size_t)depth, target.refer.str(), with_filler? "F" : "", - replacements.size()); + (fmt_size_t)replacements.size()); } const cbl_refer_t& tgt( target.refer ); assert(dimensions(tgt.field) == tgt.nsubscript || 0 < depth); @@ -12579,9 +12595,11 @@ initialize_statement( std::list<cbl_num_ static void dump_inspect_oper( const cbl_inspect_oper_t& op ) { - dbgmsg("\t%s: %zu \"matches\", %zu \"replaces\"", + dbgmsg("\t%s: " HOST_SIZE_T_PRINT_UNSIGNED + " \"matches\", " HOST_SIZE_T_PRINT_UNSIGNED " \"replaces\"", bound_str(op.bound), - op.matches? op.n_identifier_3 : 0, op.replaces? op.n_identifier_3 : 0); + op.matches? (fmt_size_t)op.n_identifier_3 : 0, + op.replaces? (fmt_size_t)op.n_identifier_3 : 0); if( op.matches ) std::for_each(op.matches, op.matches + op.n_identifier_3, dump_inspect_match); if( op.replaces ) @@ -12669,10 +12687,11 @@ cbl_field_t * new_literal( const literal_t& lit, enum cbl_field_attr_t attr ) { bool zstring = lit.prefix[0] == 'Z'; if( !zstring && lit.data[lit.len] != '\0' ) { - dbgmsg("%s:%d: line %d, no NUL terminator '%-*.*s'{%zu/%zu}", + dbgmsg("%s:%d: line %d, no NUL terminator '%-*.*s'{" + HOST_SIZE_T_PRINT_UNSIGNED "/" HOST_SIZE_T_PRINT_UNSIGNED "}", __func__, __LINE__, yylineno, int(lit.len), int(lit.len), - lit.data, strlen(lit.data), lit.len); + lit.data, (fmt_size_t)strlen(lit.data), (fmt_size_t)lit.len); } assert(zstring || lit.data[lit.len] == '\0'); @@ -12915,7 +12934,8 @@ literal_subscripts_valid( YYLTYPE loc, c const char *upper_phrase = ""; if( ! oob->occurs.bounds.fixed_size() ) { static char ub[32] = "boo"; - sprintf(ub, " to %lu", oob->occurs.bounds.upper); + sprintf(ub, " to " HOST_SIZE_T_PRINT_UNSIGNED, + (fmt_size_t)oob->occurs.bounds.upper); upper_phrase = ub; } @@ -12985,7 +13005,8 @@ eval_subject_t::label( const char skel[] cbl_label_t label = protolabel; label.line = yylineno; size_t n = 1 + symbols_end() - symbols_begin(); - snprintf(label.name, sizeof(label.name), "_eval_%s_%zu", skel, n); + snprintf(label.name, sizeof(label.name), + "_eval_%s_" HOST_SIZE_T_PRINT_UNSIGNED, skel, (fmt_size_t)n); auto output = symbol_label_add( PROGRAM, &label ); return output; } --- gcc/cobol/genapi.cc.jj 2025-04-04 20:51:20.011005292 +0200 +++ gcc/cobol/genapi.cc 2025-04-05 18:21:14.813829534 +0200 @@ -426,7 +426,8 @@ level_88_helper(size_t parent_capacity, nbuild += first_name_length; } } - returned_size = sprintf(retval, "%zdA", nbuild); + returned_size = sprintf(retval, HOST_SIZE_T_PRINT_DEC "A", + (fmt_size_t)nbuild); memcpy(retval + returned_size, builder, nbuild); returned_size += nbuild; free(first_name); @@ -734,12 +735,14 @@ parser_call_target_convention( tree func void parser_call_targets_dump() { - dbgmsg( "call targets for #%zu", current_program_index() ); + dbgmsg( "call targets for #" HOST_SIZE_T_PRINT_UNSIGNED, + (fmt_size_t)current_program_index() ); for( const auto& elem : call_targets ) { const auto& k = elem.first; const auto& v = elem.second; - fprintf(stderr, "\t#%-3zu %s calls %s ", - k.caller, cbl_label_of(symbol_at(k.caller))->name, k.called); + fprintf(stderr, "\t#%-3" GCC_PRISZ "u %s calls %s ", + (fmt_size_t)k.caller, cbl_label_of(symbol_at(k.caller))->name, + k.called); char ch = '['; for( auto func : v ) { fprintf( stderr, "%c %s", ch, IDENTIFIER_POINTER(DECL_NAME(func.node)) ); @@ -2306,9 +2309,11 @@ combined_name(cbl_label_t *label) { strcat(retval, mangled_program_name); } - sprintf(ach, ".%ld", current_function->program_id_number); + sprintf(ach, "." HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)current_function->program_id_number); strcat(retval, ach); - sprintf(ach, ".%ld", symbol_label_id(label)); + sprintf(ach, "." HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)symbol_label_id(label)); strcat(retval, ach); free(mangled_program_name); free(section); @@ -2354,10 +2359,10 @@ section_label(struct cbl_proc_t *procedu cbl_label_t *label = procedure->label; // The _initialize_program section isn't relevant. - char *psz = xasprintf("# SECTION %s in %s (%ld)", + char *psz = xasprintf("# SECTION %s in %s (" HOST_SIZE_T_PRINT_DEC ")", label->name, current_function->our_unmangled_name, - deconflictor); + (fmt_size_t)deconflictor); gg_insert_into_assembler(psz); free(psz); @@ -2405,11 +2410,11 @@ paragraph_label(struct cbl_proc_t *proce char *psz1 = xasprintf( - "# PARAGRAPH %s of %s in %s (%ld)", + "# PARAGRAPH %s of %s in %s (" HOST_SIZE_T_PRINT_DEC ")", para_name ? para_name: "" , section_name ? section_name: "(null)" , current_function->our_unmangled_name ? current_function->our_unmangled_name: "" , - deconflictor ); + (fmt_size_t)deconflictor ); gg_insert_into_assembler(psz1); @@ -2521,8 +2526,8 @@ leave_procedure(struct cbl_proc_t *proce gg_append_statement(procedure->exit.label); char *psz; - psz = xasprintf("_procret.%ld:", - symbol_label_id(procedure->label)); + psz = xasprintf("_procret." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)symbol_label_id(procedure->label)); gg_insert_into_assembler(psz); free(psz); pseudo_return_pop(procedure); @@ -3003,11 +3008,11 @@ parser_perform(cbl_label_t *label, bool para_name = label->name; sect_name = section_label->name; sprintf(ach, - "# PERFORM %s of %s of %s (%ld)", + "# PERFORM %s of %s of %s (" HOST_SIZE_T_PRINT_DEC ")", para_name, sect_name, program_name, - deconflictor); + (fmt_size_t)deconflictor); gg_insert_into_assembler(ach); } @@ -3015,18 +3020,18 @@ parser_perform(cbl_label_t *label, bool { sect_name = label->name; sprintf(ach, - "# PERFORM %s of %s (%ld)", + "# PERFORM %s of %s (" HOST_SIZE_T_PRINT_DEC ")", sect_name, program_name, - deconflictor); + (fmt_size_t)deconflictor); gg_insert_into_assembler(ach); } if( !suppress_nexting ) { sprintf(ach, - "_proccall.%ld.%d:", - symbol_label_id(label), + "_proccall." HOST_SIZE_T_PRINT_DEC ".%d:", + (fmt_size_t)symbol_label_id(label), call_counter++); gg_insert_into_assembler( ach ); } @@ -3074,8 +3079,8 @@ parser_perform_times( cbl_label_t *proc_ char ach[256]; size_t our_pseudo_label = pseudo_label++; sprintf(ach, - "_proccallb.%ld:", - our_pseudo_label); + "_proccallb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); tree counter = gg_define_variable(LONG); @@ -3096,8 +3101,8 @@ parser_perform_times( cbl_label_t *proc_ WEND sprintf(ach, - "_procretb.%ld:", - our_pseudo_label); + "_procretb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler(ach); } @@ -3174,8 +3179,8 @@ internal_perform_through( cbl_label_t *p { char ach[256]; sprintf(ach, - "_proccall.%ld.%d:", - symbol_label_id(proc_2), + "_proccall." HOST_SIZE_T_PRINT_DEC ".%d:", + (fmt_size_t)symbol_label_id(proc_2), call_counter++); gg_insert_into_assembler(ach); } @@ -3224,8 +3229,8 @@ internal_perform_through_times( cbl_la char ach[256]; sprintf(ach, - "_proccallb.%ld:", - our_pseudo_label); + "_proccallb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); tree counter = gg_define_variable(LONG); @@ -3241,8 +3246,8 @@ internal_perform_through_times( cbl_la WEND sprintf(ach, - "_procretb.%ld:", - our_pseudo_label); + "_procretb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); } @@ -3553,7 +3558,8 @@ parser_enter_program( const char *funcna if( parent_index ) { // This is a nested function. Tack on the parent_index to the end of it. - sprintf(funcname, "%s.%ld", mangled_name, parent_index); + sprintf(funcname, "%s." HOST_SIZE_T_PRINT_DEC, mangled_name, + (fmt_size_t)parent_index); } else { @@ -3719,8 +3725,8 @@ parser_init_list_size(int count_of_varia vti_list_size = count_of_variables; char ach[48]; sprintf(ach, - "..variables_to_init_%ld", - current_function->our_symbol_table_index); + "..variables_to_init_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)current_function->our_symbol_table_index); tree array_of_variables_type = build_array_type_nelts(VOID_P, count_of_variables+1); vti_array = gg_define_variable( array_of_variables_type, @@ -3758,8 +3764,8 @@ parser_init_list() char ach[48]; sprintf(ach, - "..variables_to_init_%ld", - current_function->our_symbol_table_index); + "..variables_to_init_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)current_function->our_symbol_table_index); tree array = gg_trans_unit_var_decl(ach); gg_call(VOID, "__gg__variables_to_init", @@ -3940,7 +3946,7 @@ psa_FldLiteralN(struct cbl_field_t *fiel static size_t our_index = 0; - sprintf(id_string, ".%ld", ++our_index); + sprintf(id_string, "." HOST_SIZE_T_PRINT_DEC, (fmt_size_t)++our_index); strcpy(base_name, field->name); strcat(base_name, id_string); @@ -3977,7 +3983,7 @@ psa_FldBlob(struct cbl_field_t *var ) static size_t our_index = 0; - sprintf(id_string, ".%ld", ++our_index); + sprintf(id_string, "." HOST_SIZE_T_PRINT_DEC, (fmt_size_t)++our_index); strcpy(base_name, var->name); strcat(base_name, id_string); @@ -5048,7 +5054,8 @@ parser_assign( size_t nC, cbl_num_result { TRACE1_HEADER char ach[32]; - sprintf(ach, "%ld target%s", nC, nC==1 ? "" : "s"); + sprintf(ach, HOST_SIZE_T_PRINT_DEC " target%s", + (fmt_size_t)nC, nC==1 ? "" : "s"); TRACE1_TEXT(ach); if( on_error ) { @@ -5067,7 +5074,8 @@ parser_assign( size_t nC, cbl_num_result TRACE1 { char ach[48]; - sprintf(ach, "Processing target number %ld", i); + sprintf(ach, "Processing target number " HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)i); TRACE1_INDENT TRACE1_TEXT(ach); } @@ -6121,7 +6129,8 @@ parser_free( size_t n, cbl_refer_t refer gcc_assert( ! p->is_refmod_reference() ); if( !(p->field->type == FldPointer || p->addr_of || (p->field->attr & based_e)) ) { - dbgmsg("Deallocating %s means it has to be FldPointer or addr_of or based_e"); + dbgmsg("Deallocating %s means it has to be FldPointer or addr_of or based_e", + p->field->name); } gcc_assert( p->field->type == FldPointer || p->addr_of || (p->field->attr & based_e) ); @@ -6395,8 +6404,8 @@ parser_division(cbl_division_t division, // We need a pointer to the array of program names char ach[2*sizeof(cbl_name_t)]; sprintf(ach, - "..accessible_program_list_%ld", - current_function->our_symbol_table_index); + "..accessible_program_list_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)current_function->our_symbol_table_index); tree prog_list = gg_define_variable(build_pointer_type(CHAR_P), ach, vs_file_static); @@ -6408,8 +6417,8 @@ parser_division(cbl_division_t division, tree pointer_type = build_pointer_type(function_type); tree constructed_array_type = build_array_type_nelts(pointer_type, 1); sprintf(ach, - "..accessible_program_pointers_%ld", - current_function->our_symbol_table_index); + "..accessible_program_pointers_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)current_function->our_symbol_table_index); tree prog_pointers = gg_define_variable( build_pointer_type(constructed_array_type), ach, @@ -7728,8 +7737,8 @@ perform_outofline_before_until(struct cb char ach[256]; size_t our_pseudo_label = pseudo_label++; sprintf(ach, - "_proccallb.%ld:", - our_pseudo_label); + "_proccallb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); parser_if(varys[0].until); @@ -7751,8 +7760,8 @@ perform_outofline_before_until(struct cb // Label the bottom of the PERFORM gg_append_statement( tgt->addresses.exit.label ); sprintf(ach, - "_procretb.%ld:", - our_pseudo_label); + "_procretb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); } @@ -7783,8 +7792,8 @@ perform_outofline_after_until(struct cbl char ach[256]; size_t our_pseudo_label = pseudo_label++; sprintf(ach, - "_proccallb.%ld:", - our_pseudo_label); + "_proccallb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); create_iline_address_pairs(tgt); @@ -7814,8 +7823,8 @@ perform_outofline_after_until(struct cbl // Label the bottom of the PERFORM gg_append_statement( tgt->addresses.exit.label ); sprintf(ach, - "_procretb.%ld:", - our_pseudo_label); + "_procretb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); } @@ -7879,8 +7888,8 @@ perform_outofline_testafter_varying(stru char ach[256]; size_t our_pseudo_label = pseudo_label++; sprintf(ach, - "_proccallb.%ld:", - our_pseudo_label); + "_proccallb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); create_iline_address_pairs(tgt); @@ -7934,8 +7943,8 @@ perform_outofline_testafter_varying(stru // Arriving here means that we all of the conditions were // true. So, we're done. sprintf(ach, - "_procretb.%ld:", - our_pseudo_label); + "_procretb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); } @@ -7996,8 +8005,8 @@ perform_outofline_before_varying( stru char ach[256]; size_t our_pseudo_label = pseudo_label++; sprintf(ach, - "_proccallb.%ld:", - our_pseudo_label); + "_proccallb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); // Initialize all varying: @@ -8077,8 +8086,8 @@ perform_outofline_before_varying( stru // We have, you see, reached the egress: gg_append_statement( tgt->addresses.exit.label ); sprintf(ach, - "_procretb.%ld:", - our_pseudo_label); + "_procretb." HOST_SIZE_T_PRINT_DEC ":", + (fmt_size_t)our_pseudo_label); gg_insert_into_assembler( ach ); } @@ -8285,7 +8294,7 @@ perform_inline_testbefore_varying( stru { SHOW_PARSE_INDENT char ach[32]; - sprintf(ach, "LABEL [%ld]:", i); + sprintf(ach, "LABEL [" HOST_SIZE_T_PRINT_DEC "]:", (fmt_size_t)i); SHOW_PARSE_TEXT(ach) SHOW_PARSE_END } @@ -8296,7 +8305,8 @@ perform_inline_testbefore_varying( stru { SHOW_PARSE_INDENT char ach[32]; - sprintf(ach, "LABEL CONDINTO[%ld]:", i); + sprintf(ach, "LABEL CONDINTO[" HOST_SIZE_T_PRINT_DEC "]:", + (fmt_size_t)i); SHOW_PARSE_TEXT(ach) SHOW_PARSE_END } @@ -8307,7 +8317,8 @@ perform_inline_testbefore_varying( stru { SHOW_PARSE_INDENT char ach[32]; - sprintf(ach, "LABEL CONDBACK[%ld]:", i); + sprintf(ach, "LABEL CONDBACK[" HOST_SIZE_T_PRINT_DEC "]:", + (fmt_size_t)i); SHOW_PARSE_TEXT(ach) SHOW_PARSE_END } @@ -8342,7 +8353,8 @@ perform_inline_testbefore_varying( stru { SHOW_PARSE_INDENT char ach[32]; - sprintf(ach, "GOTO [%ld]:", i-1); + sprintf(ach, "GOTO [" HOST_SIZE_T_PRINT_DEC "]:", + (fmt_size_t)(i-1)); SHOW_PARSE_TEXT(ach) SHOW_PARSE_END } @@ -8376,7 +8388,8 @@ perform_inline_testbefore_varying( stru { SHOW_PARSE_INDENT char ach[32]; - sprintf(ach, "GOTO [%ld]:", N-1); + sprintf(ach, "GOTO [" HOST_SIZE_T_PRINT_DEC "]:", + (fmt_size_t)(N-1)); SHOW_PARSE_TEXT(ach) SHOW_PARSE_END } @@ -8393,7 +8406,8 @@ perform_inline_testbefore_varying( stru { SHOW_PARSE_INDENT char ach[32]; - sprintf(ach, "GOTO [%ld]:", i-1); + sprintf(ach, "GOTO [" HOST_SIZE_T_PRINT_DEC "]:", + (fmt_size_t)(i-1)); SHOW_PARSE_TEXT(ach) SHOW_PARSE_END } @@ -9968,7 +9982,7 @@ inspect_replacing(int backward, void parser_inspect(cbl_refer_t identifier_1, bool backward, - unsigned long n_operations, + size_t n_operations, cbx_inspect_t<cbl_refer_t>* operations) { Analyze(); @@ -10189,7 +10203,8 @@ parser_intrinsic_callv( cbl_field_t *tgt SHOW_PARSE_HEADER SHOW_PARSE_TEXT(" of ") SHOW_PARSE_TEXT(function_name) - fprintf(stderr, " with %zd parameters", nrefs); + fprintf(stderr, " with " HOST_SIZE_T_PRINT_DEC " parameters", + (fmt_size_t)nrefs); SHOW_PARSE_END } @@ -12687,7 +12702,7 @@ parser_bitop( struct cbl_field_t *tgt, { SHOW_PARSE_HEADER SHOW_PARSE_FIELD( " switch: ", a) - fprintf(stderr, " mask: %lx", bitmask); + fprintf(stderr, " mask: " HOST_SIZE_T_PRINT_HEX_PURE, (fmt_size_t)bitmask); fprintf(stderr, " op: %s", ops[op]); SHOW_PARSE_FIELD( " target ", tgt) SHOW_PARSE_END @@ -12771,7 +12786,7 @@ parser_bitwise_op(struct cbl_field_t *tg { SHOW_PARSE_HEADER SHOW_PARSE_FIELD( " switch: ", a) - fprintf(stderr, " mask: %lx", bitmask); + fprintf(stderr, " mask: " HOST_SIZE_T_PRINT_HEX_PURE, (fmt_size_t)bitmask); fprintf(stderr, " op: %s", ops[op]); SHOW_PARSE_FIELD( " target ", tgt) SHOW_PARSE_END @@ -12975,11 +12990,11 @@ parser_program_hierarchy( const struct c } char ach[128]; sprintf(ach, - "%ld %s%s parent:%ld", - hier.labels[i].ordinal, + HOST_SIZE_T_PRINT_DEC " %s%s parent:" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)hier.labels[i].ordinal, hier.labels[i].label.name, hier.labels[i].label.common ? " COMMON" : "", - hier.labels[i].label.parent); + (fmt_size_t)hier.labels[i].label.parent); SHOW_PARSE_TEXT(ach); } } @@ -13108,12 +13123,14 @@ parser_program_hierarchy( const struct c char ach[2*sizeof(cbl_name_t)]; tree names_table_type = build_array_type_nelts(CHAR_P, mol->second.size()+1); - sprintf(ach, "..our_accessible_functions_%ld", caller); + sprintf(ach, "..our_accessible_functions_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)caller); tree the_names_table = gg_define_variable(names_table_type, ach, vs_file_static); // Here is where we build a table out of constructors: tree constructed_array_type = build_array_type_nelts(pointer_type, mol->second.size()); - sprintf(ach, "..our_constructed_table_%ld", caller); + sprintf(ach, "..our_constructed_table_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)caller); tree the_constructed_table = gg_define_variable(constructed_array_type, ach, vs_file_static); tree constr_names = make_node(CONSTRUCTOR); @@ -13131,7 +13148,8 @@ parser_program_hierarchy( const struct c callee != mol->second.end(); callee++ ) { - sprintf(ach, "%s.%ld", (*callee)->name, (*callee)->parent_node->our_index); + sprintf(ach, "%s." HOST_SIZE_T_PRINT_DEC, (*callee)->name, + (fmt_size_t)(*callee)->parent_node->our_index); CONSTRUCTOR_APPEND_ELT( CONSTRUCTOR_ELTS(constr_names), build_int_cst_type(SIZE_T, i), @@ -13157,11 +13175,13 @@ parser_program_hierarchy( const struct c // And put a pointer to that table into the file-static variable set aside // for it: - sprintf(ach, "..accessible_program_list_%ld", caller); + sprintf(ach, "..accessible_program_list_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)caller); tree accessible_list_var_decl = gg_trans_unit_var_decl(ach); gg_assign( accessible_list_var_decl, gg_get_address_of(the_names_table) ); - sprintf(ach, "..accessible_program_pointers_%ld", caller); + sprintf(ach, "..accessible_program_pointers_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)caller); tree accessible_programs_decl = gg_trans_unit_var_decl(ach); gg_assign( accessible_programs_decl, gg_get_address_of(the_constructed_table) ); } @@ -13179,7 +13199,8 @@ parser_set_handled(ec_type_t ec_handled) { SHOW_PARSE_HEADER char ach[64]; - sprintf(ach, "ec_type_t: 0x%lx", size_t(ec_handled)); + sprintf(ach, "ec_type_t: 0x" HOST_SIZE_T_PRINT_HEX_PURE, + (fmt_size_t)ec_handled); SHOW_PARSE_TEXT(ach); SHOW_PARSE_END } @@ -13248,7 +13269,7 @@ parser_set_numeric(struct cbl_field_t *t SHOW_PARSE_TEXT(tgt->name) SHOW_PARSE_TEXT(" to ") char ach[32]; - sprintf(ach, "%ld", value); + sprintf(ach, HOST_SIZE_T_PRINT_DEC, (fmt_size_t)value); SHOW_PARSE_TEXT(ach); SHOW_PARSE_END } @@ -15869,7 +15890,8 @@ psa_global(cbl_field_t *new_var) fprintf(stderr, "struct cblc_field_t %s = {\n", ach); fprintf(stderr, " .data = NULL ,\n" ); fprintf(stderr, " .capacity = %d ,\n", new_var->data.capacity ); - fprintf(stderr, " .offset = %ld ,\n" , new_var->offset ); + fprintf(stderr, " .offset = " HOST_SIZE_T_PRINT_DEC " ,\n" , + (fmt_size_t)new_var->offset ); fprintf(stderr, " .name = \"%s\" ,\n" , new_var->name ); fprintf(stderr, " .picture = \"%s\" ,\n" , new_var->data.picture ? new_var->data.picture : "" ); if( new_var->data.initial || new_var->type == FldPointer ) @@ -15885,7 +15907,8 @@ psa_global(cbl_field_t *new_var) fprintf(stderr, " .depends_on = NULL ,\n" ); fprintf(stderr, " .occurs_lower = 0 ,\n" ); fprintf(stderr, " .occurs_upper = 0 ,\n" ); - fprintf(stderr, " .attr = 0x%lx ,\n" , new_var->attr ); + fprintf(stderr, " .attr = 0x" HOST_SIZE_T_PRINT_HEX_PURE " ,\n" , + (fmt_size_t)new_var->attr ); fprintf(stderr, " .type = %s ,\n" , ach_type); fprintf(stderr, " .level = %d ,\n" , new_var->level ); fprintf(stderr, " .digits = %d ,\n" , new_var->data.digits ); @@ -16002,12 +16025,14 @@ psa_new_var_decl(cbl_field_t *new_var, c && symbol_at(new_var->parent)->type == SymField ) { // We have a parent that is a field - sprintf(id_string, ".%ld_%ld", our_index, new_var->parent); + sprintf(id_string, "." HOST_SIZE_T_PRINT_DEC "_" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)our_index, (fmt_size_t)new_var->parent); } else { // The parent is zero, so it'll be implied: - sprintf(id_string, ".%ld", our_index); + sprintf(id_string, "." HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)our_index); } if(strcasecmp(new_var->name, "filler") == 0) @@ -16248,29 +16273,30 @@ parser_symbol_add(struct cbl_field_t *ne } while(0); - fprintf(stderr, " %2.2d %s<%s> off:%zd " - "msiz:%d cap:%d dig:%d rdig:%d attr:0x%lx loc:%p", + fprintf(stderr, " %2.2d %s<%s> off:" HOST_SIZE_T_PRINT_DEC " " + "msiz:%d cap:%d dig:%d rdig:%d attr:0x" HOST_SIZE_T_PRINT_HEX_PURE " loc:%p", new_var->level, new_var->name, cbl_field_type_str(new_var->type), - new_var->offset, + (fmt_size_t)new_var->offset, new_var->data.memsize, new_var->data.capacity, new_var->data.digits, new_var->data.rdigits, - new_var->attr, + (fmt_size_t)new_var->attr, (void*)new_var); if( is_table(new_var) ) { - fprintf(stderr," OCCURS:%zd", new_var->occurs.ntimes()); + fprintf(stderr," OCCURS:" HOST_SIZE_T_PRINT_DEC, + (fmt_size_t)new_var->occurs.ntimes()); } cbl_field_t *parent = parent_of(new_var); if( parent ) { fprintf(stderr, - " parent:(%zd)%s", - new_var->parent, + " parent:(" HOST_SIZE_T_PRINT_DEC ")%s", + (fmt_size_t)new_var->parent, parent->name); } else @@ -16283,8 +16309,8 @@ parser_symbol_add(struct cbl_field_t *ne if( e->type == SymFile ) { fprintf(stderr, - " parent_file:(%zd)%s", - new_var->parent, + " parent_file:(" HOST_SIZE_T_PRINT_DEC ")%s", + (fmt_size_t)new_var->parent, e->elem.file.name); if( e->elem.file.attr & external_e ) { @@ -16739,9 +16765,10 @@ parser_symbol_add(struct cbl_field_t *ne if( !bytes_to_allocate ) { fprintf(stderr, - "bytes_to_allocate is zero for %s (symbol number %ld)\n", + "bytes_to_allocate is zero for %s (symbol number " + HOST_SIZE_T_PRINT_DEC ")\n", new_var->name, - new_var->our_index); + (fmt_size_t)new_var->our_index); gcc_assert(bytes_to_allocate); } @@ -16775,16 +16802,16 @@ parser_symbol_add(struct cbl_field_t *ne { // Avoid doubling up on leading underscore sprintf(achDataName, - "%s_data_%lu", + "%s_data_" HOST_SIZE_T_PRINT_UNSIGNED, new_var->name, - sv_data_name_counter++); + (fmt_size_t)sv_data_name_counter++); } else { sprintf(achDataName, - "_%s_data_%lu", + "_%s_data_" HOST_SIZE_T_PRINT_UNSIGNED, new_var->name, - sv_data_name_counter++); + (fmt_size_t)sv_data_name_counter++); } if( new_var->attr & external_e ) --- gcc/cobol/cdf-copy.cc.jj 2025-03-25 09:35:03.801687264 +0100 +++ gcc/cobol/cdf-copy.cc 2025-04-05 17:06:13.439554859 +0200 @@ -34,6 +34,7 @@ // // We regret any confusion engendered. +#include "config.h" #include <glob.h> #include "cobol-system.h" --- gcc/cobol/scan_ante.h.jj 2025-03-11 09:18:21.583135887 +0100 +++ gcc/cobol/scan_ante.h 2025-04-05 17:17:37.338367117 +0200 @@ -438,11 +438,12 @@ trim_location( int nkeep) { } rescan = { yytext + nkeep, yytext + yyleng }; auto nline = std::count(rescan.p, rescan.pend, '\n'); - dbgmsg("%s:%d: yyless(%d), rescan '%.*s' (%zu lines, %d bytes)", + dbgmsg("%s:%d: yyless(%d), rescan '%.*s' (" HOST_SIZE_T_PRINT_UNSIGNED + " lines, " HOST_SIZE_T_PRINT_UNSIGNED " bytes)", __func__, __LINE__, nkeep, int(rescan.size()), rescan.p, - nline, rescan.size()); + (fmt_size_t)nline, (fmt_size_t)rescan.size()); if( nline ) { gcc_assert( yylloc.first_line + nline <= yylloc.last_line ); yylloc.last_line =- int(nline); --- gcc/cobol/structs.cc.jj 2025-04-05 15:37:29.153062676 +0200 +++ gcc/cobol/structs.cc 2025-04-05 17:06:13.439554859 +0200 @@ -176,7 +176,7 @@ create_cblc_field_t() struct cblc_field_t *parent;// This field's immediate parent field size_t occurs_lower; // non-zero for a table size_t occurs_upper; // non-zero for a table - size_t attr; // See cbl_field_attr_t + uint64_t attr; // See cbl_field_attr_t signed char type; // A one-byte copy of cbl_field_type_t signed char level; // This variable's level in the naming heirarchy signed char digits; // Digits specified in PIC string; e.g. 5 for 99v999 @@ -196,7 +196,7 @@ create_cblc_field_t() CHAR_P, "parent", SIZE_T, "occurs_lower", SIZE_T, "occurs_upper", - SIZE_T, "attr", + ULONGLONG, "attr", SCHAR, "type", SCHAR, "level", SCHAR, "digits", --- gcc/cobol/cbldiag.h.jj 2025-03-11 09:18:21.568136095 +0100 +++ gcc/cobol/cbldiag.h 2025-04-05 17:34:13.369941024 +0200 @@ -91,7 +91,7 @@ void cbl_unimplemented_at( const YYLTYP * be localized and fwrite directly to standard out. dbgmsg is activated by * -fflex-debug or -fyacc-debug. */ -void dbgmsg( const char fmt[], ... ); +void dbgmsg( const char fmt[], ... ) ATTRIBUTE_PRINTF_1; void gcc_location_set( const YYLTYPE& loc ); --- gcc/cobol/gcobolspec.cc.jj 2025-04-05 15:37:42.606881462 +0200 +++ gcc/cobol/gcobolspec.cc 2025-04-05 17:10:06.834419347 +0200 @@ -625,13 +625,14 @@ lang_specific_driver (struct cl_decoded_ #endif if( verbose && new_options != original_options ) { - fprintf(stderr, _("Driving: (%ld)\n"), new_option_count); + fprintf(stderr, _("Driving: (" HOST_SIZE_T_PRINT_DEC ")\n"), + (fmt_size_t)new_option_count); for(size_t i=0; i<new_option_count; i++) { fprintf(stderr, - " [%2ld] %4ld %s\n", - i, - new_options[i].opt_index, + " [%2" GCC_PRISZ "d] %4" GCC_PRISZ "d %s\n", + (fmt_size_t)i, + (fmt_size_t)new_options[i].opt_index, new_options[i].orig_option_with_args_text); } fprintf (stderr, "\n"); --- gcc/cobol/parse_ante.h.jj 2025-04-03 08:24:02.357235804 +0200 +++ gcc/cobol/parse_ante.h 2025-04-05 18:24:56.297838081 +0200 @@ -142,7 +142,8 @@ literal_of( size_t value ) { case 0: return literally_zero; case 1: return literally_one; } - cbl_err("logic error: %s: %zu not supported", __func__, value); + cbl_err("logic error: %s: " HOST_SIZE_T_PRINT_UNSIGNED " not supported", + __func__, (fmt_size_t)value); return NULL; } @@ -312,7 +313,9 @@ struct evaluate_elem_t { case_iter pcase; void dump() const { - dbgmsg( "nother=%zu label '%s', %zu cases", nother, label.name, cases.size() ); + dbgmsg( "nother=" HOST_SIZE_T_PRINT_UNSIGNED " label '%s', " + HOST_SIZE_T_PRINT_UNSIGNED " cases", + (fmt_size_t)nother, label.name, (fmt_size_t)cases.size() ); std::for_each( cases.begin(), cases.end(), case_t::Dump ); } @@ -542,8 +545,10 @@ struct arith_t { res.refer.field = cbl_field_of(symbol_at(tgt)); tgts.push_back( res ); - dbgmsg("%s:%d: SRC: %3zu %s", __func__, __LINE__, src, a.str()); - dbgmsg("%s:%d: to %3zu %s", __func__, __LINE__, tgt, res.refer.str()); + dbgmsg("%s:%d: SRC: %3" GCC_PRISZ "u %s", + __func__, __LINE__, (fmt_size_t)src, a.str()); + dbgmsg("%s:%d: to %3" GCC_PRISZ "u %s", + __func__, __LINE__, (fmt_size_t)tgt, res.refer.str()); } void operator()( const corresponding_fields_t::const_reference elem ) { another_pair( elem.first, elem.second ); @@ -2089,8 +2094,10 @@ static class current_t { size_t n = parser_call_target_update(caller, called->name, mangled_name); // Zero is not an error - dbgmsg("updated %zu calls from #%-3zu (%s) s/%s/%s/", - n, caller, caller_name, called->name, mangled_name); + dbgmsg("updated " HOST_SIZE_T_PRINT_UNSIGNED + " calls from #%-3" GCC_PRISZ "u (%s) s/%s/%s/", + (fmt_size_t)n, (fmt_size_t)caller, caller_name, + called->name, mangled_name); } } if( yydebug ) parser_call_targets_dump(); @@ -3006,8 +3013,8 @@ file_add( YYLTYPE loc, cbl_file_t *file } file = cbl_file_of(e); snprintf(field->name, sizeof(field->name), - "%s%zu_%s", - record_area_name_stem, symbol_index(e), file->name); + "%s" HOST_SIZE_T_PRINT_UNSIGNED "_%s", + record_area_name_stem, (fmt_size_t)symbol_index(e), file->name); if( file->attr & external_e ) { snprintf(field->name, sizeof(field->name), "%s%s", record_area_name_stem, file->name); @@ -3153,7 +3160,8 @@ static cbl_label_t * implicit_paragraph() { cbl_name_t name; - sprintf(name, "_implicit_paragraph_%zu", symbol_index()); + sprintf(name, "_implicit_paragraph_" HOST_SIZE_T_PRINT_UNSIGNED, + (fmt_size_t)symbol_index()); // Programs have to start with an implicit paragraph return label_add(LblParagraph, name, yylineno); } @@ -3161,7 +3169,8 @@ static cbl_label_t * implicit_section() { cbl_name_t name; - sprintf(name, "_implicit_section_%zu", symbol_index()); + sprintf(name, "_implicit_section_" HOST_SIZE_T_PRINT_UNSIGNED, + (fmt_size_t)symbol_index()); // Programs have to start with an implicit section return label_add(LblSection, name, yylineno); } @@ -3236,7 +3245,8 @@ data_division_ready() { } if( nsymbol == 0 || nparse_error > 0 ) { - dbgmsg( "%d errors in DATA DIVISION, compilation ceases", nparse_error ); + dbgmsg( HOST_SIZE_T_PRINT_DEC " errors in DATA DIVISION, compilation ceases", + (fmt_size_t)nparse_error ); return false; } --- gcc/cobol/symbols.h.jj 2025-04-05 15:37:29.172062421 +0200 +++ gcc/cobol/symbols.h 2025-04-05 18:11:12.081970579 +0200 @@ -494,7 +494,7 @@ bool is_elementary( enum cbl_field_type_ struct cbl_field_t { size_t offset; enum cbl_field_type_t type, usage; - size_t attr; + uint64_t attr; static_assert(sizeof(attr) == sizeof(cbl_field_attr_t), "wrong attr size"); size_t parent; // symbols[] index of our parent size_t our_index; // symbols[] index of this field, set in symbol_add() @@ -597,8 +597,8 @@ struct cbl_field_t { bool has_attr( cbl_field_attr_t attr ) const { return cbl_field_attr_t(this->attr & attr) == attr; } - size_t set_attr( cbl_field_attr_t attr ); - size_t clear_attr( cbl_field_attr_t attr ); + uint64_t set_attr( cbl_field_attr_t attr ); + uint64_t clear_attr( cbl_field_attr_t attr ); const char * attr_str( const std::vector<cbl_field_attr_t>& attrs ) const; bool is_justifiable() const { @@ -1273,7 +1273,8 @@ struct function_descr_t { static function_descr_t init( const char name[] ) { function_descr_t descr = {}; if( -1 == snprintf( descr.name, sizeof(descr.name), "%s", name ) ) { - dbgmsg("name truncated to '%s' (max %zu characters)", name); + dbgmsg("name truncated to '%s' (max " HOST_SIZE_T_PRINT_UNSIGNED + " characters)", name, (fmt_size_t)sizeof(descr.name)); } return descr; // truncation also reported elsewhere ? } @@ -2049,11 +2050,12 @@ struct cbl_perform_tgt_t { void dump() const { assert(ifrom); if( !ito ) { - dbgmsg( "%s:%d: #%3zu %s", __PRETTY_FUNCTION__, __LINE__, - ifrom, from()->str() ); + dbgmsg( "%s:%d: #%3" GCC_PRISZ "u %s", __PRETTY_FUNCTION__, __LINE__, + (fmt_size_t)ifrom, from()->str() ); } else { - dbgmsg( "%s:%d: #%3zu %s THRU #%3zu %s", __PRETTY_FUNCTION__, __LINE__, - ifrom, from()->str(), ito, to()->str() ); + dbgmsg( "%s:%d: #%3" GCC_PRISZ "u %s THRU #%3" GCC_PRISZ "u %s", + __PRETTY_FUNCTION__, __LINE__, + (fmt_size_t)ifrom, from()->str(), (fmt_size_t)ito, to()->str() ); } } @@ -2246,7 +2248,7 @@ cbl_file_t * symbol_record_file( const c struct cbl_field_t * symbol_find_odo( const cbl_field_t * field ); -size_t numeric_group_attrs( const cbl_field_t *field ); +uint64_t numeric_group_attrs( const cbl_field_t *field ); static inline struct cbl_field_t * field_at( size_t index ) { Jakub