Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
View | Details | Raw Unified | Return to bug 153
Collapse All | Expand All

(-)a/gcc/d/d-lang.cc (+9 lines)
Lines 178-183 d_init_options (unsigned int, cl_decoded_option *decoded_options) Link Here
178
178
179
  // extra D-specific options
179
  // extra D-specific options
180
  flag_emit_templates = TEnormal;
180
  flag_emit_templates = TEnormal;
181
  flag_pragma_lib_filename = 0;
182
  flag_pragma_lib_file_created = 0;
181
}
183
}
182
184
183
/* Initialize options structure OPTS.  */
185
/* Initialize options structure OPTS.  */
Lines 529-534 d_handle_option (size_t scode, const char *arg, int value, Link Here
529
      global.params.useUnitTests = value;
531
      global.params.useUnitTests = value;
530
      break;
532
      break;
531
533
534
    case OPT_fwrite_pragma_libs_: {
535
      // ah, let it leak!
536
      char *tmp = new char[strlen(arg)+1];
537
      strcpy(tmp, arg);
538
      flag_pragma_lib_filename = tmp;
539
      } break;
540
532
    case OPT_fversion_:
541
    case OPT_fversion_:
533
      if (ISDIGIT (arg[0]))
542
      if (ISDIGIT (arg[0]))
534
	{
543
	{
(-)a/gcc/d/d-objfile.cc (-2 / +24 lines)
Lines 160-169 AttribDeclaration::toObjFile (int) Link Here
160
void
160
void
161
PragmaDeclaration::toObjFile (int)
161
PragmaDeclaration::toObjFile (int)
162
{
162
{
163
  if (ident == Id::lib && flag_pragma_lib_filename) {
164
    Expression *e = (*args)[0];
165
    StringExp *se = e->toString();
166
    if (se->len > 0) {
167
      char *name = new char[se->len + 1];
168
      memcpy(name, se->string, se->len);
169
      name[se->len] = 0;
170
      if (flag_pragma_lib_filename && flag_pragma_lib_file_created >= 0) {
171
        FILE *fo = fopen(flag_pragma_lib_filename, (flag_pragma_lib_file_created ? "a" : "w"));
172
        if (fo) {
173
          flag_pragma_lib_file_created = 1; // file successfully created
174
          fprintf(fo, "-l\"%s\"\n", name);
175
          fclose(fo);
176
        } else {
177
          flag_pragma_lib_file_created = -1; // error occured, don't try to do this anymore
178
          warning (loc, "can't write pragma(lib) file '%s'", flag_pragma_lib_filename);
179
        }
180
      }
181
      delete [] name;
182
    }
183
  }
184
163
  if (!global.params.ignoreUnsupportedPragmas)
185
  if (!global.params.ignoreUnsupportedPragmas)
164
    {
186
    {
165
      if (ident == Id::lib)
187
      if (ident == Id::lib && !flag_pragma_lib_filename)
166
	warning (loc, "pragma(lib) not implemented");
188
	warning (loc, "pragma(lib) not implemented (you can use -fwrite-pragma-libs=<filename> to write it to <filename>)");
167
       else if (ident == Id::startaddress)
189
       else if (ident == Id::startaddress)
168
	 warning (loc, "pragma(startaddress) not implemented");
190
	 warning (loc, "pragma(startaddress) not implemented");
169
    }
191
    }
(-)a/gcc/d/lang.opt (+10 lines)
Lines 23-28 D Link Here
23
Variable
23
Variable
24
int flag_emit_templates
24
int flag_emit_templates
25
25
26
Variable
27
char *flag_pragma_lib_filename
28
29
Variable
30
int flag_pragma_lib_file_created
31
26
32
27
debuglib=
33
debuglib=
28
Driver Joined
34
Driver Joined
Lines 156-161 fversion= Link Here
156
D Joined RejectNegative
162
D Joined RejectNegative
157
-fversion=<level|ident> Compile in version code >= <level> or identified by <ident>
163
-fversion=<level|ident> Compile in version code >= <level> or identified by <ident>
158
164
165
fwrite-pragma-libs=
166
D Joined RejectNegative
167
-fwrite-pragma-libs=<filename> write all libraries from pragma(lib) to <filename>
168
159
fXf=
169
fXf=
160
D Joined RejectNegative
170
D Joined RejectNegative
161
-fXf=<filename> Write JSON file to <filename>
171
-fXf=<filename> Write JSON file to <filename>

Return to bug 153