diff options
author | Fangrui Song <i@maskray.me> | 2022-06-25 21:16:59 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-06-25 21:16:59 -0700 |
commit | 77295c5486e48a4319efcfc4ac262304c7e7025c (patch) | |
tree | 7f67605602b6e102dabdc11f21030860f26aa946 | |
parent | e3f3d2abf06b68f9b151f2fab89623e6b8e40c0d (diff) | |
download | llvm-77295c5486e48a4319efcfc4ac262304c7e7025c.zip llvm-77295c5486e48a4319efcfc4ac262304c7e7025c.tar.gz llvm-77295c5486e48a4319efcfc4ac262304c7e7025c.tar.bz2 |
[ELF] Allow ? without adjacent space
GNU ld allows 1 ? 2?3:4 : 5?6 :7
-rw-r--r-- | lld/ELF/ScriptLexer.cpp | 2 | ||||
-rw-r--r-- | lld/test/ELF/linkerscript/operators.test | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp index 8b1a510..6f9ffb7 100644 --- a/lld/ELF/ScriptLexer.cpp +++ b/lld/ELF/ScriptLexer.cpp @@ -192,7 +192,7 @@ bool ScriptLexer::atEOF() { return errorCount() || tokens.size() == pos; } // Split a given string as an expression. // This function returns "3", "*" and "5" for "3*5" for example. 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. if (s.startswith("\"")) diff --git a/lld/test/ELF/linkerscript/operators.test b/lld/test/ELF/linkerscript/operators.test index 438229c..2480dad 100644 --- a/lld/test/ELF/linkerscript/operators.test +++ b/lld/test/ELF/linkerscript/operators.test @@ -25,7 +25,7 @@ SECTIONS { logicalor = (0 || 0) + (0||1)*2 + (1|| 0)*4 + (1 ||1) *8; logicalor2 = 0 && 0 || 1 && 1; ternary1 = 0 ? 1 : 2 & 6; - ternary2 = 1 ? 2 ? 3 : 4 : 5 ? 6 : 7; + ternary2 = 1 ? 2?3:4 : 5?6 :7; plusassign =1; plusassign += 2; |