Mantis 1957

A macro actual argument may be empty

In P1800-2008/D3a. Section 21.5.1,

CHANGE

To use a macro defined with arguments, the name of the text macro shall be followed by a list of actual arguments in parentheses, separated by commas. White space shall be allowed between the text macro name and the left parenthesis. The number of actual arguments shall match the number of formal arguments.

TO

To use a macro defined with arguments, the name of the text macro shall be followed by a list of actual arguments in parentheses, separated by commas. White space shall be allowed between the text macro name and the left parenthesis. White space before and after the arguments shall be stripped off before argument substitution into the macro text.

 

The number of actual arguments shall match the number of formal arguments. However,  an actual argument may be empty or white space only, in which case the formal argument is substituted by nothing. Commas must still be used to maintain the correct number of arguments.

 

Example:

`define D(x,y) initial $display(“start”, x , y, “end”);

 

`D(“msg1”,”msg2”) // prints “startmsg1msg2end”

`D(“msg1”, )      // prints “startmsg1 end”

`D(,”msg2”)       // prints “start msg2end”

`D(,)             // prints “start  end”

`D(“msg1”)        // illegal, only one argument

`D()              // illegal, only one empty argument