Hello,

The below fixes an embarrassing thinko of mine that breaks bootstrap on
SPU and PPC targets (at very least).  I am surprised it doesn't break
more code.  :-(

I have lightly tested it on SPU in a cross compiled environment (so I
couldn't bootstrap it there) and I have bootstrapped it on
x86_64-unknown-linux-gnu.  One person confirmed in the audit trail of
the PR that it fixes the issue for him on PPC, so I am proposing the
patch even if I don't know if it bootstraps on SPU or PPC in general.

OK for trunk?

From: Dodji Seketeli <do...@redhat.com>
Date: Thu, 20 Oct 2011 09:43:49 +0200
Subject: [PATCH] Fix thinko in _cpp_remaining_tokens_num_in_context

libcpp/

        * lex.c (_cpp_remaining_tokens_num_in_context): Fix computation of
        number of tokens in "direct tokens contexts".
---
 libcpp/ChangeLog |    6 ++++++
 libcpp/lex.c     |    3 +--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libcpp/lex.c b/libcpp/lex.c
index cd6ae9f..cf8ef7d 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1710,8 +1710,7 @@ _cpp_remaining_tokens_num_in_context (cpp_reader *pfile)
 {
   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)
-- 
1.7.6.4

-- 
                Dodji

Reply via email to