Skip to content

Verilog: allow whitespace between macro and arguments #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

kroening
Copy link
Member

Verilog allows whitespace between the macro identifier and the parentheses.

@kroening kroening marked this pull request as ready for review April 21, 2024 00:44
Verilog allows whitespace between the macro identifier and the parentheses
when using a macro with parameters.

Verilog disallows whitespace between the macro identifier and the
parentheses when defining a macro with parameters.  When whitespace is
present, the macro is interpreted as a macro without parameters.
@kroening kroening force-pushed the verilog-define-ws branch from c5190af to 9daf51d Compare April 22, 2024 00:08
// Is there a parameter list?
// These have been introduced in Verilog 2001.
// 1800-2017: "The left parenthesis shall follow the text macro name
// immediately, with no space in between."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: does this mean that tools don't actually observe this? I'm a bit confused as the PR suggests the opposite of what the standard says is now being supported.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message gives more detail. There are two separate cases, and both were broken, and are fixed here simultaneously.

  1. When using a macro with parameters, Verilog does allow whitespace between the macro identifier and the parentheses. The implementation did not allow this before this PR.

  2. When defining a macro with parameters, Verilog disallows whitespace between the macro identifier and the
    parentheses. The implementation did allow this, which resulted in wrongly interpreted macro definitions.

@kroening kroening merged commit 2a129e6 into main Apr 22, 2024
@kroening kroening deleted the verilog-define-ws branch April 22, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants