Mercurial > projects > ldc
changeset 604:a30fc28e8f23
Make creating and deleting of doc and hdr files dependent on whether doc and
hdr files are to be generated.
Fixes html_empty_01,02
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Tue, 16 Sep 2008 09:00:05 +0200 |
parents | 10bc9eb9e262 |
children | e235b80c92bc |
files | dmd/module.c dmd/module.h |
diffstat | 2 files changed, 29 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/module.c Tue Sep 16 08:42:40 2008 +0200 +++ b/dmd/module.c Tue Sep 16 09:00:05 2008 +0200 @@ -124,6 +124,8 @@ // LLVMDC llvmForceLogging = false; + this->doDocComment = doDocComment; + this->doHdrGen = doHdrGen; } File* Module::buildFilePath(char* forcename, char* path, char* ext) @@ -166,19 +168,32 @@ void Module::buildTargetFiles() { - if(objfile && docfile && hdrfile) + if(objfile && + (!doDocComment || docfile) && + (!doHdrGen || hdrfile)) return; - objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.bc_ext); - docfile = Module::buildFilePath(global.params.docname, global.params.docdir, global.doc_ext); - hdrfile = Module::buildFilePath(global.params.hdrname, global.params.hdrdir, global.hdr_ext); + if(!objfile) + objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.bc_ext); + if(doDocComment && !docfile) + docfile = Module::buildFilePath(global.params.docname, global.params.docdir, global.doc_ext); + if(doHdrGen && !hdrfile) + hdrfile = Module::buildFilePath(global.params.hdrname, global.params.hdrdir, global.hdr_ext); // safety check: never allow obj, doc or hdr file to have the source file's name - if(stricmp(FileName::name(objfile->name->str), FileName::name((char*)this->arg)) == 0 || - stricmp(FileName::name(docfile->name->str), FileName::name((char*)this->arg)) == 0 || - stricmp(FileName::name(hdrfile->name->str), FileName::name((char*)this->arg)) == 0) + if(stricmp(FileName::name(objfile->name->str), FileName::name((char*)this->arg)) == 0) + { + error("Output object files with the same name as the source file are forbidden"); + fatal(); + } + if(docfile && stricmp(FileName::name(docfile->name->str), FileName::name((char*)this->arg)) == 0) { - error("Object-, ddoc-, and header- output files with the same name as the source file are forbidden"); + error("Output doc files with the same name as the source file are forbidden"); + fatal(); + } + if(hdrfile && stricmp(FileName::name(hdrfile->name->str), FileName::name((char*)this->arg)) == 0) + { + error("Output header files with the same name as the source file are forbidden"); fatal(); } } @@ -189,8 +204,10 @@ objfile->remove(); //if (global.params.llvmBC) //bcfile->remove(); - if (docfile) + if (doDocComment && docfile) docfile->remove(); + if (doHdrGen && hdrfile) + hdrfile->remove(); } Module::~Module()
--- a/dmd/module.h Tue Sep 16 08:42:40 2008 +0200 +++ b/dmd/module.h Tue Sep 16 09:00:05 2008 +0200 @@ -110,6 +110,9 @@ Macro *macrotable; // document comment macros struct Escape *escapetable; // document comment escapes + int doDocComment; // enable generating doc comments for this module + int doHdrGen; // enable generating header file for this module + Module(char *arg, Identifier *ident, int doDocComment, int doHdrGen); ~Module();