Re: [PATCH] Detect __DATE__ and __TIME__ correctly.

Justin Lebar <[email protected]>
Newsgroups gmane.comp.compilers.ccache
Message-ID <CAFWcpZ6ToimpEThrhEDyCtbNv9uTAM70gRJCGZsKGa2x_puq0g@mail.gmail.com>
> I've encountered a bug while playing with ccache: temporal macros are not
> detected correctly.

Ouch!

>  		 * the assumption that 'E' is less common in source than '_', we check
> 		 * str[i-2] first.

Update the comment?

>  	while (i < len) {

I think this fails on at least one edge case: If the file contains
only the string "__date__", then len == i == 8 and we never enter the
loop, right?  I think we in general fail to detect temporal macros at
the very end of the file, with this patch.

The solution isn't as simple as making it |i <= len|, of course,
because the end of the loop reads str[i].

-Justin

On Mon, Oct 8, 2012 at 8:56 AM, Andrew Stubbs <[email protected]> wrote:
> Hi Joel,
>
> I've encountered a bug while playing with ccache: temporal macros are not
> detected correctly.
>
> Patch attached.
>
> Andrew
>
> _______________________________________________
> ccache mailing list
> [email protected]
> https://lists.samba.org/mailman/listinfo/ccache
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.