This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, libcpp] Fix thinko in _cpp_remaining_tokens_num_in_context (PR bootstrap/50801)
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: dodji at redhat dot com (Dodji Seketeli)
- Cc: gcc-patches at gcc dot gnu dot org (GCC Patches), tromey at redhat dot com (Tom Tromey), jason at redhat dot com (Jason Merrill)
- Date: Thu, 20 Oct 2011 10:33:06 +0200 (CEST)
- Subject: Re: [PATCH, libcpp] Fix thinko in _cpp_remaining_tokens_num_in_context (PR bootstrap/50801)
Dodji Seketeli wrote:
> cpp_context *context = pfile->context;
> if (context->tokens_kind == TOKENS_KIND_DIRECT)
> - return ((LAST (context).token - FIRST (context).token)
> - / sizeof (cpp_token));
> + return (LAST (context).token - FIRST (context).token);
> else if (context->tokens_kind == TOKENS_KIND_INDIRECT
> || context->tokens_kind == TOKENS_KIND_EXTENDED)
> return ((LAST (context).ptoken - FIRST (context).ptoken)
B.t.w. isn't the same thinko also present in the "else if" path:
else if (context->tokens_kind == TOKENS_KIND_INDIRECT
|| context->tokens_kind == TOKENS_KIND_EXTENDED)
return ((LAST (context).ptoken - FIRST (context).ptoken)
/ sizeof (cpp_token *));
"ptoken" seems to be of type "const cpp_token **", so the pointer
subtraction already divides by sizeof (cpp_token *).
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com