[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
https://issues.dlang.org/show_bug.cgi?id=5051 Rainer Schuetze changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #12 from Rainer Schuetze --- We have -mixin now, so I guess we can close this (considering Andrei's suggested tool out of scope for this issue). *** This issue has been marked as a duplicate of issue 12790 *** --
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
https://issues.dlang.org/show_bug.cgi?id=5051 ZombineDev changed: What|Removed |Added CC||petar.p.ki...@gmail.com --
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
https://issues.dlang.org/show_bug.cgi?id=5051 Andrei Alexandrescu changed: What|Removed |Added Keywords||bootcamp CC||and...@erdani.com --- Comment #10 from Andrei Alexandrescu --- That would be an interesting project. I'm envisioning it as a standalone program called e.g. "dlower" that lowers D code into a smaller subset of D. Possible flags for that program: --expand-mixins = expand all possible mixins in the code --lookup = execute lookup on all symbols and write the full symbol, e.g. writeln becomes .std.stdio.writeln --operators = explicitate all user-defined operators, e.g. a + b becomes a.opBinary!"+"(b) --omit-function-bodies = do not output function bodies, .di style --specialize-templates = write specialized versions for all templates used within the module (this is likely to be tricky) --scope = lower all scope statements into try statements --foreach = lower all foreach statements into for statements --explicit-import = specify the exact symbols needed for each import statement (which means: if no symbols, the import is redundant - easy to mark as a warning by a subsequent tool) --static-if = evaluate all static ifs possible (this mostly makes sense if --specialize-templates is also present) --versions = lower code using version(), i.e. make the unused branch disappear --omit-comments = make all comments disappear --omit-nondoc-comments = make only non-documentation comments disappear --ctfe = evaluate all possible CTFEs (tricky) The tool should generate compilable D code with the same semantics as the input and #line directives pointing to the input. Such a tool would make possible a bunch of others. I'll talk to the graduate students, maybe someone will take this. --
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
https://issues.dlang.org/show_bug.cgi?id=5051 --- Comment #11 from Andrei Alexandrescu --- *** Issue 5137 has been marked as a duplicate of this issue. *** --
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
https://issues.dlang.org/show_bug.cgi?id=5051 Andrei Alexandrescu changed: What|Removed |Added Version|unspecified |D2 --
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #9 from bearophile_h...@eml.cc 2013-08-02 04:40:27 PDT --- Just don't such switch "partial compilation" because in computer science "partial compilation" or "partial evaluation" mean something different for compilations: http://en.wikipedia.org/wiki/Partial_evaluation -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 Maxim Fomin changed: What|Removed |Added CC||ma...@maxim-fomin.ru --- Comment #8 from Maxim Fomin 2013-08-01 23:54:46 PDT --- I also find this usefull and in the absence of such feature currently use expression dumping (exp->toChars()) during IR stage - https://github.com/mxfm/dmd/compare/patched, but Don's way is probably better. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 yebblies changed: What|Removed |Added CC||yebbl...@gmail.com --- Comment #7 from yebblies 2013-08-02 14:15:18 EST --- No, --b prints out stuff like this: * Basic Block 003B7D28 el:003B9488 cnt=0 cs=0 , TYvoid 003B8C20 003B9450 el:003B8C20 cnt=0 cs=0 = TY* 003B8B40 003B8BE8 el:003B8B40 cnt=0 cs=0 var TY* c el:003B8BE8 cnt=0 cs=0 call TY* 003B8BB0 003B8B78 el:003B8BB0 cnt=0 cs=0 var TYC func _d_newclass el:003B8B78 cnt=0 cs=0 relconst TY* 0+& _D5testx5C16877__ClassZ el:003B9450 cnt=0 cs=0 || TYvoid 003B9230 003B9418 el:003B9230 cnt=0 cs=0 == TYbool 003B8DA8 003B91F8 el:003B8DA8 cnt=0 cs=0 * TY* 003B8D70 el:003B8D70 cnt=0 cs=0 + TY* 003B8C90 003B8D38 el:003B8C90 cnt=0 cs=0 * TY* 003B8C58 el:003B8C58 cnt=0 cs=0 var TY* c el:003B8D38 cnt=0 cs=0 * TYunsigned 003B8CC8 003B8D00 el:003B8CC8 cnt=0 cs=0 const TYunsigned 0L el:003B8D00 cnt=0 cs=0 const TYunsigned 4L el:003B91F8 cnt=0 cs=0 * TY* 003B91C0 el:003B91C0 cnt=0 cs=0 + TY* 003B9150 003B9188 el:003B9150 cnt=0 cs=0 , TY* 003B9070 003B9118 el:003B9070 cnt=0 cs=0 = TYlong long 003B8EB0 003B9038 el:003B8EB0 cnt=0 cs=0 var TYlong long __dgtmp4 Not really usable for debugging anything except the glue layer. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 --- Comment #6 from hst...@quickfur.ath.cx 2013-08-01 10:48:21 PDT --- According to Walter, dmd has a --b flag (purportedly only in debug builds?) that prints the expression trees sent to the backend. Not quite preprocessed D code per se, but close enough for debugging purposes. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 --- Comment #5 from Trass3r 2012-01-06 06:02:59 PST --- Here's another proposal: https://github.com/D-Programming-Language/dmd/pull/426 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 --- Comment #4 from Rainer Schuetze 2010-12-05 04:13:12 PST --- Created an attachment (id=839) write mixin expansions to file Here it is against svn 780. Usage is: dmd test.d -mixin=mixins.d What's missing is the instantiation backtrace for the line numbers in the error messages, but the resulting mixin file shows the source line number of the instantiation in a comment. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 Trass3r changed: What|Removed |Added CC||mrmoc...@gmx.de --- Comment #3 from Trass3r 2010-12-02 15:38:19 PST --- Yeah, post it, please. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 Rainer Schuetze changed: What|Removed |Added CC||r.sagita...@gmx.de --- Comment #2 from Rainer Schuetze 2010-10-19 11:40:55 PDT --- Some time ago, I have been playing around with a patch to dmd that would dunp any mixin expansion into a file passed on the command line. After compilation, you could look them up, but even better, you can single step through the code with a debugger (at least, if there are line feeds in the mixin). Another benefit: source line numbers in mixins do not overlap with the source code after the mixin anymore, but the patch was not good enough to show the place of instantiation in an error message. If there is interest, I can dig it up and create a diff to current svn. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)
http://d.puremagic.com/issues/show_bug.cgi?id=5051 Don changed: What|Removed |Added CC||clugd...@yahoo.com.au --- Comment #1 from Don 2010-10-19 00:11:20 PDT --- Agreed, I actually use this a lot when debugging backend bugs. What I do is modify FuncDeclaration::toObjFile() in glue.c. To do it properly would require a (fairly simple) pass over the syntax tree, but the function case one is the most important by far. As you can see, it's very simple. Incidentally, when properly implemented, this feature would bring us much of the way towards having a C backend. //printf("'%s' is SCfastpar\n",sp->Sident); } } } + if (!parent->isDeclaration()) { + printf("%s ", ((TypeFunction *)(func->type))->next->toChars()); + printf("%s(%s)\n{\n %s}\n\n", func->toChars(), +parameters?parameters->toChars() : "", +func->fbody->toChars()); + } if (func->fbody) { block *b; Blockx bx; Statement *sbody; localgot = NULL; sbody = func->fbody; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---