This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: misc gengtype micro-patch (use macro for predefined typedef)


On Fri, Nov 5, 2010 at 9:16 PM, Basile Starynkevitch
<basile@starynkevitch.net> wrote:
> The following patch is a cleaner macro to
> force the pos to the actual position. (I actually created
> the mistake by indenting the file too GNU-sely).
>
>
> Index: gcc/gengtype.c
> ===================================================================
> --- gcc/gengtype.c ? ? ?(revision 166376)
> +++ gcc/gengtype.c ? ? ?(working copy)
> @@ -4531,28 +4536,21 @@ main (int argc, char **argv)
> ? ? ? /* These types are set up with #define or else outside of where
> ? ? ? ? ?we can see them. ?We should initialize them before calling
> ? ? ? ? ?read_input_list. ?*/
> - ? ? ?pos.file = this_file;
> - ? ? ?pos.line = __LINE__ + 1;
> - ? ? ?do_scalar_typedef ("CUMULATIVE_ARGS", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_scalar_typedef ("REAL_VALUE_TYPE", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_scalar_typedef ("FIXED_VALUE_TYPE", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_scalar_typedef ("double_int", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_scalar_typedef ("uint64_t", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_scalar_typedef ("uint8", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_scalar_typedef ("jword", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_scalar_typedef ("JCF_u2", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_scalar_typedef ("void", &pos);
> - ? ? ?pos.line++;
> - ? ? ?do_typedef ("PTR", create_pointer (resolve_typedef ("void",
> &pos)),
> - ? ? ? ? ? ? ? ? &pos);
> +#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__;
> \
> + ? ? ? Call;} while(0)
> + ? ? ?POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
> + ? ? ?POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
> + ? ? ?POS_HERE (do_scalar_typedef ("FIXED_VALUE_TYPE", &pos));
> + ? ? ?POS_HERE (do_scalar_typedef ("double_int", &pos));
> + ? ? ?POS_HERE (do_scalar_typedef ("uint64_t", &pos));
> + ? ? ?POS_HERE (do_scalar_typedef ("uint8", &pos));
> + ? ? ?POS_HERE (do_scalar_typedef ("jword", &pos));
> + ? ? ?POS_HERE (do_scalar_typedef ("JCF_u2", &pos));
> + ? ? ?POS_HERE (do_scalar_typedef ("void", &pos));
> + ? ? ?POS_HERE (do_typedef ("PTR",
> + ? ? ? ? ? ? ? ? ? ? ? ? ? create_pointer (resolve_typedef ("void", &pos)),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? &pos));

This doesn't look like a 1:1 transformation - who increments pos.line?

> +#undef POS_HERE
> ? ? ? read_input_list (inputlist);
> ? ? ? for (i = 0; i < num_gt_files; i++)
> ? ? ? ?{
> ################ gcc/ChangeLog entry
> 2010-11-05 ?Basile Starynkevitch ?<basile@starynkevitch.net>
> ? ? ? ?* gengtype (main): Get here's position using POS_HERE macro for
> ? ? ? ? ?do*typedef calls.
> ##############
>
> Ok for trunk?
>
> PS. Since I am changing web provider next week, I might have transitory
> email problems. If an email bounce to basile@starynkevitch.net please
> resend it to both basile.starynkevitch@gmail.com &
> basile.starynkevitch@cea.fr (but don't use these emails when
> basile@starynkevitch.net works)
> --
> 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 mine, sont seulement les miennes} ***
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]