Skip to content

Commit

Permalink
Add flag -fno-ttime to suppress time information from listings
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan committed Jul 3, 2023
1 parent 20e6b07 commit d627bda
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 41 deletions.
6 changes: 6 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

2023-07-02 Fabrice Le Fessant <[email protected]>

* flag.def/cobc.c: new flag -fno-ttime to suppress time information
from listings, so that listings can be compared accross different
versions and dates.

2023-07-02 Fabrice Le Fessant <[email protected]>

* replace.c: rewrite the code for preprocessing with a two-phase
Expand Down
12 changes: 8 additions & 4 deletions cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2294,8 +2294,12 @@ set_listing_date (void)
#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, &current_compile_tm);
if (cb_listing_with_time){
strftime (cb_listing_date, (size_t)CB_LISTING_DATE_MAX,
LISTING_TIMESTAMP_FORMAT, &current_compile_tm);
} else {
strncpy (cb_listing_date, "DDD MMM dd HH:MM:SS YYYY", (size_t)CB_LISTING_DATE_MAX);
}
}


Expand Down Expand Up @@ -5276,8 +5280,8 @@ set_standard_title (void)
char version[30];
snprintf (version, sizeof (version), "%s.%d", PACKAGE_VERSION, PATCH_LEVEL);
snprintf (cb_listing_title, 80, "%s %s",
PACKAGE_NAME,
version);
PACKAGE_NAME,
cb_listing_with_time ? version : "VERSION-ANY");
}

/* print header */
Expand Down
3 changes: 3 additions & 0 deletions cobc/flag.def
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ CB_FLAG (cb_listing_symbols, 1, "tsymbols",
CB_FLAG (cb_listing_cmd, 1, "tcmd",
_(" -ftcmd specify command line in listing"))

CB_FLAG_ON (cb_listing_with_time, 1, "ttime",
_(" -fno-ttime suppress time information from listing"))

CB_FLAG_ON (cb_diagnostics_show_option, 1, "diagnostics-show-option",
_(" -fno-diagnostics-show-option\tsuppress output of option that directly\n"
" controls the diagnostic"))
Expand Down
40 changes: 3 additions & 37 deletions tests/testsuite.src/syn_copy.at
Original file line number Diff line number Diff line change
Expand Up @@ -946,45 +946,11 @@ AT_DATA([prog.cob], [
REPLACE OFF.
])

AT_CHECK([$COMPILE_ONLY -P=preproc.lst prog.cob], [0], [], [])
AT_CHECK([$COMPILE_ONLY -fno-ttime -t preproc3.lst prog.cob], [0], [], [])

AT_CHECK([cat preproc.lst], [0],
[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
],
[])

AT_CHECK([$COMPILE_ONLY -T preproc2.lst prog.cob], [0], [], [])

AT_CHECK([grep -v GnuCOBOL preproc2.lst], [0],
[
LINE PG/LN A...B............................................................SEQUENCE

000001
000002 IDENTIFICATION DIVISION.
000003 PROGRAM-ID. prog.
000004 DATA DIVISION.
000005 WORKING-STORAGE SECTION.
000006 REPLACE ==VAR-COLON== BY ==VAR-COMMA==.
000007 COPY "copy.inc"
000001C
000002C 01 VAR-:TEST: PIC X(2) VALUE "OK".
000007 REPLACING ==:TEST:== BY ==COLON==.
000008 PROCEDURE DIVISION.
000009 DISPLAY VAR-COMMA NO ADVANCING
000010 END-DISPLAY.
000011 STOP RUN.
000012 REPLACE OFF.


0 warnings in compilation group
0 errors in compilation group
],
[])

AT_CHECK([$COMPILE_ONLY -t preproc3.lst prog.cob], [0], [], [])
AT_CHECK([cat preproc3.lst], [0],
[GnuCOBOL VERSION-ANY prog.cob DDD MMM dd HH:MM:SS YYYY Page 0001

AT_CHECK([grep -v GnuCOBOL preproc3.lst], [0],
[
LINE PG/LN A...B............................................................

000001
Expand Down

0 comments on commit d627bda

Please sign in to comment.