[PATCH] collect2 -fpreprocessed bug
John David Anglin
dave@hiauly1.hia.nrc.ca
Tue Apr 1 01:39:00 GMT 2008
This change fixes PR 35665. The constructor file generated by
collect2 is wrapped in
#ifdef __cplusplus
...
#endif
This causes a problem since collect2 inherits the options passed to
the driver (gfortran in the PR). When -fpreprocessed is used, preprocessing
is not done and we end up with garbage in the c file.
collect2 uses "-x c" for the c compilation, so the language is always
C. Thus, it appears unnecessary to add defines to make the file C++
compatible.
Ok for trunk?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2008-03-31 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR driver/35665
* collect2.c (write_c_file): Don't wrap in "#ifdef __cplusplus".
Index: collect2.c
===================================================================
--- collect2.c (revision 133160)
+++ collect2.c (working copy)
@@ -2043,14 +2043,12 @@
static void
write_c_file (FILE *stream, const char *name)
{
- fprintf (stream, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
#ifndef LD_INIT_SWITCH
if (! shared_obj)
write_c_file_glob (stream, name);
else
#endif
write_c_file_stat (stream, name);
- fprintf (stream, "#ifdef __cplusplus\n}\n#endif\n");
}
#ifdef COLLECT_EXPORT_LIST
More information about the Gcc-patches
mailing list