Hello All, [join work by Basile Starynkevitch & Jeremie Salvucci] References: http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02060.html http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00616.html http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00663.html http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02063.html http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00887.html http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01702.html http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01706.html As I told in http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00808.html I am continuing to send the complete patch series of our gengtype work. This does not mean I am ignoring the recieved feedback. I intend to send a third round of patches once this "complete!" round is ended. I am taking into account most of Laurynas comments in http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00212.html with the important exception of INPUT_FILE_MAGIC, discussed below. Laurynas latter gave more feedback in http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00887.html that we did take into account. The gengtype-lex.l & gengtype-parse.c files need to include fatal.h because it is used from gengtype.h Laurynas thinks that adding a magic number don't bring anything and is just a temporary trick we (Jeremie & me Basile) used to code this patch. This is indeed true, but I (Basile) believe that this trick is really useful to future gengtype hackers, since input files are painfully reachable from types in a non-trivial way (and that very fact is an occasion for bugs). I would like opinion of other people, in particular of reviewers, on that issue. As I told before sending our patch serie, gengtype is difficult to understand, and we insist on defensive programming. And this INPUT_FILE_MAGIC used in macro CHECK_INPUT_FILE_MAGIC is exactly a case of defensive programming (disabled unless ENABLE_CHECKING is configured). It will be very probably useful to future gengtype hackers, so I pray the allmighty reviewers to consider accepting it. The http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00842.html previous version of this patch contained two variants, one with the INPUT_FILE_MAGIC trick and one without. I would prefer the magic trick to be included, since it will definitely help any brave or foolish :-) enough gengtype hacker. If you really want me to remove the trick before committing this patch, please ask. Notice that since I added the CHECK_INPUT_FILE_MAGIC macro, the trick don't need much lines in the patch. Since struct location_s is no longer used inside GCC, the hack in new_structure to handle it is removed. The attached patch is relative to the previous patch 2 [verbosity] sent This relative patch was obtained with diff -u -p -N $(svn stat | awk '/[AM]/{print $2}') \ --from-file ../thirdround_02_verbosity/ > \ $HOME/Gengtype_Thirdround/patch3_inputfile-relto02.diff ########## gcc/ChangeLog entry is 2010-09-20 Jeremie Salvucci Basile Starynkevitch * 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. ########## Regards. -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***