public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Laurynas Biveinis <laurynas.biveinis@gmail.com>
To: Basile Starynkevitch <basile@starynkevitch.net>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: gengtype improvements for plugins, thirdround! patch 3/7 [inputfile]
Date: Wed, 22 Sep 2010 12:05:00 -0000	[thread overview]
Message-ID: <AANLkTimd8+yFn4HGc2Dc+c=qz3i40w4tPPEbh3NCpsKx@mail.gmail.com> (raw)
In-Reply-To: <20100921211217.df1ef337.basile@starynkevitch.net>

2010/9/21 Basile Starynkevitch <basile@starynkevitch.net>:
> The gengtype-lex.l & gengtype-parse.c files need to include fatal.h
> because it is used from gengtype.h

OK. In that case bonus points for a follow-up patch that includes
fatal.h from gengtype.h and updates Makefile accordingly :)

> Since struct location_s is no longer used inside GCC, the hack in
> new_structure to handle it is removed.

This is excellent, but it really should be a separate patch.

-/* The plugin input files and their number; in that case only
-   a single file is produced.  */
-static char** plugin_files;
+/* The plugin input files and their number; in plugin mode only a
+   single file is produced.  */
+static input_file** plugin_files;

Please remove the comment part after semicolon (the comment should
explain plugin_files definition, the numer of output files is
irrelevant to that definition)

-/* The gt- output file name for F.  */
+/* The gt- output file name for INPF.  */

 static const char *
-get_file_gtfilename (const char *f)
+get_file_gtfilename (const input_file *inpf)

Drop the empty line between the comment and the definition.

