Hi!

My recent change to make_relative_prefix_1 introduced a warning, if alloca
is defined as a macro.

Fixed thusly, committed to trunk and sources CVS as obvious.

2012-01-26  Jakub Jelinek  <ja...@redhat.com>

        * make-relative-prefix.c (make_relative_prefix_1): Avoid warning
        about using preprocessor directives inside of macro arguments.

--- libiberty/make-relative-prefix.c.jj 2012-01-03 16:22:42.000000000 +0100
+++ libiberty/make-relative-prefix.c    2012-01-26 15:23:40.249585617 +0100
@@ -248,14 +248,15 @@ make_relative_prefix_1 (const char *prog
        {
          char *startp, *endp, *nstore;
          size_t prefixlen = strlen (temp) + 1;
+         size_t len;
          if (prefixlen < 2)
            prefixlen = 2;
 
-         nstore = (char *) alloca (prefixlen + strlen (progname) + 1
+         len = prefixlen + strlen (progname) + 1;
 #ifdef HAVE_HOST_EXECUTABLE_SUFFIX
-                                   + strlen (HOST_EXECUTABLE_SUFFIX)
+         len += strlen (HOST_EXECUTABLE_SUFFIX);
 #endif
-                                   );
+         nstore = (char *) alloca (len);
 
          startp = endp = temp;
          while (1)

        Jakub

Reply via email to