Bug 9497 – ddoc: add support for handling undefined macros

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-10T14:16:54Z
Last change time
2018-03-30T06:54:41Z
Keywords
preapproved, pull
Assigned to
No Owner
Creator
Andrei Alexandrescu

Comments

Comment #0 by andrei — 2013-02-10T14:16:54Z
Currently an undefined ddoc macro expands to the empty string. This makes typos in macros and ill-configured builds difficult to debug. Handling undefined macros should be done with a predefined macro DDOC_UNDEFINED_MACRO. If macro XYZ is used as e.g. $(XYZ arg1,arg2) without being defined, it is replaced with $(DDOC_UNDEFINED_MACRO XYZ,arg1,arg2). If in turn DDOC_UNDEFINED_MACRO is undefined, the expansion is the empty string (thus ensuring backward compatibility). This allows users to define useful behaviors, such as: a) replace with a comment: DDOC_UNDEFINED_MACRO=$(DDOC_COMMENT $(DOLLAR)($1 $+)) b) keep verbatim DDOC_UNDEFINED_MACRO=$(DOLLAR)($1 $+) c) keep only the argument text DDOC_UNDEFINED_MACRO=$+ d) replace with a greppable text such that subsequent tools can find all occurrences: DDOC_UNDEFINED_MACRO=ERROR_UNDEFINED_MACRO: "$1"
Comment #1 by andrei — 2013-02-10T14:18:23Z
Comment #2 by github-bugzilla — 2015-01-09T19:53:52Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c1c21cd4839f52bb1153ad0e4b635109a935a673 Issue 9497 - ddoc: add support for handling undefined macros https://github.com/D-Programming-Language/dmd/commit/5425a9ec9a33b37154ba9cd0f3332d8b9c953632 Merge pull request #4226 from andralex/DDOC_UNDEFINED_MACRO Issue 9497 - ddoc: add support for handling undefined macros
Comment #3 by github-bugzilla — 2015-02-18T03:41:40Z
Comment #4 by greensunny12 — 2018-03-30T06:54:41Z
This was fixed in https://github.com/D-Programming-Language/dmd/pull/1653 (though someone didn't get closed) -> closing. BTW we now even have a check in place for dlang.org that prevents the usage of undefined macros.