summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2012-03-03 18:45:08 +0000
committerPaul Smith <psmith@gnu.org>2012-03-03 18:45:08 +0000
commit88f1bc8b55b9f5abf35fdf974310c1063fa41068 (patch)
treebe70080dda3724b65809d43052f21550a59cb29a /misc.c
parent6405534814f04899890a2d932db9a4985fd772fe (diff)
downloadgunmake-88f1bc8b55b9f5abf35fdf974310c1063fa41068.tar.gz
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.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c11
1 files changed, 8 insertions, 3 deletions
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