This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
testing that a Gimple call argument is a string...
- From: Basile Starynkevitch <basile at starynkevitch dot net>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 18 Oct 2012 22:33:36 +0200
- Subject: testing that a Gimple call argument is a string...
Hello
I'm coding in MELT the ex06/ of https://github.com/bstarynk/melt-examples/
which should typecheck calls to variadic functions json_pack & json_unpack
from http://www.digip.org/jansson (a JSON library in C).
I'm working on a MELT pass on Gimple/SSA after phiopt (maybe that place is wrong?)
I don't understand well how to check that a given Gimple argument is a string.
I was thinking of using useless_type_conversion_p or types_compatible_p on the TREE_TYPE of some POINTER_TYPE with char_type_node, but it seems to not work as I would expect
How would you (in C++ or C for a 4.6) code such a test (that argument 2 of some GIMPLE_CALL is a string, ie. a char* in C parlance)?
(I'm coding in MELT, but I am not asking a MELT specific question; I have hard time understanding how that should be coded in C++).
Or where is the typechecking for __attribute__((format(printf))) functions done in the GCC source tree?
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 mines, sont seulement les miennes} ***