[llvm] [MC,ELF] Emit warning if a string constant contains newline char. (PR #98060)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 18:32:00 PDT 2024
================
@@ -0,0 +1,69 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2>&1 -o /dev/null | FileCheck --strict-whitespace %s --check-prefix=CHECK-WARN
+
+.string "abcd\xFFefg
+12345678"
+
+.ascii "some test ascii
+
+sequence
+with
+newlines\x0A
+"
+
+.asciz "another test string
+
+with
+newline characters
+
+
+"
+
+// CHECK-WARN: warn-newline-in-escaped-string.s:3:21: warning: unterminated string; newline inserted
----------------
MaskRay wrote:
Instead of string/string/string check/check/check, consider check/string check/string check/string that new tests use more.
You can use the following to test relative line numbers, so that inserting lines in the future would not require test update. We often omit the filename.
```
[[#@LINE+1]]:21: warning:
```
https://github.com/llvm/llvm-project/pull/98060
More information about the llvm-commits
mailing list