From ec5863b08705db96ae99f4e2c1e49d426fdea595 Mon Sep 17 00:00:00 2001 From: David Declerck Date: Mon, 17 Jun 2024 23:00:28 +0200 Subject: [PATCH] Merge SVN 4387, 4388 --- NEWS | 1 + cobc/ChangeLog | 8 ++++++++ cobc/cobc.c | 41 ++++++++++++++++++++++++----------------- cobc/tree.h | 42 +++++++++++++++++++++--------------------- tests/ChangeLog | 3 +++ tests/atlocal.in | 2 +- 6 files changed, 58 insertions(+), 39 deletions(-) diff --git a/NEWS b/NEWS index 2dcf6e6bb..70a4eb899 100644 --- a/NEWS +++ b/NEWS @@ -352,6 +352,7 @@ Open Plans: or to use an explicit format (cut at 26 characters, may raise false-positives in listing tests) e.g. date only `-DLISTING_TIMESTAMP_FORMAT="%Y-%m-%d"` + * More notable changes ** in 64-bit environments, the maximum field size was increased from diff --git a/cobc/ChangeLog b/cobc/ChangeLog index 566264eb3..e9b082c02 100644 --- a/cobc/ChangeLog +++ b/cobc/ChangeLog @@ -579,6 +579,14 @@ * codegen.c (output_file_initialization): don't generate attribute setting which is done in cob_file_malloc / cob_file_external_addr +2021-09-28 Simon Sobisch + + * cobc.c (cobc_print_info): skip initial "." when printing COB_EXE_EXT + * cobc.c (process_command_line): postpone version output for --verbose + * cobc.c (set_listing_date): use formatted instead of ANSI timestamp, + allow format to be specified at cobc compile-time via with define + LISTING_TIMESTAMP_FORMAT + 2021-09-27 Simon Sobisch * typeck.c (cb_build_generic_register): handle CONSTANT diff --git a/cobc/cobc.c b/cobc/cobc.c index bf61395c1..e8d803753 100644 --- a/cobc/cobc.c +++ b/cobc/cobc.c @@ -2076,7 +2076,6 @@ cobc_clean_up (const int status) static void set_listing_date (void) { - char *time_buff; if (!current_compile_time.year) { current_compile_time = cob_get_current_date_and_time(); } @@ -2095,15 +2094,14 @@ set_listing_date (void) } current_compile_tm.tm_yday = current_compile_time.day_of_year; current_compile_tm.tm_isdst = current_compile_time.is_daylight_saving_time; - time_buff = asctime (¤t_compile_tm); - /* LCOV_EXCL_START */ - if (!time_buff) { - strncpy (cb_listing_date, "DATE BUG, PLEASE REPORT", CB_LISTING_DATE_MAX); - return; - } - /* LCOV_EXCL_STOP */ - *strchr (time_buff, '\n') = '\0'; - strncpy (cb_listing_date, time_buff, CB_LISTING_DATE_MAX); + +#ifdef LISTING_TIMESTAMP_ANSI + #define LISTING_TIMESTAMP_FORMAT "%a %b %d %H:%M:%S %Y" /* same format as asctime */ +#elif !defined (LISTING_TIMESTAMP_FORMAT) +#define LISTING_TIMESTAMP_FORMAT "%a %b %d %Y %H:%M:%S" +#endif + strftime (cb_listing_date, (size_t)CB_LISTING_DATE_MAX, + LISTING_TIMESTAMP_FORMAT, ¤t_compile_tm); } @@ -2450,7 +2448,11 @@ cobc_print_info (void) } cobc_var_print ("COB_OBJECT_EXT", COB_OBJECT_EXT, 0); cobc_var_print ("COB_MODULE_EXT", COB_MODULE_EXT, 0); - cobc_var_print ("COB_EXE_EXT", COB_EXE_EXT, 0); + if (!verbose_output && COB_EXE_EXT[0] == '.') { + cobc_var_print ("COB_EXE_EXT", COB_EXE_EXT + 1, 0); + } else { + cobc_var_print ("COB_EXE_EXT", COB_EXE_EXT, 0); + } #ifdef COB_64_BIT_POINTER cobc_var_print ("64bit-mode", _("yes"), 0); @@ -2878,10 +2880,17 @@ process_command_line (const int argc, char **argv) case '?': /* Unknown option or ambiguous */ + if (verbose_output >= 1) { + cobc_print_shortversion (); + } cobc_early_exit (EXIT_FAILURE); case 'h': /* --help */ + if (verbose_output >= 1) { + cobc_print_shortversion (); + puts ("\n"); + } cobc_print_usage (argv[0]); if (verbose_output) { puts ("\n"); @@ -3018,14 +3027,8 @@ process_command_line (const int argc, char **argv) cobc_err_exit (COBC_INV_PAR, "-verbose"); } verbose_output = n; - if (verbose_output >= 1) { - cobc_print_shortversion (); - } } else { verbose_output++; - if (verbose_output == 1) { - cobc_print_shortversion (); - } } break; @@ -3135,6 +3138,10 @@ process_command_line (const int argc, char **argv) } } + if (verbose_output >= 1) { + cobc_print_shortversion (); + } + /* Load default configuration file if necessary */ if (cb_config_name == NULL && cob_std_conf[0] > ' ') { diff --git a/cobc/tree.h b/cobc/tree.h index 9e307289e..4dc191573 100644 --- a/cobc/tree.h +++ b/cobc/tree.h @@ -153,40 +153,40 @@ enum cb_tag { /* Call convention bits */ /* Bit number Meaning Value */ /* 0 currently ignored by GC */ -/* Parameter order 0 - Right to left */ -/* 1 - Left to right */ +/* Parameter order 0 - Right to left */ +/* 1 - Left to right */ /* 1 currently ignored by GC */ -/* Stack manipulation 0 - Caller removes params */ -/* 1 - Callee removes params */ -/* 2 RETURN-CODE update 0 - Updated */ -/* 1 - Not updated */ +/* Stack manipulation 0 - Caller removes params */ +/* 1 - Callee removes params */ +/* 2 RETURN-CODE update 0 - Updated */ +/* 1 - Not updated */ /* 3 Linking behaviour 0 - Normal linking */ -/* 1 - Static CALL linking */ +/* 1 - Static CALL linking */ /* 4 currently ignored by GC + MF */ -/* OS/2 Optlink 0 - ?? */ -/* 1 - ?? */ +/* OS/2 Optlink 0 - ?? */ +/* 1 - ?? */ /* 5 currently ignored by GC + MF */ -/* Thunked to 16 bit 0 - No thunk */ -/* 1 - Thunk */ +/* Thunked to 16 bit 0 - No thunk */ +/* 1 - Thunk */ /* 6 GC: works both with static/dynamic calls */ /* MF: this has his has no effect on dynamic calls */ -/* STDCALL convention 0 - CDECL */ -/* 1 - STDCALL */ +/* STDCALL convention 0 - CDECL */ +/* 1 - STDCALL */ /* 7 currently ignored by GC + MF */ /* 8 currently ignored by GC */ -/* parameter-count for individual entry points 0 - checked */ -/* 1 - not checked */ +/* parameter-count for individual entry points 0 - checked */ +/* 1 - not checked */ /* 9 currently ignored by GC */ -/* case of call + program names 0 - disregarded (depending on compile time flags) */ -/* 1 - regarded */ +/* case of call + program names 0 - disregarded (depending on compile time flags) */ +/* 1 - regarded */ /* 10 currently ignored by GC */ -/* RETURN-CODE storage 0 - passed as return value */ -/* 1 - passed in the first parameter */ +/* RETURN-CODE storage 0 - passed as return value */ +/* 1 - passed in the first parameter */ /* 11-14 currently ignored by GC+MF */ -/* 15 GC: enabling COBOL parameter handling for external callers */ +/* 15 GC: enabling COBOL parameter handling for external callers, likely dropped with GC4 */ /* currently ignored by MF */ /* 0 - external callers don't set cob_call_params */ -/* 1 - external callers set cob_call_params - standard (!)*/ +/* 1 - external callers set cob_call_params - standard (!) */ #define CB_CONV_L_TO_R (1 << 0) #define CB_CONV_CALLEE_STACK (1 << 1) diff --git a/tests/ChangeLog b/tests/ChangeLog index 6169228ca..bfad7c8b2 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -67,6 +67,9 @@ 2021-09-28 Simon Sobisch * atlocal.in: workaround for MSYS issues + * listings-sed.sh: adjusted replacement to actually check the year and + convert the final timestamp in default format to ANSI format + for matching testsuite reference 2021-09-25 Ron Norman diff --git a/tests/atlocal.in b/tests/atlocal.in index f054d9454..16f527643 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -193,7 +193,7 @@ for cobenv in $(${LOCAL_ENV} ${ABS_COBCRUN} --runtime-conf \ done # prevent multiple calls by caching the output -${LOCAL_ENV} ${ABS_COBC} --info > info.out +${LOCAL_ENV} ${ABS_COBC} --verbose --info > info.out # ... and also unset for the compiler if test "$GNUCOBOL_TEST_LOCAL" != "1"; then