Bugzilla – Attachment 75 Details for
Bug 153
add option to list all libraries from pragma(lib, "...")
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Bug creation and email sending has been disabled, file new bugs at
gcc.gnu.org/bugzilla
[patch]
quick-and-dirty hack that adds option -fwrite-pragma-libs=
write_pragma_libs.patch (text/plain), 2.82 KB, created by
Ketmar Dark
on 2014-08-19 06:16:16 CEST
(
hide
)
Description:
quick-and-dirty hack that adds option -fwrite-pragma-libs=
Filename:
MIME Type:
Creator:
Ketmar Dark
Created:
2014-08-19 06:16:16 CEST
Size:
2.82 KB
patch
obsolete
>diff --git a/gcc/d/d-glue.cc b/gcc/d/d-glue.cc >index d19b180..f07e45b 100644 >--- a/gcc/d/d-glue.cc >+++ b/gcc/d/d-glue.cc >@@ -50,6 +50,9 @@ Global::init (void) > this->stdmsg = stdout; > this->main_d = "__main.d"; > >+ this->pragma_lib_filename = 0; >+ this->pragma_lib_file_created = 0; >+ > memset (&this->params, 0, sizeof (Param)); > } > >diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc >index c11d2a3..948589f 100644 >--- a/gcc/d/d-lang.cc >+++ b/gcc/d/d-lang.cc >@@ -529,6 +529,13 @@ d_handle_option (size_t scode, const char *arg, int value, > global.params.useUnitTests = value; > break; > >+ case OPT_fwrite_pragma_libs_: { >+ // ah, let it leak! >+ char *tmp = new char[strlen(arg)+1]; >+ strcpy(tmp, arg); >+ global.pragma_lib_filename = (const char *)&tmp[0]; >+ } break; >+ > case OPT_fversion_: > if (ISDIGIT (arg[0])) > { >diff --git a/gcc/d/dfrontend/attrib.c b/gcc/d/dfrontend/attrib.c >index 8e1aa88..13b6171 100644 >--- a/gcc/d/dfrontend/attrib.c >+++ b/gcc/d/dfrontend/attrib.c >@@ -1076,6 +1076,16 @@ void PragmaDeclaration::semantic(Scope *sc) > ob->writestring((char *) name); > ob->writenl(); > } >+ if (global.pragma_lib_filename && global.pragma_lib_file_created >= 0) { >+ FILE *fo = fopen(global.pragma_lib_filename, (global.pragma_lib_file_created ? "a" : "w")); >+ if (fo) { >+ global.pragma_lib_file_created = 1; // file successfully created >+ fprintf(fo, "-l\"%s\"\n", name); >+ fclose(fo); >+ } else { >+ global.pragma_lib_file_created = -1; // error occured, don't try to do this anymore >+ } >+ } > mem.free(name); > } > } >diff --git a/gcc/d/dfrontend/mars.h b/gcc/d/dfrontend/mars.h >index 17787d2..2b4de66 100644 >--- a/gcc/d/dfrontend/mars.h >+++ b/gcc/d/dfrontend/mars.h >@@ -238,6 +238,10 @@ struct Global > Strings *path; // Array of char*'s which form the import lookup path > Strings *filePath; // Array of char*'s which form the file import lookup path > >+ // writing pragma(lib) to file >+ const char *pragma_lib_filename; // NULL: don't write; (? "" -- stdout) >+ int pragma_lib_file_created; // !0: append; <0: error >+ > const char *version; > > Compiler compiler; >diff --git a/gcc/d/lang.opt b/gcc/d/lang.opt >index 5df6e80..63dc88f 100644 >--- a/gcc/d/lang.opt >+++ b/gcc/d/lang.opt >@@ -156,6 +156,10 @@ fversion= > D Joined RejectNegative > -fversion=<level|ident> Compile in version code >= <level> or identified by <ident> > >+fwrite-pragma-libs= >+D Joined RejectNegative >+-fwrite-pragma-libs=<filename> write all libraries from pragma(lib) to <filename> >+ > fXf= > D Joined RejectNegative > -fXf=<filename> Write JSON file to <filename>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 153
: 75 |
76