From cba528317f619f014fcd1b47e84e7be02a462358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Tue, 5 Feb 2013 15:21:48 +0100 Subject: [PATCH] Cpp: Detect the other two conflict markers too. --- src/preprocessor.h | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/preprocessor.h b/src/preprocessor.h index 32b4c9155f..3775535bf3 100644 --- a/src/preprocessor.h +++ b/src/preprocessor.h @@ -1074,11 +1074,12 @@ static ptrdiff_t lower_cpp(struct cpp *this, for(pos=0; pos<len;) { - ptrdiff_t old_pos = pos; + ptrdiff_t old_pos = pos; + int c; /* fprintf(stderr,"%c",data[pos]); fflush(stderr); */ - switch(data[pos++]) + switch(c = data[pos++]) { case '\n': if(flags & CPP_END_AT_NEWLINE) return pos-1; @@ -1120,20 +1121,26 @@ static ptrdiff_t lower_cpp(struct cpp *this, break; /* Minor optimization */ - case '<': - if(data[pos]=='<' && - data[pos+1]=='<' && - data[pos+2]=='<' && - data[pos+3]=='<' && - data[pos+4]=='<' && - data[pos+5]=='<') + case '<': case '=': case '>': + if(data[pos]==c && + data[pos+1]==c && + data[pos+2]==c && + data[pos+3]==c && + data[pos+4]==c && + data[pos+5]==c) { cpp_error(this, "Merge conflict detected."); - + PUTC(c); + do { + PUTC(c); + } while (data[++pos] == c); + continue; + } + /* FALL_THROUGH */ + case '!': case '@': case '$': case '%': case '^': case '&': - case '*': case '(': case ')': case '-': case '=': case '+': + case '*': case '(': case ')': case '-': case '+': case '{': case '}': case ':': case '?': case '`': case ';': - case '>': case ',': case '.': case '~': case '[': - case ']': case '|': + case ',': case '.': case '~': case '[': case ']': case '|': PUTC(data[pos-1]); break; -- GitLab