From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2772 invoked by alias); 22 Sep 2010 01:58:09 -0000 Received: (qmail 2698 invoked by uid 22791); 22 Sep 2010 01:58:08 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-qy0-f182.google.com (HELO mail-qy0-f182.google.com) (209.85.216.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Sep 2010 01:58:03 +0000 Received: by qyk4 with SMTP id 4so117772qyk.20 for ; Tue, 21 Sep 2010 18:58:01 -0700 (PDT) Received: by 10.229.10.223 with SMTP id q31mr6934811qcq.280.1285120681609; Tue, 21 Sep 2010 18:58:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.1.81 with HTTP; Tue, 21 Sep 2010 18:57:41 -0700 (PDT) In-Reply-To: <20100921210301.d92889be.basile@starynkevitch.net> References: <20100921210301.d92889be.basile@starynkevitch.net> From: Laurynas Biveinis Date: Wed, 22 Sep 2010 11:08:00 -0000 Message-ID: Subject: Re: gengtype improvements for plugins, thirdround! patch 1/7 [declprog] To: Basile Starynkevitch Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-09/txt/msg01768.txt.bz2 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 =3D -1; + while ((opt =3D getopt_long (argc, argv, "hVdP:S:I:w:r:D", + gengtype_long_options, NULL)) >=3D 0) + { + switch (opt) + { + case 'h': /* --help */ + print_usage (); + break; + case 'V': /* --version */ + print_version (); + break; + case 'd': /* --dump */ + do_dump =3D 1; + break; Wrong indentation... + /*** Parse the input list and the input files. ***/ /* Parse ... */ + for (i =3D 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 <=3D 0 || !plugin_files) + fatal ("No plugin files given in plugin mode for %s", plugin_output_filen= ame); + /* Parse our plugin files. */ + for (ix =3D 0; ix < nb_plugin_files; ix++) + parse_file (plugin_files[ix]); + + if (hit_error) + return 1; + + plugin_output =3D 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 =C2=A0Jeremie Salvucci =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Basile Starynkevitch =C2=A0 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0* gengtype.c: =C2=A0Include getopt.h and versi= on.h. > > =C2=A0 =C2=A0 =C2=A0 =C2=A0(lang_bitmap, struct outf, outf_p) > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_output_file_with_visibility, oprintf): De= finitions moved to > =C2=A0 =C2=A0 =C2=A0 =C2=A0gengtype.h > =C2=A0 =C2=A0 =C2=A0 =C2=A0(output_files, header_file, srcdir, srcdir_len= , this_file, > do_dump): No more static variables. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(do_debug): New. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(dbgprint_count_type_at): Added new function. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(gengtype_long_options): New. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(print_usage, print_version, parse_program_opt= ions): New. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(main): Call parse_program_options, and remove= d old option > =C2=A0 =C2=A0 =C2=A0 =C2=A0handling code. =C2=A0Added some debug output. > > =C2=A0 =C2=A0 =C2=A0 =C2=A0* gengtype.h: =C2=A0Updated copyright year. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(lang_bitmap, struct outf, outf_p, header_file= , oprintf) > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_output_file_with_visibility, srcdir, srcd= ir_len, do_dump): > =C2=A0 =C2=A0 =C2=A0 =C2=A0Moved from gengtype.c to here. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(do_debug, read_state_filename, write_state_fi= lename): New > variables. (DBGPRINTF, DBGPRINT_COUNT_TYPE): New macros. > > =C2=A0 =C2=A0 =C2=A0 =C2=A0* Makefile.in: > =C2=A0 =C2=A0 =C2=A0 =C2=A0(REVISION): Always defined. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(version.o): Removed ifdef REVISION_c. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(s-gtype): Pass arguments to build/gengtype pr= ogram. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(build/version.o): Added building rule. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(build/gengtype$(build_exeext)): Added build/v= ersion.o. --=20 Laurynas