This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lto][patch] Use @args when calling xgcc from lto-wrapper


> You should also use writeargv here instead of writing out the
> arguments manually.

The attached patch does that.

2009-02-02  Rafael Avila de Espindola  <espindola@google.com>

	* lto-wrapper.c (fork_execute): Use writeargv.

> Thanks,
> Andrew Pinski
>

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index aafaa7f..06c8690 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -181,12 +181,15 @@ fork_execute (char **argv)
   char *args_name = make_temp_file(".args");
   char *at_args = concat ("@", args_name, NULL);
   FILE *args = fopen (args_name, "w");
-  int i;
+  int status;
 
   if (args == NULL)
     fatal ("failed to open %s", args_name);
-  for (i = 1; argv[i]; i++)
-    fprintf (args, "%s\n", argv[i]);
+
+  status = writeargv (&argv[1], args);
+
+  if (status)
+    fatal ("could not write to temporary file %s",  args_name);
 
   fclose (args);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]