________________________________ From: Rich, Dave [mailto:Dave_Rich@mentor.com] Sent: Monday, February 13, 2006 6:49 AM To: Feldman, Yulik Cc: sv-bc@eda.org Subject: RE: [sv-bc] white space at the end of macro text Yulik, The 1800 LRM allows you to construct both strings and identifiers, so preservation of white space would be desired. Not that I really need to know, but why couldn't you put your comments on the line before the macro? [Yulik] I've forwarded your question to the designer, but I may imagine an example when such comment is added by the code automatically generated by Oin compiler. In this case, the comment and the white space is added automatically (the white space is added for the "beauty" only), and the end result is that the spaces are inserted inappropriately. Maybe that situation should be considered a bug in the tool adding the comments, but I was wondering whether the LRM doesn't have an "automatic" solution for the problem (i.e. whether it says that the trailing spaces should be removed). Anyway, I think the language of the LRM should be improved to make it clear whether the correct interpretation is to remove the spaces or not. BTW, the same question applies to the spaces that precede the macro text (which is also not specified explicitly). My personal interpretation is that they should be removed (in which case it may be also consistent to require their removal from the end of the text :-)). Dave ________________________________ From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Feldman, Yulik Sent: Sunday, February 12, 2006 12:44 AM To: sv-bc@eda.org Subject: [sv-bc] white space at the end of macro text Hi, I'm not sure how to interpret the LRM on whether the white space at the end of macro text should become a part of the substituted macro text at the location of the macro usage, or whether it should be removed. Consider the following macro definition and macro usage: `define kuku 1 a = `kuku; The macro "kuku" contains 3 spaces at the end of the line before the new-line character. Should the result of the macro substitution be "a = 1;" or "a = 1 ;"? The section "19.3.1 `define" of IEEE P1364-2005 says: "The first newline not preceded by a backslash shall end the macro text.". This may be interpreted as if the white space should be preserved, but it is not clear whether this description refers just to the general definition of where the macro definition ends or it indeed defines whether the white space should be preserved or not. Consider a slightly different example, with a one-line comment following the macro text: `define kuku_with_comment 2 // comment a = `kuku_with_comment; According to the LRM, the comment should be removed, but nothing is said on whether the white space preceding the comment should be removed or not. There are situations when the presence or absence of the white space at the end of the substituted text may be important. Consider the following, more complex, example: `define kuku 1 `define kuku_with_comment 2 // comment `define mod(arg1,arg2) \ (* foo = "AA``arg1BB``arg2" *) \ module a(); \ endmodule `mod(`kuku,`kuku_with_comment) Should the final value of the attribute be "AA1BB2" or "AA1 BB2 "? From the design perspective, it is advantageous that the language requires the removal of the trailing spaces in both cases, to allow building strings/names as in the example above. Note that it is especially important to remove the trailing spaces in the case with the comment, since, if the spaces are not removed, it makes it impossible to define a macro with a comment that doesn't have a white space at the end of its substituted text. --Yulik.Received on Mon, 13 Feb 2006 17:18:12 +0200
This archive was generated by hypermail 2.1.8 : Mon Feb 13 2006 - 07:19:13 PST