From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1725) id DF9B1393B04F; Fri, 17 Jul 2020 17:21:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF9B1393B04F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595006496; bh=5wfVGeEKMYlok2A8R7jQBqqIiuowYOOgs2F1Q5iDM9s=; h=From:To:Subject:Date:From; b=XH7WfBGttVHGwgshEd9j01oMTHv1sHJLiH0TwqAjgJs67oGb7HxCMEl3qUHlOkQvM hBjVkVVBoA5zU0bvzGsJ9lY2axiKUF+E0XE9Gt9/8Jt5PRjjGFmJb8khL63Lzf17Tw O/mNz4SY3I2EBSGFgg6M9kK96T/RJX6YFFBtH6oc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: William Schmidt To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/wschmidt/heads/builtins3)] rs6000: Add file support and functions for diagnostic support X-Act-Checkin: gcc X-Git-Author: Bill Schmidt X-Git-Refname: refs/users/wschmidt/heads/builtins3 X-Git-Oldrev: dedff55fb564b5c23be8e624ede314acf124b38c X-Git-Newrev: e7f5d5c1372ac604a68da7c7d2adfe5d2b50b67b Message-Id: <20200717172136.DF9B1393B04F@sourceware.org> Date: Fri, 17 Jul 2020 17:21:36 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2020 17:21:37 -0000 https://gcc.gnu.org/g:e7f5d5c1372ac604a68da7c7d2adfe5d2b50b67b commit e7f5d5c1372ac604a68da7c7d2adfe5d2b50b67b Author: Bill Schmidt Date: Wed Jun 17 09:52:26 2020 -0500 rs6000: Add file support and functions for diagnostic support 2020-06-17 Bill Schmidt * 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 1ef12aa0413..db7afa31f87 100644 --- a/gcc/config/rs6000/rs6000-gen-builtins.c +++ b/gcc/config/rs6000/rs6000-gen-builtins.c @@ -140,3 +140,51 @@ along with GCC; see the file COPYING3. If not see #include #include #include + +/* 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); +} +