This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: gengtype improvements for plugins, thirdround! patch 1/7 [declprog]
- From: Laurynas Biveinis <laurynas dot biveinis at gmail dot com>
- To: Basile Starynkevitch <basile at starynkevitch dot net>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 22 Sep 2010 04:57:41 +0300
- Subject: Re: gengtype improvements for plugins, thirdround! patch 1/7 [declprog]
- References: <20100921210301.d92889be.basile@starynkevitch.net>
The indentation of the patch is still (glaringly) wrong in a
significant number of places.
-/* the generated plugin output name & file */
+
+/* the generated plugin output file and name. */
The
+static void
+print_usage (void)
+{
+ printf ("Usage: %s\n", progname);
Wrong indentation.
+/* Parse the program options using getopt_long... */
+static void
+parse_program_options (int argc, char**argv)
+{
+ int opt = -1;
+ while ((opt = getopt_long (argc, argv, "hVdP:S:I:w:r:D",
+ gengtype_long_options, NULL)) >= 0)
+ {
+ switch (opt)
+ {
+ case 'h': /* --help */
+ print_usage ();
+ break;
+ case 'V': /* --version */
+ print_version ();
+ break;
+ case 'd': /* --dump */
+ do_dump = 1;
+ break;
Wrong indentation...
+ /*** Parse the input list and the input files. ***/
/* Parse ... */
+ for (i = 0; i < num_gt_files; i++) {
+ parse_file (gt_files[i]);
+ DBGPRINTF ("parsed file #%d %s", (int) i, gt_files[i]);
+ }
Wrong formatting.
+ if (nb_plugin_files <= 0 || !plugin_files)
+ fatal ("No plugin files given in plugin mode for %s", plugin_output_filename);
+ /* Parse our plugin files. */
+ for (ix = 0; ix < nb_plugin_files; ix++)
+ parse_file (plugin_files[ix]);
+
+ if (hit_error)
+ return 1;
+
+ plugin_output = create_file ("GCC", plugin_output_filename);
+ DBGPRINTF ("created plugin_output %p named %s",
+ (void*) plugin_output, plugin_output->name);
+ }
+ else
+ { /* No plugin files, we are in normal mode. */
+ if (!srcdir)
+ fatal ("gengtype needs a source directory in normal mode");
+ }
Wrong formatting.
+ /* The call to set_gc_used may indirectly call find_param_structure
+ hence enlarge the param_structs list of types. So it should
+ happen before writing the state. */
set_gc_used (variables);
Can you explain this comment? I mean, *all* source processing things
must happen before writing the state, so isn't the comment too
obvious?
+#endif /*ENABLE_CHECKING*/
Space after /* and before */
> gcc/ChangeLog entry:
>
> 2010-09-20 ÂJeremie Salvucci Â<jeremie.salvucci@free.fr>
> Â Â Â Â Â ÂBasile Starynkevitch Â<basile@starynkevitch.net>
>
> Â Â Â Â* gengtype.c: ÂInclude getopt.h and version.h.
>
> Â Â Â Â(lang_bitmap, struct outf, outf_p)
> Â Â Â Â(get_output_file_with_visibility, oprintf): Definitions moved to
> Â Â Â Âgengtype.h
> Â Â Â Â(output_files, header_file, srcdir, srcdir_len, this_file,
> do_dump): No more static variables.
> Â Â Â Â(do_debug): New.
> Â Â Â Â(dbgprint_count_type_at): Added new function.
> Â Â Â Â(gengtype_long_options): New.
> Â Â Â Â(print_usage, print_version, parse_program_options): New.
> Â Â Â Â(main): Call parse_program_options, and removed old option
> Â Â Â Âhandling code. ÂAdded some debug output.
>
> Â Â Â Â* gengtype.h: ÂUpdated copyright year.
> Â Â Â Â(lang_bitmap, struct outf, outf_p, header_file, oprintf)
> Â Â Â Â(get_output_file_with_visibility, srcdir, srcdir_len, do_dump):
> Â Â Â ÂMoved from gengtype.c to here.
> Â Â Â Â(do_debug, read_state_filename, write_state_filename): New
> variables. (DBGPRINTF, DBGPRINT_COUNT_TYPE): New macros.
>
> Â Â Â Â* Makefile.in:
> Â Â Â Â(REVISION): Always defined.
> Â Â Â Â(version.o): Removed ifdef REVISION_c.
> Â Â Â Â(s-gtype): Pass arguments to build/gengtype program.
> Â Â Â Â(build/version.o): Added building rule.
> Â Â Â Â(build/gengtype$(build_exeext)): Added build/version.o.
--
Laurynas