From 73af20a212e861596df36c00430968b41263d6e4 Mon Sep 17 00:00:00 2001 From: Paul Osmialowski Date: Tue, 18 Jul 2017 18:15:46 +0000 Subject: [PATCH] make use of FLANG_VENDOR Signed-off-by: Paul Osmialowski --- tools/flang1/flang1exe/listing.c | 5 +++++ tools/flang1/flang1exe/main.c | 11 ++++++++++- tools/flang1/flang1exe/semfunc.c | 8 +++++++- tools/flang1/flang1exe/version.c | 6 +++++- tools/flang1/flang1exe/version.h | 4 ++++ tools/flang2/flang2exe/main.cpp | 18 +++++++++++++----- tools/flang2/flang2exe/version.cpp | 6 +++++- tools/flang2/flang2exe/version.h | 4 ++++ tools/shared/ccffinfo.c | 4 ++++ 9 files changed, 57 insertions(+), 9 deletions(-) diff --git a/tools/flang1/flang1exe/listing.c b/tools/flang1/flang1exe/listing.c index f332b4eb981..f42d81e1323 100644 --- a/tools/flang1/flang1exe/listing.c +++ b/tools/flang1/flang1exe/listing.c @@ -106,8 +106,13 @@ list_ln(const char *beg, const char *txt) if (!lf) return; /* in case error msg written before file * opened */ +#ifdef FLANG_VENDOR + fprintf(lf, "\n\n\n%s%s (Version %8s) %s page %d\n\n", + FLANG_VENDOR, version.lang, version.vsn, gbl.datetime, pgno); +#else fprintf(lf, "\n\n\n%s (Version %8s) %s page %d\n\n", version.lang, version.vsn, gbl.datetime, pgno); +#endif pgno++; pgpos = 6; } diff --git a/tools/flang1/flang1exe/main.c b/tools/flang1/flang1exe/main.c index 455738fc191..b5e125d71ba 100644 --- a/tools/flang1/flang1exe/main.c +++ b/tools/flang1/flang1exe/main.c @@ -96,7 +96,11 @@ static const char *feature = "pgfortran"; /** Product name in debug output */ -#define DNAME "F90" +#ifdef FLANG_VENDOR +#define DNAME FLANG_VENDOR FLANG_LANGUAGE +#else +#define DNAME FLANG_LANGUAGE +#endif #if DEBUG static int dodebug = 0; @@ -1143,7 +1147,12 @@ do_debug(const char *phase) return; } if (dodebug) +#ifdef FLANG_VENDOR + fprintf(gbl.dbgfil, "{%s%s after %s\n", FLANG_VENDOR, FLANG_LANGUAGE, + phase); +#else fprintf(gbl.dbgfil, "{%s after %s\n", feature, phase); +#endif current_phase = phase; execute_actions_for_keyword(phase_dump_map, phase); diff --git a/tools/flang1/flang1exe/semfunc.c b/tools/flang1/flang1exe/semfunc.c index 5f54216e4bc..7ab616bee8f 100644 --- a/tools/flang1/flang1exe/semfunc.c +++ b/tools/flang1/flang1exe/semfunc.c @@ -5621,7 +5621,7 @@ ref_pd(SST *stktop, ITEM *list) int pvar; int nelems, eltype; const char *sname = NULL; - char verstr[140]; /*140, get_version_str returns max 128 char + pf90 prefix */ + char verstr[256]; /* get_version_str returns max 128 chars + vendor prefix */ FtnRtlEnum rtlRtn = 0; SPTR pdsym = SST_SYMG(stktop); int pdtype = PDNUMG(pdsym); @@ -10833,7 +10833,13 @@ ref_pd(SST *stktop, ITEM *list) goto call_e74_cnt; } +#ifdef FLANG_VENDOR + assert(strlen(FLANG_VENDOR) < 116, "FLANG_VENDOR string too long", + strlen(FLANG_VENDOR), 4); + sprintf(verstr, FLANG_VENDOR FLANG_LANGUAGE " %s", get_version_string()); +#else sprintf(verstr, "flang %s", get_version_string()); +#endif sptr = getstring(verstr, strlen(verstr)); goto const_str_val; diff --git a/tools/flang1/flang1exe/version.c b/tools/flang1/flang1exe/version.c index 76515914529..c90c1a4de01 100644 --- a/tools/flang1/flang1exe/version.c +++ b/tools/flang1/flang1exe/version.c @@ -8,9 +8,13 @@ #include "release.h" #include "version.h" -#define LANGUAGE "F90" +#define LANGUAGE FLANG_LANGUAGE +#ifdef FLANG_VENDOR +#define PRODUCT FLANG_VENDOR FLANG_LANGUAGE " " +#else #define PRODUCT "" +#endif /* COPYRIGHT is extern to make it easy to find in symbol table */ /* it also has extra space to patch in interesting stuff */ diff --git a/tools/flang1/flang1exe/version.h b/tools/flang1/flang1exe/version.h index 5844ff89fc9..b0db13c67bb 100644 --- a/tools/flang1/flang1exe/version.h +++ b/tools/flang1/flang1exe/version.h @@ -5,6 +5,10 @@ * */ +#ifndef FLANG_LANGUAGE +#define FLANG_LANGUAGE "F90" +#endif + typedef struct { const char *lang; /* language */ const char *host; /* host */ diff --git a/tools/flang2/flang2exe/main.cpp b/tools/flang2/flang2exe/main.cpp index c4eaf861a39..3777f797f69 100644 --- a/tools/flang2/flang2exe/main.cpp +++ b/tools/flang2/flang2exe/main.cpp @@ -51,6 +51,14 @@ static bool process_input(char *argv0, bool *need_cuda_constructor); +/** Product name in debug output + */ +#ifdef FLANG_VENDOR +#define DNAME FLANG_VENDOR FLANG_LANGUAGE +#else +#define DNAME FLANG_LANGUAGE +#endif + #if DEBUG & sun #ifndef _ERRNO_H extern int errno; @@ -199,7 +207,7 @@ process_input(char *argv0, bool *need_cuda_constructor) gbl.func_count++; gbl.multi_func_count = gbl.func_count; - TR("F90 ILM INPUT begins\n") + TR(DNAME " ILM INPUT begins\n") if (!IS_PARFILE) { upper(0); @@ -278,7 +286,7 @@ process_input(char *argv0, bool *need_cuda_constructor) AssignAddresses(); /* exp_rte.c */ } } - TR("F90 EXPANDER begins\n"); + TR(DNAME " EXPANDER begins\n"); expand(); /* expand ILM's into ILI */ DUMP("expand"); @@ -315,14 +323,14 @@ process_input(char *argv0, bool *need_cuda_constructor) gbl.ompaccel_isdevice = true; #endif - TR("F90 SCHEDULER begins\n"); + TR(DNAME " SCHEDULER begins\n"); DUMP("before-schedule"); schedule(); xtimes[5] += get_rutime(); DUMP("schedule"); } /* CUDAG(GBL_CURRFUNC) & CUDA_HOST */ } - TR("F90 ASSEMBLER begins\n"); + TR(DNAME " ASSEMBLER begins\n"); assemble(); xtimes[6] += get_rutime(); upper_save_syminfo(); @@ -986,7 +994,7 @@ process_stb_file() gbl.func_count++; gbl.multi_func_count = gbl.func_count; - TR("F90 STBFILE INPUT begins\n") + TR(DNAME " STBFILE INPUT begins\n") upper(1); /* should we generate upper_stbfil()? */ if (gbl.eof_flag) diff --git a/tools/flang2/flang2exe/version.cpp b/tools/flang2/flang2exe/version.cpp index 51d5ec52d43..b0dfa217520 100644 --- a/tools/flang2/flang2exe/version.cpp +++ b/tools/flang2/flang2exe/version.cpp @@ -9,10 +9,14 @@ #include "version.h" #ifndef LANGUAGE -#define LANGUAGE "F90" +#define LANGUAGE FLANG_LANGUAGE #endif +#ifdef FLANG_VENDOR +#define PRODUCT FLANG_VENDOR FLANG_LANGUAGE " " +#else #define PRODUCT "" +#endif /* COPYRIGHT is extern to make it easy to find in symbol table */ /* it also has extra space to patch in interesting stuff */ diff --git a/tools/flang2/flang2exe/version.h b/tools/flang2/flang2exe/version.h index c962a4bb640..e91b95bf284 100644 --- a/tools/flang2/flang2exe/version.h +++ b/tools/flang2/flang2exe/version.h @@ -8,6 +8,10 @@ #ifndef VERSION_H_ #define VERSION_H_ +#ifndef FLANG_LANGUAGE +#define FLANG_LANGUAGE "F90" +#endif + typedef struct { const char *lang; /* language */ const char *host; /* host */ diff --git a/tools/shared/ccffinfo.c b/tools/shared/ccffinfo.c index a8420be4936..3d925b78917 100644 --- a/tools/shared/ccffinfo.c +++ b/tools/shared/ccffinfo.c @@ -50,7 +50,11 @@ static int prevlineno = 0; static bool anymessages; #endif +#ifdef FLANG_VENDOR +#define BUILD_VENDOR FLANG_VENDOR +#else #define BUILD_VENDOR "flang-compiler" +#endif FIHB fihb = {(FIH *)0, 0, 0, 0, 0, 0, 0, 0}; FIHB ifihb = {(FIH *)0, 0, 0, 0, 0, 0, 0, 0}; /* bottom-up auto-inliner */