public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: William Schmidt <wschmidt@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add file support and functions for diagnostic support Date: Tue, 27 Oct 2020 16:27:11 +0000 (GMT) [thread overview] Message-ID: <20201027162711.7B90D3840C2B@sourceware.org> (raw) https://gcc.gnu.org/g:2396c3f06e39aa81b9657a0a464b3af5aa470715 commit 2396c3f06e39aa81b9657a0a464b3af5aa470715 Author: Bill Schmidt <wschmidt@linux.ibm.com> Date: Wed Jun 17 09:52:26 2020 -0500 rs6000: Add file support and functions for diagnostic support 2020-07-26 Bill Schmidt <wschmidt@linux.ibm.com> * config/rs6000/rs6000-gen-builtins.c (bif_file): New filescope 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 defined constant. (linebuf): New filescope variable. (line): Likewise. (pos): Likewise. (diag): Likewise. (bif_diag): New function. (ovld_diag): New function. Diff: --- gcc/config/rs6000/rs6000-gen-builtins.c | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c index 462387f4b44..8c8fad66edf 100644 --- a/gcc/config/rs6000/rs6000-gen-builtins.c +++ b/gcc/config/rs6000/rs6000-gen-builtins.c @@ -139,3 +139,51 @@ 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. */ +void (*diag) (const char *, ...) __attribute__ ((format (printf, 1, 2))) + = NULL; + +/* 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); +} +
next reply other threads:[~2020-10-27 16:27 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-27 16:27 William Schmidt [this message] -- strict thread matches above, loose matches on Subject: below -- 2020-10-29 19:49 William Schmidt 2020-09-16 21:28 William Schmidt 2020-09-14 13:57 William Schmidt 2020-08-28 20:06 William Schmidt 2020-08-20 16:37 William Schmidt 2020-08-18 18:43 William Schmidt 2020-07-27 18:46 William Schmidt 2020-07-17 17:21 William Schmidt 2020-06-17 20:04 William Schmidt
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201027162711.7B90D3840C2B@sourceware.org \ --to=wschmidt@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).