From 24db6e216fb4a96faf210de79aceaf9c6e336231 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 24 Jul 1998 07:13:57 +0000 Subject: [PATCH] During compilation of a Fortran program f2c/f77 will spew the name of entry points, functions, subroutines, and program to stderr error. The enclosed patches do 3 things: (1) Silenced the output to stderr. (2) Added a -v option to f2c and f77. This will turn on a verbose mode, and dumps quite a bit of stuff to stderr. (3) Updated the f2c man page. PR: 7369 Submitted by: Steven G. Kargl --- gnu/usr.bin/cc/cc/f2c-specs.h | 2 +- usr.bin/f2c/f2c.1 | 4 +++- usr.bin/f2c/main.c | 4 +++- usr.bin/f2c/proc.c | 26 +++++++++++++++++--------- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/gnu/usr.bin/cc/cc/f2c-specs.h b/gnu/usr.bin/cc/cc/f2c-specs.h index 0874d5403e25..aafab0ee4fd4 100644 --- a/gnu/usr.bin/cc/cc/f2c-specs.h +++ b/gnu/usr.bin/cc/cc/f2c-specs.h @@ -4,7 +4,7 @@ "f2c %{checksubscripts:-C} %{I2} %{onetrip} %{honorcase:-U} %{u} %{w}\ %{ANSIC:-A} %{a} %{C++}\ %{c} %{E} %{ec} %{ext} %{f} %{72} %{g} %{h} %{i2} %{kr} %{krd}\ - %{P} %{p} %{r} %{r8} %{s} %{w8} %{z} %{N*}\ + %{P} %{p} %{v} %{r} %{r8} %{s} %{w8} %{z} %{N*}\ %i %{!pipe: -o %g.c} %{pipe:-o -}|\n", "cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\ %{C:%{!E:%eGNU C does not support -C without using -E}}\ diff --git a/usr.bin/f2c/f2c.1 b/usr.bin/f2c/f2c.1 index 4011fcbd434a..08e99ed1703d 100644 --- a/usr.bin/f2c/f2c.1 +++ b/usr.bin/f2c/f2c.1 @@ -33,7 +33,7 @@ .Nd Convert Fortran 77 to C or C++ .Sh SYNOPSIS .Nm f2c -.Op Fl AaCcEfgpRrsUuw +.Op Fl AaCcEfgpRrsUuvw .Op Fl C++ .Op Fl cd .Op Fl d Ar dir @@ -195,6 +195,8 @@ may change prototypes or declarations. .It Fl p Supply preprocessor definitions to make common-block members look like local variables. +.It Fl v +Echo the file name, program name, and procedure name(s) during compilation. .It Fl R Do not promote REAL functions and operations to DOUBLE PRECISION. Option .Fl !R diff --git a/usr.bin/f2c/main.c b/usr.bin/f2c/main.c index 41838552bb04..7237905d29fb 100644 --- a/usr.bin/f2c/main.c +++ b/usr.bin/f2c/main.c @@ -49,6 +49,7 @@ flag r8flag = NO; flag use_bs = YES; flag keepsubs = NO; flag byterev = NO; +flag echo = NO; int intr_omit; static int no_cd, no_i90; #ifdef TYQUAD @@ -128,6 +129,7 @@ static arg_info table[] = { f2c_entry ("Nl", P_ONE_ARG, P_INT, &maxlablist, 0), f2c_entry ("c", P_NO_ARGS, P_INT, &addftnsrc, YES), f2c_entry ("p", P_NO_ARGS, P_INT, &usedefsforcommon, YES), + f2c_entry ("v", P_NO_ARGS, P_INT, &echo, YES), f2c_entry ("R", P_NO_ARGS, P_INT, &forcedouble, NO), f2c_entry ("!R", P_NO_ARGS, P_INT, &forcedouble, YES), f2c_entry ("A", P_NO_ARGS, P_INT, &Ansi, YES), @@ -563,7 +565,7 @@ main(int argc, char **argv) if(inilex( copys(file_name) )) done(1); - if (filename0) { + if (filename0 && echo) { fprintf(diagfile, "%s:\n", file_name); fflush(diagfile); } diff --git a/usr.bin/f2c/proc.c b/usr.bin/f2c/proc.c index 6796d5219559..2273e24951a4 100644 --- a/usr.bin/f2c/proc.c +++ b/usr.bin/f2c/proc.c @@ -433,6 +433,8 @@ startproc(progname, class) startproc(Extsym *progname, int class) #endif { + extern flag echo; + register struct Entrypoint *p; p = ALLOC(Entrypoint); @@ -458,13 +460,15 @@ startproc(Extsym *progname, int class) entries = p; procclass = class; - fprintf(diagfile, " %s", (class==CLMAIN ? "MAIN" : "BLOCK DATA") ); - if(progname) { - fprintf(diagfile, " %s", progname->fextname); - procname = progname->cextname; + if (echo) { + fprintf(diagfile, " %s", (class==CLMAIN ? "MAIN" : "BLOCK DATA") ); + if(progname) { + fprintf(diagfile, " %s", progname->fextname); + procname = progname->cextname; + } + fprintf(diagfile, ":\n"); + fflush(diagfile); } - fprintf(diagfile, ":\n"); - fflush(diagfile); } /* subroutine or function statement */ @@ -521,15 +525,19 @@ entrypt(class, type, length, entry, args) entrypt(int class, int type, ftnint length, Extsym *entry, chainp args) #endif { + extern flag echo; + register Namep q; register struct Entrypoint *p; if(class != CLENTRY) puthead( procname = entry->cextname, class); - else + else if (echo) fprintf(diagfile, " entry "); - fprintf(diagfile, " %s:\n", entry->fextname); - fflush(diagfile); + if (echo){ + fprintf(diagfile, " %s:\n", entry->fextname); + fflush(diagfile); + } q = mkname(entry->fextname); if (type == TYSUBR) q->vstg = STGEXT;