ro created this revision.
ro added a reviewer: rsmith.
Herald added a subscriber: fedor.sergeev.
Herald added a project: clang.

`Clang :: Driver/cl-response-file.c` currently FAILs on Solaris:

  Command Output (stderr):
  --
  /vol/llvm/src/clang/dist/test/Driver/cl-response-file.c:10:11: error: CHECK: 
expected string not found in input
  // CHECK: "-I" "{{.*}}\\Inputs\\cl-response-file\\" "-D" "FOO=2"
            ^

Looking at the generated response file reveals that this is no surprise:

  /I/vol/llvm/src/clang/dist/test/Driver\Inputs

with no newline at the end.  The echo command used to create it boils down to

  echo 'a\cb'

However, one cannot expect `\c` to be emitted literally: e.g. bash's builtin 
echo has

  \c        suppress further output

I've tried various combinations of builtin echo, /usr/bin/echo, GNU echo if 
different,
the same for printf, and the backslash unescaped and quoted (`a\cb` and 
`a\\cb`).  The
only combination that worked reliably on Solaris, Linux, and macOS was

  printf 'a\\cb'

so this is what this patch uses.  Tested on `amd64-pc-solaris2.11` and 
`x86_64-pc-linux-gnu`.
Ok for trunk?


Repository:
  rC Clang

https://reviews.llvm.org/D63600

Files:
  test/Driver/cl-response-file.c


Index: test/Driver/cl-response-file.c
===================================================================
--- test/Driver/cl-response-file.c
+++ test/Driver/cl-response-file.c
@@ -4,7 +4,7 @@
 
 
 
-// RUN: echo '/I%S\Inputs\cl-response-file\ /DFOO=2' > %t.rsp
+// RUN: printf '/I%S\Inputs\\cl-response-file\ /DFOO=2' > %t.rsp
 // RUN: %clang_cl /c -### @%t.rsp -- %s 2>&1 | FileCheck %s
 
 // CHECK: "-I" "{{.*}}\\Inputs\\cl-response-file\\" "-D" "FOO=2"


Index: test/Driver/cl-response-file.c
===================================================================
--- test/Driver/cl-response-file.c
+++ test/Driver/cl-response-file.c
@@ -4,7 +4,7 @@
 
 
 
-// RUN: echo '/I%S\Inputs\cl-response-file\ /DFOO=2' > %t.rsp
+// RUN: printf '/I%S\Inputs\\cl-response-file\ /DFOO=2' > %t.rsp
 // RUN: %clang_cl /c -### @%t.rsp -- %s 2>&1 | FileCheck %s
 
 // CHECK: "-I" "{{.*}}\\Inputs\\cl-response-file\\" "-D" "FOO=2"
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to