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-08/msg02065.html http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02068.html http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00983.html http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01079.html This fifth patch chunk is an improved version of http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02068.html taking into account Laurynas comments in http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00420.html http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01079.html I hope that adding comments don't decrease the probability of having this work accepted into GCC 4.6 end of stage 1. In addition to the improved comments, I made some minor cleanups w.r.t. http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02068.html (such as using OPTION_STRING instead of INFO_STRING for the kind of a string option, etc.). I also changed the indentation: old gengtype.c had severals struct FOOBAR { while it seems that the preferred indentation style (at least when looking into gimple.h or tree.h) is instead struct FOOBAR { which I suppose is the politically correct way of GCC coding. In addition of moving lots of typing definitions from gengtype.c to gengtype.h I also (and this is already the case in the previous version http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02068.html of this patch), and obviously, made the 'struct options' a typed & discriminated data, because to persist the gengtype state every union should be a sum type discriminated conveniently. The attached patch relative to the "thirdround" patch 4 [filesrules] obtained with diff -u -p $(svn stat . |awk '/[AM]/{print $2}') \ --from-file ../thirdround_04_filesrules/ > \ $HOME/Gengtype_Thirdround/patch5_typedopt-relto04.diff In am also attaching for convenience the cumulated patches against trunk 164437 as a gzip file ######## gcc/ChangeLog entry relative to patch 5/N thirdround! [filesrules] 2010-09-21 Jeremie Salvucci Basile Starynkevitch * gengtype.c (enum typekind, struct options, struct nested_ptr_data) (struct pair, NUM_PARAM, enum gc_used_enum, struct type, UNION_P) (UNION_OR_STRUCT_P): Moved into gengtype.h (string_type, scalar_nonchar, scalar_char): Removed static and added state_number fake value. (typedefs, structures, param_structs, variables): Removed static. (create_option): Removed function. (create_string_option, create_type_option, created_nested_option): New. (created_nested_ptr_option, create_optional_field_) (adjust_field_rtx_def, adjust_field_tree_exp): Updated accordingly. (adjust_field_type, process_gc_options, output_mangled_typename) (walk_type, write_func_for_structure, write_types, write_roots) (note_def_vec, dump_options): Ditto. Access to options is protected by tests on their kind. * gengtype.h: Added a lot of comments. Moved many definitions from gengtype.h and updated them. (typedef, structures, param_structs, variables): Declared extern. (enum typekind): Moved from gengtype.c and added TYPE_NONE. (enum option_kind): New. (struct options): Added discriminating kind, and info union. (struct nested_ptr_data): Moved from gengtype.c. (create_string_option, create_type_option, create_nested_option): New. (struct pair, enum_gc_used_enum, NUM_PARAM): Moved from gengtype.c and commented more. (struct_type): Ditto, added state_number. (string_type, scalar_nonchar, scalar_char): Moved from gengtype.c. (type_lineloc): New function. (UNION_P, UNION_OR_STRUCT_P): Moved from gengtype.c and commented more. (struct outf): Indented better. * gengtype-parse.c (str_optvalue_opt, type_optvalue, option): Updated for our discriminated option. ################################################################ Comments and/or Ok for trunk are welcome! Cheers. -- 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} ***