Bugzilla – Attachment 76 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]
new quick-and-dirty patch
write_pragma_libs.patch (text/plain), 2.86 KB, created by
Ketmar Dark
on 2014-08-20 10:58:54 CEST
(
hide
)
Description:
new quick-and-dirty patch
Filename:
MIME Type:
Creator:
Ketmar Dark
Created:
2014-08-20 10:58:54 CEST
Size:
2.86 KB
patch
obsolete
>diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc >index c11d2a3..7ab5484 100644 >--- a/gcc/d/d-lang.cc >+++ b/gcc/d/d-lang.cc >@@ -178,6 +178,8 @@ d_init_options (unsigned int, cl_decoded_option *decoded_options) > > // extra D-specific options > flag_emit_templates = TEnormal; >+ flag_pragma_lib_filename = 0; >+ flag_pragma_lib_file_created = 0; > } > > /* Initialize options structure OPTS. */ >@@ -529,6 +531,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); >+ flag_pragma_lib_filename = tmp; >+ } break; >+ > case OPT_fversion_: > if (ISDIGIT (arg[0])) > { >diff --git a/gcc/d/d-objfile.cc b/gcc/d/d-objfile.cc >index 0a44a86..2b694ec 100644 >--- a/gcc/d/d-objfile.cc >+++ b/gcc/d/d-objfile.cc >@@ -160,10 +160,32 @@ AttribDeclaration::toObjFile (int) > void > PragmaDeclaration::toObjFile (int) > { >+ if (ident == Id::lib && flag_pragma_lib_filename) { >+ Expression *e = (*args)[0]; >+ StringExp *se = e->toString(); >+ if (se->len > 0) { >+ char *name = new char[se->len + 1]; >+ memcpy(name, se->string, se->len); >+ name[se->len] = 0; >+ if (flag_pragma_lib_filename && flag_pragma_lib_file_created >= 0) { >+ FILE *fo = fopen(flag_pragma_lib_filename, (flag_pragma_lib_file_created ? "a" : "w")); >+ if (fo) { >+ flag_pragma_lib_file_created = 1; // file successfully created >+ fprintf(fo, "-l\"%s\"\n", name); >+ fclose(fo); >+ } else { >+ flag_pragma_lib_file_created = -1; // error occured, don't try to do this anymore >+ warning (loc, "can't write pragma(lib) file '%s'", flag_pragma_lib_filename); >+ } >+ } >+ delete [] name; >+ } >+ } >+ > if (!global.params.ignoreUnsupportedPragmas) > { >- if (ident == Id::lib) >- warning (loc, "pragma(lib) not implemented"); >+ if (ident == Id::lib && !flag_pragma_lib_filename) >+ warning (loc, "pragma(lib) not implemented (you can use -fwrite-pragma-libs=<filename> to write it to <filename>)"); > else if (ident == Id::startaddress) > warning (loc, "pragma(startaddress) not implemented"); > } >diff --git a/gcc/d/lang.opt b/gcc/d/lang.opt >index 5df6e80..4d51d22 100644 >--- a/gcc/d/lang.opt >+++ b/gcc/d/lang.opt >@@ -23,6 +23,12 @@ D > Variable > int flag_emit_templates > >+Variable >+char *flag_pragma_lib_filename >+ >+Variable >+int flag_pragma_lib_file_created >+ > > debuglib= > Driver Joined >@@ -156,6 +162,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