"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dmd/mars.d" between
dmd-2.095.0.tar.gz and dmd-2.095.1.tar.gz

About: DMD (Digital Mars D) is the D reference compiler. D is an object-oriented, imperative, multi-paradigm system programming language.

mars.d  (dmd-2.095.0):mars.d  (dmd-2.095.1)
skipping to change at line 428 skipping to change at line 428
if (params.mixinFile) if (params.mixinFile)
{ {
params.mixinOut = cast(OutBuffer*)Mem.check(calloc(1, OutBuffer.sizeof)) ; params.mixinOut = cast(OutBuffer*)Mem.check(calloc(1, OutBuffer.sizeof)) ;
atexit(&flushMixins); // see comment for flushMixins atexit(&flushMixins); // see comment for flushMixins
} }
scope(exit) flushMixins(); scope(exit) flushMixins();
global.path = buildPath(params.imppath); global.path = buildPath(params.imppath);
global.filePath = buildPath(params.fileImppath); global.filePath = buildPath(params.fileImppath);
if (params.makeDeps && params.oneobj)
{
assert(params.objname);
OutBuffer* ob = params.makeDeps;
ob.writestring(toPosixPath(params.objname));
ob.writestring(":");
}
if (params.addMain) if (params.addMain)
files.push("__main.d"); files.push("__main.d");
// Create Modules // Create Modules
Modules modules = createModules(files, libmodules); Modules modules = createModules(files, libmodules);
// Read files // Read files
// Start by "reading" the special files (__main.d, __stdin.d) // Start by "reading" the special files (__main.d, __stdin.d)
foreach (m; modules) foreach (m; modules)
{ {
if (params.addMain && m.srcfile.toString() == "__main.d") if (params.addMain && m.srcfile.toString() == "__main.d")
{ {
skipping to change at line 637 skipping to change at line 629
semantic3OnDependencies(modules[0].aimports[i]); semantic3OnDependencies(modules[0].aimports[i]);
Module.runDeferredSemantic3(); Module.runDeferredSemantic3();
const data = (*ob)[]; const data = (*ob)[];
if (params.moduleDepsFile) if (params.moduleDepsFile)
writeFile(Loc.initial, params.moduleDepsFile, data); writeFile(Loc.initial, params.moduleDepsFile, data);
else else
printf("%.*s", cast(int)data.length, data.ptr); printf("%.*s", cast(int)data.length, data.ptr);
} }
// All imports are resolved at this stage
// output the makefile module dependencies
if (params.makeDeps && params.oneobj)
{
OutBuffer* ob = params.makeDeps;
ob.writenl();
const data = (*ob)[];
if (params.makeDepsFile)
writeFile(Loc.initial, params.makeDepsFile, data);
else
printf("%.*s", cast(int)data.length, data.ptr);
}
printCtfePerformanceStats(); printCtfePerformanceStats();
printTemplateStats(); printTemplateStats();
Library library = null; Library library = null;
if (params.lib) if (params.lib)
{ {
if (params.objfiles.length == 0) if (params.objfiles.length == 0)
{ {
error(Loc.initial, "no input files"); error(Loc.initial, "no input files");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
library = Library.factory(); library = Library.factory();
library.setFilename(params.objdir, params.libname); library.setFilename(params.objdir, params.libname);
// Add input object and input library files to output library // Add input object and input library files to output library
foreach (p; libmodules) foreach (p; libmodules)
library.addObject(p.toDString(), null); library.addObject(p.toDString(), null);
} }
// Generate output files // Generate output files
if (params.doJsonGeneration) if (params.doJsonGeneration)
{ {
generateJson(&modules); generateJson(&modules);
} }
if (!global.errors && params.doDocComments) if (!global.errors && params.doDocComments)
{ {
foreach (m; modules) foreach (m; modules)
{ {
gendocfile(m); gendocfile(m);
skipping to change at line 772 skipping to change at line 752
foreach (m; modules) foreach (m; modules)
{ {
m.deleteObjFile(); m.deleteObjFile();
if (params.oneobj) if (params.oneobj)
break; break;
} }
params.exefile.toCStringThen!(ef => File.remove(ef.ptr)); params.exefile.toCStringThen!(ef => File.remove(ef.ptr));
} }
} }
} }
// Output the makefile dependencies
if (params.emitMakeDeps)
emitMakeDeps(params, library);
if (global.errors || global.warnings) if (global.errors || global.warnings)
removeHdrFilesAndFail(params, modules); removeHdrFilesAndFail(params, modules);
return status; return status;
} }
/// Emit the makefile dependencies for the -makedeps switch
version (NoMain) {} else
{
void emitMakeDeps(ref Param params, Library library)
{
assert(params.emitMakeDeps);
OutBuffer buf;
// start by resolving and writing the target (which is sometimes resolve
d during link phase)
if (params.link && params.exefile)
{
buf.writeEscapedMakePath(&params.exefile[0]);
}
else if (params.lib && library)
{
buf.writeEscapedMakePath(library.getFilename());
}
else if (params.objname)
{
buf.writeEscapedMakePath(&params.objname[0]);
}
else if (params.objfiles.length)
{
buf.writeEscapedMakePath(params.objfiles[0]);
foreach (of; params.objfiles[1 .. $])
{
buf.writestring(" ");
buf.writeEscapedMakePath(of);
}
}
else
{
assert(false, "cannot resolve makedeps target");
}
buf.writestring(":");
// then output every dependency
foreach (dep; params.makeDeps)
{
buf.writestringln(" \\");
buf.writestring(" ");
buf.writeEscapedMakePath(dep);
}
buf.writenl();
const data = buf[];
if (params.makeDepsFile)
writeFile(Loc.initial, params.makeDepsFile, data);
else
printf("%.*s", cast(int) data.length, data.ptr);
}
}
private FileBuffer readFromStdin() private FileBuffer readFromStdin()
{ {
enum bufIncrement = 128 * 1024; enum bufIncrement = 128 * 1024;
size_t pos = 0; size_t pos = 0;
size_t sz = bufIncrement; size_t sz = bufIncrement;
ubyte* buffer = null; ubyte* buffer = null;
for (;;) for (;;)
{ {
buffer = cast(ubyte*)mem.xrealloc(buffer, sz + 4); // +2 for sentinel an d +2 for lexer buffer = cast(ubyte*)mem.xrealloc(buffer, sz + 4); // +2 for sentinel an d +2 for lexer
skipping to change at line 2490 skipping to change at line 2530
} }
else if (p[5] != '\0') else if (p[5] != '\0')
{ {
// Else output to stdout. // Else output to stdout.
goto Lerror; goto Lerror;
} }
params.moduleDeps = new OutBuffer(); params.moduleDeps = new OutBuffer();
} }
else if (startsWith(p + 1, "makedeps")) // https://dlang.org/dm d.html#switch-makedeps else if (startsWith(p + 1, "makedeps")) // https://dlang.org/dm d.html#switch-makedeps
{ {
if (params.makeDeps) if (params.emitMakeDeps)
{ {
error("-makedeps[=file] can only be provided once!"); error("-makedeps[=file] can only be provided once!");
break; break;
} }
if (p[9] == '=') if (p[9] == '=')
{ {
if (p[10] == '\0') if (p[10] == '\0')
{ {
error("expected filename after -makedeps="); error("expected filename after -makedeps=");
break; break;
} }
params.makeDepsFile = (p + 10).toDString; params.makeDepsFile = (p + 10).toDString;
} }
else if (p[9] != '\0') else if (p[9] != '\0')
{ {
goto Lerror; goto Lerror;
} }
// Else output to stdout. // Else output to stdout.
params.makeDeps = new OutBuffer(); params.emitMakeDeps = true;
} }
else if (arg == "-main") // https://dlang.org/dmd.html#switc h-main else if (arg == "-main") // https://dlang.org/dmd.html#switc h-main
{ {
params.addMain = true; params.addMain = true;
} }
else if (startsWith(p + 1, "man")) // https://dlang.org/dmd.html#switc h-man else if (startsWith(p + 1, "man")) // https://dlang.org/dmd.html#switc h-man
{ {
params.manual = true; params.manual = true;
return false; return false;
} }
skipping to change at line 2703 skipping to change at line 2743
else else
{ {
if (params.objname && numSrcFiles) if (params.objname && numSrcFiles)
{ {
params.oneobj = true; params.oneobj = true;
//error("multiple source files, but only one .obj name"); //error("multiple source files, but only one .obj name");
//fatal(); //fatal();
} }
} }
if (params.makeDeps && !params.oneobj)
error(Loc.initial, "-makedeps switch is not compatible with multiple obj
ects mode");
if (params.noDIP25) if (params.noDIP25)
params.useDIP25 = false; params.useDIP25 = false;
} }
/** /**
Creates the module based on the file provided Creates the module based on the file provided
The file is dispatched in one of the various arrays The file is dispatched in one of the various arrays
(global.params.{ddocfiles,dllfiles,jsonfiles,etc...}) (global.params.{ddocfiles,dllfiles,jsonfiles,etc...})
according to its extension. according to its extension.
 End of changes. 8 change blocks. 
27 lines changed or deleted 64 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)