@@ -4424,89 +4384,142 @@ print_version (void)
 static void
 parse_program_options (int argc, char**argv)
 {
-    int opt = -1;
+  int opt = -1;
[...two hundred lines or so of indentation changes follow...]

These parse_program_options changes only fix indentation in the first
patch, so please fix the first patch and this will disappear. If there
were any real code changes here, I couldn't tell through all those
formatting changes.

-      for (i = 0; i < num_gt_files; i++) {
-	parse_file (gt_files[i]);
-	DBGPRINTF ("parsed file #%d %s", (int) i, gt_files[i]);
-      }
+      for (i = 0; i < num_gt_files; i++)
+	{
+	  parse_file (get_input_file_name (gt_files[i]));
+	  DBGPRINTF ("parsed file #%d %s", (int) i, get_input_file_name
(gt_files[i]));
+	}

Same here. (Here at least I can see the non-formatting code change)

+	    if (relp)
+	      /* The input file is a GCC source file, we use a double
+		 colon after anonymous.  To be sure s is truly unique,
+		 we also use anonymous_count.  */
+	      s = xasprintf ("anonymous::%s:%d::%d",
+			     relp, lexer_line.line, anonymous_count);
+	    else
+	      /* The input file is outside of GCC source tree, we use
+		 a single colon after anonymous.  To be sure s is
+		 truly unique, we also use anonymous_count.  */
+	      s = xasprintf ("anonymous:%s:%d::%d",
+			     get_input_file_name (lexer_line.file),
+			     lexer_line.line, anonymous_count);

Here and in similar following fragments, please add { } on if and else
clauses (too many visual lines).

As far as I'm concerned, the non-magic patch would be OK with these changes.

> ########## gcc/ChangeLog entry is
> 2010-09-20  Jeremie Salvucci  <jeremie.salvucci@free.fr>
>            Basile Starynkevitch  <basile@starynkevitch.net>
>
>        * gengtype.c (get_output_file_name, plugin_files)
>        (get_file_srcdir_relative_path, nb_plugin_files): moved to gengtype.h.
>        (get_file_basename, get_file_realbasename, get_file_langdir): Use
>        an input_file as argument.
>        (error_at_line): Use input_file-s.
>        (gt_files, num_gt_files, this_file, system_h_file): Declared as
>        input_file-s.
>        (lang_dir_names, num_lang_dirs): No static.
>        (get_lang_bitmap, set_lang_bitmap): Moved to gengtype.h.
>        (read_input_list): Use input_file-s.
>        (new_structure): Remove location_s hack.
>        (creat_field_all, get_file_realbasename)
>        (get_file_srcdir_relative_path, get_file_basename)
>        (get_file_langdir, get_file_gtfilename)
>        (get_output_file_with_visibility, get_output_file_name)
>        (put_mangled_filename): Use input_file-s.
>        (struct flist): Removed name and added file field.
>        (output_type_enum): Use input_file-s.
>        (finish_root_table, write_roots): Use file not name field of
>        struct flist.
>        (dump_fileloc, parse_program_options): Use input_file-s.
>
>        * gengtype.h (struct input_file_st, input_file): New structure and
>        type.
>        (INPUT_FILE_MAGIC, CHECK_INPUT_FILE_MAGIC): New macros.
>        (gt_files, num_gt_files): New variables moved from gengtype.c.
>        (this_file, system_h_file): New variables.
>        (input_file_by_name): Declared new function.
>        (get_input_file_name): New inline function.
>        (get_lang_bitmap, set_lang_bitmap): Moved from gengtype.c and
>        updated.
>        (struct fileloc): field file changed type.
>        (lang_dir_names, num_lang_dirs): moved from gengtype.c.
>        (get_output_file_with_visibility, get_output_file_name): Use
>        input_file-s.
>
>        * gengtype-lex.l:  Updated copyright year. Included errors.h.
>        (yybegin): use input_file-s.
>
>        * gengtype-parse.c:   Updated copyright year. Included errors.h.
>        (parse_error): Use input_file-s.
>        (type): Generate anonymous names differently for GCC source input
>        and other input.

-- 
Laurynas

  parent reply	other threads:[~2010-09-22  2:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21 19:41 gengtype improvements for plugins, thirdround! patch 1/7 [declprog] Basile Starynkevitch
2010-09-21 22:07 ` gengtype improvements for plugins, thirdround! patch 2/7 [verbosity] Basile Starynkevitch
2010-09-21 22:43   ` gengtype improvements for plugins, thirdround! patch 3/7 [inputfile] Basile Starynkevitch
2010-09-22  0:29     ` gengtype improvements for plugins, thirdround! patch 4/7 [filerules] Basile Starynkevitch
2010-09-22  1:50       ` gengtype improvements for plugins, thirdround! patch 5/7 [typedopt] Basile Starynkevitch
2010-09-22  1:58         ` gengtype improvements for plugins, thirdround! patch 6/7 [wstate] Basile Starynkevitch
2010-09-22  2:16           ` Basile Starynkevitch
2010-09-22  3:03             ` gengtype improvements for plugins, thirdround! patch 7/7 [doc] Basile Starynkevitch
2010-09-22 14:17               ` Laurynas Biveinis
2010-09-22 14:08           ` gengtype improvements for plugins, thirdround! patch 6/7 [wstate] Laurynas Biveinis
2010-09-22 12:13         ` gengtype improvements for plugins, thirdround! patch 5/7 [typedopt] Laurynas Biveinis
2010-09-23 19:17           ` Basile Starynkevitch
2010-09-23 19:29             ` Diego Novillo
2010-09-23 19:39               ` Richard Guenther
2010-09-22 12:06       ` gengtype improvements for plugins, thirdround! patch 4/7 [filerules] Laurynas Biveinis
2010-09-22 12:05     ` Laurynas Biveinis [this message]
2010-10-18 17:21     ` gengtype patch removing location_s Basile Starynkevitch
2010-10-19  6:57       ` Laurynas Biveinis
2010-10-19  7:11         ` Basile Starynkevitch
2010-10-19  7:27           ` Laurynas Biveinis
2010-10-19  7:29             ` Basile Starynkevitch
2010-10-19  8:17               ` Laurynas Biveinis
2010-10-19  8:49               ` Dave Korn
2010-10-19 16:38           ` Tom Tromey
2010-10-20 20:39             ` gengtype plugin improvement last2round - patch3 [inputfile] Basile Starynkevitch
2010-10-21  4:46               ` Laurynas Biveinis
2010-09-22 11:11   ` gengtype improvements for plugins, thirdround! patch 2/7 [verbosity] Laurynas Biveinis
2010-09-22 11:08 ` gengtype improvements for plugins, thirdround! patch 1/7 [declprog] Laurynas Biveinis

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='AANLkTimd8+yFn4HGc2Dc+c=qz3i40w4tPPEbh3NCpsKx@mail.gmail.com' \
    --to=laurynas.biveinis@gmail.com \
    --cc=basile@starynkevitch.net \
    --cc=gcc-patches@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: link
Be 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).