[PATCH] c-pragma: adding a data field to pragma_handler
Basile Starynkevitch
basile@starynkevitch.net
Thu Jun 9 07:21:00 GMT 2011
On Wed, 08 Jun 2011 23:26:39 +0200
Pierre Vittet <piervit@pvittet.com> wrote:
> I have written a test for this patch and run it (it works correctly). I
> guess there is no reason why it should not be accepted now.
> To recap, this patch add a void * data field to the pragma handler,
> allowing to pass extra data. If we want to use this field, we need to
> use the function c_register_pragma_with_data or
> c_register_pragma_with_expansion_and_data. The old
> c_register_pragma(_with_expansion) is kept compatible.
===================================================================
--- gcc/c-family/c-pragma.c (revision 174521)
+++ gcc/c-family/c-pragma.c (working copy)
@@ -1148,12 +1148,12 @@ handle_pragma_float_const_decimal64 (cpp_reader
*A }
/* A vector of registered pragma callbacks. */
+/* This is never freed as we need it during the whole execution. */
+DEF_VEC_O (internal_pragma_handler);
+DEF_VEC_ALLOC_O (internal_pragma_handler, heap);
Sorry to be picky Pierre, but that comment is not correct. It should be
instead.
/* A vector of registered pragma callbacks, which is never freed. */
What I mean is that you are right that the vector is never freed, but
it is not because it is needed during the entire execution, since
middle-end and back-end passes don't know about pragmas.
I hope your patch will be ok-ed with that small change.
Perhaps a future patch would free that registered_pragmas vector, but I
feel that is not necessary, since it is not a big vector in practice.
Regards.
--
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} ***
More information about the Gcc-patches
mailing list