[Issue 9497] New: ddoc: add support for handling undefined macros

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 10 14:16:55 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9497

           Summary: ddoc: add support for handling undefined macros
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at erdani.com


--- Comment #0 from Andrei Alexandrescu <andrei at erdani.com> 2013-02-10 14:16:54 PST ---
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"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list