[hackers] [scc] [cc1] Fix EOF in cpp mode || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 16 Jan 2017 16:32:26 +0100 (CET)

commit 04b94d81004857b6f21a15622001bb8c8996d9c5
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Jan 16 16:30:33 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Jan 16 16:30:33 2017 +0100

    [cc1] Fix EOF in cpp mode
    
    Lexer was returning EOF in expressions evaluated in CPPMODE
    after expanding some macro. It was happening because and
    end of line in CPPMODE was always considered EOF, but
    since last changes we can have inputs pushed up from
    other inputs in CPPMODE.
    
    TODO: Change the input mechanism :(

diff --git a/cc1/lex.c b/cc1/lex.c
index dd1e902..7714583 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -642,12 +642,18 @@ skipspaces(void)
 repeat:
         while (isspace(*input->p))
                 ++input->p;
- if (*input->p == '\0' && lexmode != CPPMODE) {
- if (!moreinput())
+ input->begin = input->p;
+
+ if (*input->p != '\0')
+ return;
+
+ if (lexmode == CPPMODE) {
+ if (!input || !input->next || !input->next->fp)
                         return;
- goto repeat;
         }
- input->begin = input->p;
+ if (!moreinput())
+ return;
+ goto repeat;
 }
 
 unsigned
Received on Mon Jan 16 2017 - 16:32:26 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 16 2017 - 16:36:18 CET