Patchwork gengtype plugin improvement last4round -patch 3 [inputfile]

login
register
mail settings
Submitter H.J. Lu
Date Nov. 9, 2010, 1:11 p.m.
Message ID <AANLkTi=2=zbxvQnMwedywy3taPc9OQ1vX1hrzJsaMSdK@mail.gmail.com>
Download mbox | patch
Permalink /patch/70542/
State New
Headers show

Comments

H.J. Lu - Nov. 9, 2010, 1:11 p.m.
On Tue, Nov 9, 2010 at 5:08 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Nov 9, 2010 at 1:53 AM, Andreas Schwab <schwab@redhat.com> wrote:
>> Basile Starynkevitch <basile@starynkevitch.net> writes:
>>
>>>       * gengtype.h:
>>>       (struct input_file_st, input_file): New type.
>>>       (struct fileloc): use it.
>>
>> You did bootstrap that?
>>
>> ../../gcc/gengtype-parse.c: In function 'type':
>> ../../gcc/gengtype-parse.c:754:4: error: format '%s' expects type 'char *', but argument 2 has type 'const struct input_file *' [-Werror=format]
>> ../../gcc/gengtype-parse.c:791:2: error: format '%s' expects type 'char *', but argument 2 has type 'const struct input_file *' [-Werror=format]
>>
>> Even a simple grep would have found it.
>>
>
> I opened:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46392
>

I am checking in this as an obvious fix.

Patch

diff --git a/gcc/gengtype-parse.c b/gcc/gengtype-parse.c
index 0f2e0c6..476a9fd 100644
--- a/gcc/gengtype-parse.c
+++ b/gcc/gengtype-parse.c
@@ -751,7 +751,9 @@  type (options_p *optsp, bool nested)
 	if (token () == ID)
 	  s = advance ();
 	else
-	  s = xasprintf ("anonymous:%s:%d", lexer_line.file, lexer_line.line);
+	  s = xasprintf ("anonymous:%s:%d",
+			 get_input_file_name (lexer_line.file),
+			 lexer_line.line);

 	/* Unfortunately above GTY_TOKEN check does not capture the
 	   typedef struct_type GTY case.  */
@@ -788,7 +790,9 @@  type (options_p *optsp, bool nested)
       if (token () == ID)
 	s = advance ();
       else
-	s = xasprintf ("anonymous:%s:%d", lexer_line.file, lexer_line.line);
+	s = xasprintf ("anonymous:%s:%d",
+		       get_input_file_name (lexer_line.file),
+		       lexer_line.line);

       if (token () == '{')
 	consume_balanced ('{', '}');