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: -ftree-check for review


> Except this won't match:
> fopen(XXXX, &"rw"[0])
> Or:
> fopen(XXXX, &"11\0rw"[3])

On Thursday 10 May 2007 00:06, Andrew Pinski wrote:
>
> But that is not the example you gave before, I want to match "rw"
> strings using what you gave:
> gcc --tree-check="%_ = fopen(%_, "rw")" *.c
>
> So it does not work as you expected or even asked for really.
>
> Thanks,
> Andrew Pinski

Oh, I'm sorry, I was too quick, this time.

Yes, to match your first code sample, the pattern has to be written in Gimple 
form:

[nic@paco C]$ ~/Gcc/graphite/inst/bin/gcc -c 
--tree-check='%X=fopen(%_,&"rw"[0])'  c.c

As for matching your second code sample:

fopen(XXXX, &"11\0rw"[3])

I think the \0 character in the string fools out the matcher, like most Unix 
tools, including some implementations of grep, awk, etc. It's very contrived, 
isn't it.

Nic.


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