diff options
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cccp.c | 30 |
2 files changed, 29 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f4f27ff9675..eea0bf05b4c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +Mon Nov 17 15:35:38 1997 Tom Tromey <tromey@cygnus.com> + + * cccp.c (deps_output): Properly quote file names for make. + Mon Nov 17 13:21:40 1997 Jeffrey A Law (law@cygnus.com) * t-h8300 (MULTILIB_EXCEPTIONS): Define. diff --git a/gcc/cccp.c b/gcc/cccp.c index 7db33d0c00f..3a8a07687af 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -9950,6 +9950,8 @@ deps_output (string, spacer) int spacer; { int size = strlen (string); + int i; + char *p; if (size == 0) return; @@ -9966,17 +9968,35 @@ deps_output (string, spacer) spacer = 0; } - if (deps_size + size + 8 > deps_allocated_size) { - deps_allocated_size = (deps_size + size + 50) * 2; + if (deps_size + 2 * size + 8 > deps_allocated_size) { + deps_allocated_size = (deps_size + 2 * size + 50) * 2; deps_buffer = xrealloc (deps_buffer, deps_allocated_size); } if (spacer == ' ') { deps_buffer[deps_size++] = ' '; deps_column++; } - bcopy (string, &deps_buffer[deps_size], size); - deps_size += size; - deps_column += size; + + for (i = 0; i < size; ++i) + { + if (string[i] == '$') + { + deps_buffer[deps_size++] = '$'; + deps_column++; + } + else + { + p = strchr ("~[]*?()\\ ", string[i]); + if (p != NULL) + { + deps_buffer[deps_size++] = '\\'; + deps_column++; + } + } + deps_buffer[deps_size++] = string[i]; + deps_column++; + } + if (spacer == ':') { deps_buffer[deps_size++] = ':'; deps_column++; |