From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11912 invoked by alias); 22 Sep 2010 02:24:07 -0000 Received: (qmail 11903 invoked by uid 22791); 22 Sep 2010 02:24:06 -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,TW_GT X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Sep 2010 02:23:56 +0000 Received: by qyk31 with SMTP id 31so5483183qyk.20 for ; Tue, 21 Sep 2010 19:23:54 -0700 (PDT) Received: by 10.224.27.210 with SMTP id j18mr7519452qac.164.1285122234150; Tue, 21 Sep 2010 19:23:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.1.81 with HTTP; Tue, 21 Sep 2010 19:23:34 -0700 (PDT) In-Reply-To: <20100921211217.df1ef337.basile@starynkevitch.net> References: <20100921210301.d92889be.basile@starynkevitch.net> <20100921210829.5f2ea8b0.basile@starynkevitch.net> <20100921211217.df1ef337.basile@starynkevitch.net> From: Laurynas Biveinis Date: Wed, 22 Sep 2010 12:05:00 -0000 Message-ID: Subject: Re: gengtype improvements for plugins, thirdround! patch 3/7 [inputfile] 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/msg01771.txt.bz2 2010/9/21 Basile Starynkevitch : > 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 =3D -1; + int opt =3D -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 =3D 0; i < num_gt_files; i++) { - parse_file (gt_files[i]); - DBGPRINTF ("parsed file #%d %s", (int) i, gt_files[i]); - } + for (i =3D 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 =3D 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 =3D 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 =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 (get_output_file_name, plugin_fil= es) > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_file_srcdir_relative_path, nb_plugin_file= s): moved to gengtype.h. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_file_basename, get_file_realbasename, get= _file_langdir): Use > =C2=A0 =C2=A0 =C2=A0 =C2=A0an input_file as argument. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(error_at_line): Use input_file-s. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(gt_files, num_gt_files, this_file, system_h_f= ile): Declared as > =C2=A0 =C2=A0 =C2=A0 =C2=A0input_file-s. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(lang_dir_names, num_lang_dirs): No static. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_lang_bitmap, set_lang_bitmap): Moved to g= engtype.h. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(read_input_list): Use input_file-s. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(new_structure): Remove location_s hack. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(creat_field_all, get_file_realbasename) > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_file_srcdir_relative_path, get_file_basen= ame) > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_file_langdir, get_file_gtfilename) > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_output_file_with_visibility, get_output_f= ile_name) > =C2=A0 =C2=A0 =C2=A0 =C2=A0(put_mangled_filename): Use input_file-s. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(struct flist): Removed name and added file fi= eld. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(output_type_enum): Use input_file-s. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(finish_root_table, write_roots): Use file not= name field of > =C2=A0 =C2=A0 =C2=A0 =C2=A0struct flist. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(dump_fileloc, parse_program_options): Use inp= ut_file-s. > > =C2=A0 =C2=A0 =C2=A0 =C2=A0* gengtype.h (struct input_file_st, input_file= ): New structure and > =C2=A0 =C2=A0 =C2=A0 =C2=A0type. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(INPUT_FILE_MAGIC, CHECK_INPUT_FILE_MAGIC): Ne= w macros. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(gt_files, num_gt_files): New variables moved = from gengtype.c. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(this_file, system_h_file): New variables. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(input_file_by_name): Declared new function. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_input_file_name): New inline function. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_lang_bitmap, set_lang_bitmap): Moved from= gengtype.c and > =C2=A0 =C2=A0 =C2=A0 =C2=A0updated. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(struct fileloc): field file changed type. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(lang_dir_names, num_lang_dirs): moved from ge= ngtype.c. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(get_output_file_with_visibility, get_output_f= ile_name): Use > =C2=A0 =C2=A0 =C2=A0 =C2=A0input_file-s. > > =C2=A0 =C2=A0 =C2=A0 =C2=A0* gengtype-lex.l: =C2=A0Updated copyright year= . Included errors.h. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(yybegin): use input_file-s. > > =C2=A0 =C2=A0 =C2=A0 =C2=A0* gengtype-parse.c: =C2=A0 Updated copyright y= ear. Included errors.h. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(parse_error): Use input_file-s. > =C2=A0 =C2=A0 =C2=A0 =C2=A0(type): Generate anonymous names differently f= or GCC source input > =C2=A0 =C2=A0 =C2=A0 =C2=A0and other input. --=20 Laurynas