Re: [PATCH 1/2] drm/exec: use unique instead of local label

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/08/2023 22.35, Nick Desaulniers wrote:

> I suspect it's possible to change the indirect goto into a direct goto
> with some further refactoring (macros can take block statements; 

Well, with some somewhat subtle restrictions. C99, 6.10.3.11. "The
sequence of preprocessing tokens bounded by the outside-most matching
parentheses forms the list of arguments for the function-like macro. The
individual arguments within the list are separated by comma
preprocessing tokens, but comma preprocessing tokens between matching
inner parentheses do not separate arguments."

cpp doesn't care about the {} tokens when trying to figure out what
constitutes the "block" argument, so if that block contained any comma
outside a () pair, cpp would barf something like

  error: macro "foo" passed 3 arguments, but takes just 2

So while the commas inside function calls (and other macro invocations)
are fine, constructs like

  int x, y;

or

  struct s s = {.a = 3, .b = 4}

would be verboten inside that block.

One way around that is to make block a variadic argument so it just
gobbles up all preprocessor token. Or have the users pass a statement
expression instead of a block.

Rasmus




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux