From 88f1bc8b55b9f5abf35fdf974310c1063fa41068 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 3 Mar 2012 18:45:08 +0000 Subject: Modify backslash/newline handling for POSIX. We fixed Savannah 16670 but that broke previously-working makefiles that relied on the GNU make behavior. The POSIX behavior doesn't seem to me to be better, and can be obtained using GNU make as well, so put it back as the default behavior and require .POSIX to get the POSIX behavior. Add a new section to the manual discussing backslash/newline handling. Update the test suite. --- misc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index 55b0dd8..0ea56bb 100644 --- a/misc.c +++ b/misc.c @@ -112,12 +112,17 @@ collapse_continuations (char *line) /* Skip the newline. */ ++in; - /* If the newline is escaped, discard following whitespace leaving just - one space. POSIX requires that each backslash/newline/following - whitespace sequence be reduced to a single space. */ if (backslash) { + /* Backslash/newline handling: + In traditional GNU make all trailing whitespace, consecutive + backslash/newlines, and any leading whitespace on the next line + is reduced to a single space. + In POSIX, each backslash/newline and is replaced by a space. */ in = next_token (in); + if (! posix_pedantic) + while (out > line && isblank ((unsigned char)out[-1])) + --out; *out++ = ' '; } else -- cgit v1.2.3