r321828 - Use backslash escape, replacing xargs -0 in test macro-multiline.c

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 14:58:31 PST 2018

Author: hubert.reinterpretcast
Date: Thu Jan  4 14:58:30 2018
New Revision: 321828

URL: http://llvm.org/viewvc/llvm-project?rev=321828&view=rev
Use backslash escape, replacing xargs -0 in test macro-multiline.c

xargs supports escaping of newline characters with backslash.
xargs -0 is neither part of POSIX nor the LSB.

This patch removes the -0 option and adjusts the input to xargs
accordingly; that is, the input is a text file not ending in an
incomplete line, and the newline of interest is preceded by a backslash.

Note: The treatment of escaped newline characters is not as clearly
specified by POSIX as for escaped blank characters; however, the same
can be said for escaped backslashes. It is slightly more clear for the
case where the -I option is used; however, -I is also of limited

Reviewers: bruno

Reviewed By: bruno

Subscribers: bruno, rcraik, cfe-commits

Differential Revision: https://reviews.llvm.org/D41544


Modified: cfe/trunk/test/Preprocessor/macro-multiline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro-multiline.c?rev=321828&r1=321827&r2=321828&view=diff
--- cfe/trunk/test/Preprocessor/macro-multiline.c (original)
+++ cfe/trunk/test/Preprocessor/macro-multiline.c Thu Jan  4 14:58:30 2018
@@ -1,4 +1,4 @@
-// RUN: printf -- "-DX=A\nTHIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT" | xargs -0 %clang -E %s | FileCheck -strict-whitespace %s
+// RUN: printf -- "-DX=A\\\\\nTHIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT\n" | xargs %clang -E %s | FileCheck -strict-whitespace %s
 // Per GCC -D semantics, \n and anything that follows is ignored.

More information about the cfe-commits mailing list