gengtype improvements for plugins, completed! patch 4/N [filesrules]

Laurynas Biveinis laurynas.biveinis@gmail.com
Mon Sep 13 10:41:00 GMT 2010


I see that my previous comments were addressed and I have no further
comments on this one :)

2010/9/10 Basile Starynkevitch <basile@starynkevitch.net>:
>
> 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
>
> This is a slightly improved version of the patch
> http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02065.html with Laurynas
> comments from http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00419.html
> adressed.  As I told before, it improves the core
> get_output_file_with_visibility function. This version (relative to
> http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02065.html I did sent
> before) improved comments and function names, following Laurynas
> advices; I also avoided calling regexec twice needlessly. I added a
> lot of explanatory comments.
>
> The function get_output_file_with_visibility is made much more modular
> and less ad hoc by a file rule machinery. We now use regular
> expressions to match the input file name and compute the associated
> output name & for name.  Here is the updated comment (contained in the
> patch) explaining the details.
>
> /***
>  Regexpr machinery to compute the output_name and for_name-s of each
>  input_file. We have a sequence of file rules which gives the POSIX
>  extended regular expression to match an input file path, and two
>  transformed strings for the corresponding output_name and the
>  corresponding for_name.  The transformed string contain dollars: $0
>  is replaced by the entire match, $1 is replaced by the substring
>  matching the first parenthesis in the regexp, etc. And $$ is replaced
>  by a single verbatim dollar.  The rule order is important.  The
>  general case is last, and the particular cases should come before.
>  An action routine can, when needed, update the out_name & for_name
>  and/or return the appropriate output file.  It is invoked only when a
>  rule is triggered. When a rule is triggered, the output_name and
>  for_name are computed using their transform string in while $$, $0,
>  $1, ... are suitably replaced.  If there is an action, it is called.
>  In some few cases, the action can directly return the outf_p, but
>  usually it just updates the output_name and for_name so should free
>  them before replacing them.  The get_output_file_with_visibility
>  function creates an outf_p only once per each output_name, so it
>  scans the output_files list for previously seen output file names.
>  */
>
> The patch relative to the magic variant sent in
> http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00842.html is obtained
> with
>
> diff -u -p  $(svn stat . |awk '/M/{print $2}') \
>     --from-file ../gengtype-gcc-03-inputfile/ > \
>     $HOME/tmp/gengtype_patch_4_of_N__filesrules-relto03.diff
>
> ########## gcc/ChangeLog entry ###########"
> 2010-09-10  Jeremie Salvucci  <jeremie.salvucci@free.fr>
>            Basile Starynkevitch  <basile@starynkevitch.net>
>
>        * gengtype.c: Include xregex.h and obstack.h
>        Added comments about role of get_output_file_with_visibility and
>        our regexpr machinery.
>        (frul_actionrout_t, struct file_rule_st): New.
>        (hader_dot_h_frul, source_dot_c_frul): New functions.
>        (NULL_REGEX,  NULL_FRULACT): New.
>        (files_rules): New.
>        (matching_file_name_substitute): New function.
>        (get_output_file_with_visibility): Updated comments and rewritten
>        to use the new files_rules machinery.
> #######################
>
>
> For convenience, I am also attaching the cumulated patches -against
> trunk 163987 as a gzip file
> gengtype_patch_4_of_N__filesrules-cumulatedto04-trunkrev-163987.diff.gz
> Ok for trunk?
>
> Cheers.
>
> --
> Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
> email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
> 8, rue de la Faiencerie, 92340 Bourg La Reine, France
> *** opinions {are only mines, sont seulement les miennes} ***
>



-- 
Laurynas



More information about the Gcc-patches mailing list