diff options
author | Bill Schmidt <wschmidt@linux.ibm.com> | 2021-06-07 11:20:56 -0500 |
---|---|---|
committer | Bill Schmidt <wschmidt@linux.ibm.com> | 2021-07-16 12:52:31 -0400 |
commit | 43fa306f1d723d9d6c0884e38b102b954d3a4c30 (patch) | |
tree | 6c7d3c9e402473cbe9bba5585d9425523fd4e9fc /gcc | |
parent | 4a720a9547320699aceda7d2e0b08de5ab40132f (diff) | |
download | gcc-43fa306f1d723d9d6c0884e38b102b954d3a4c30.zip gcc-43fa306f1d723d9d6c0884e38b102b954d3a4c30.tar.gz gcc-43fa306f1d723d9d6c0884e38b102b954d3a4c30.tar.bz2 |
rs6000: Add file support and functions for diagnostic support
2021-06-07 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
* config/rs6000/rs6000-gen-builtins.c (bif_file): New variable.
(ovld_file): Likewise.
(header_file): Likewise.
(init_file): Likewise.
(defines_file): Likewise.
(pgm_path): Likewise.
(bif_path): Likewise.
(ovld_path): Likewise.
(header_path): Likewise.
(init_path): Likewise.
(defines_path): Likewise.
(LINELEN): New macro.
(linebuf): New variable.
(line): Likewise.
(pos): Likewise.
(diag): Likewise.
(bif_diag): New function.
(ovld_diag): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/rs6000/rs6000-gen-builtins.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c index 6ab7d7b..3c53c34 100644 --- a/gcc/config/rs6000/rs6000-gen-builtins.c +++ b/gcc/config/rs6000/rs6000-gen-builtins.c @@ -163,3 +163,50 @@ along with GCC; see the file COPYING3. If not see #include <string.h> #include <assert.h> #include <unistd.h> + +/* Input and output file descriptors and pathnames. */ +static FILE *bif_file; +static FILE *ovld_file; +static FILE *header_file; +static FILE *init_file; +static FILE *defines_file; + +static const char *pgm_path; +static const char *bif_path; +static const char *ovld_path; +static const char *header_path; +static const char *init_path; +static const char *defines_path; + +/* Position information. Note that "pos" is zero-indexed, but users + expect one-indexed column information, so representations of "pos" + as columns in diagnostic messages must be adjusted. */ +#define LINELEN 1024 +static char linebuf[LINELEN]; +static int line; +static int pos; + +/* Pointer to a diagnostic function. */ +static void (*diag) (const char *, ...) + __attribute__ ((format (printf, 1, 2))); + +/* Custom diagnostics. */ +static void __attribute__ ((format (printf, 1, 2))) +bif_diag (const char * fmt, ...) +{ + va_list args; + fprintf (stderr, "%s:%d: ", bif_path, line); + va_start (args, fmt); + vfprintf (stderr, fmt, args); + va_end (args); +} + +static void __attribute__ ((format (printf, 1, 2))) +ovld_diag (const char * fmt, ...) +{ + va_list args; + fprintf (stderr, "%s:%d: ", ovld_path, line); + va_start (args, fmt); + vfprintf (stderr, fmt, args); + va_end (args); +} |