mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 350433 - [formatter] Line wrapping if "\ua" or "\ud" occurs in preprocessor directive
This commit is contained in:
parent
60de352b8e
commit
b7382e51f1
2 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2011 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -800,7 +800,7 @@ public class SimpleScanner {
|
|||
private void getRestOfPreprocessorLine() {
|
||||
int c = getChar();
|
||||
while (true) {
|
||||
while ((c != '\n') && (c != '\r') && (c != '/') && (c != EOFCHAR)) {
|
||||
while ((c != '\n') && (c != '\r') && (c != '/') && (c != '"') && (c != EOFCHAR)) {
|
||||
c = getChar();
|
||||
}
|
||||
if (c == '/') {
|
||||
|
@ -823,6 +823,9 @@ public class SimpleScanner {
|
|||
c = next;
|
||||
continue;
|
||||
}
|
||||
} else if (c == '"') {
|
||||
matchStringLiteral();
|
||||
c = getChar();
|
||||
} else {
|
||||
ungetChar(c);
|
||||
break;
|
||||
|
|
|
@ -2512,4 +2512,10 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
public void testMacroInBinaryExpression_Bug344379() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
public void testBackslashUInPreprocessorDirective_Bug350433() throws Exception {
|
||||
String before= "#include \"test\\udp.h\"\n";
|
||||
String expected= before;
|
||||
assertFormatterResult(before, expected);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue