[ELF] Allow ? without adjacent space

GNU ld allows 1 ? 2?3:4 : 5?6 :7
This commit is contained in:
Fangrui Song 2022-06-25 21:16:59 -07:00
parent e3f3d2abf0
commit 77295c5486
2 changed files with 2 additions and 2 deletions

View File

@ -192,7 +192,7 @@ bool ScriptLexer::atEOF() { return errorCount() || tokens.size() == pos; }
// Split a given string as an expression. // Split a given string as an expression.
// This function returns "3", "*" and "5" for "3*5" for example. // This function returns "3", "*" and "5" for "3*5" for example.
static std::vector<StringRef> tokenizeExpr(StringRef s) { static std::vector<StringRef> tokenizeExpr(StringRef s) {
StringRef ops = "+-*/:!~=<>"; // List of operators StringRef ops = "!~*/+-<>?:="; // List of operators
// Quoted strings are literal strings, so we don't want to split it. // Quoted strings are literal strings, so we don't want to split it.
if (s.startswith("\"")) if (s.startswith("\""))

View File

@ -25,7 +25,7 @@ SECTIONS {
logicalor = (0 || 0) + (0||1)*2 + (1|| 0)*4 + (1 ||1) *8; logicalor = (0 || 0) + (0||1)*2 + (1|| 0)*4 + (1 ||1) *8;
logicalor2 = 0 && 0 || 1 && 1; logicalor2 = 0 && 0 || 1 && 1;
ternary1 = 0 ? 1 : 2 & 6; ternary1 = 0 ? 1 : 2 & 6;
ternary2 = 1 ? 2 ? 3 : 4 : 5 ? 6 : 7; ternary2 = 1 ? 2?3:4 : 5?6 :7;
plusassign =1; plusassign =1;
plusassign += 2; plusassign += 2;