-
Notifications
You must be signed in to change notification settings - Fork 106
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
Error parsing statement expressions #46
Comments
Can you try to reduce this down to make it easier to identify the problem? |
The first line of the function itself fails. Reducing it even further: align = ({ typeof((int)align) var__a = ((int)align);});
|
That doesn’t look like standard C. What is that syntax called? |
I found this in the sx library: align = sx_max((int)align, SX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT);
// https://github.com/septag/sx/blob/master/include/sx/allocator.h#L136 gets expanded to the following after preprocessing (gcc -E): align = ({ typeof((int)align) var__a = ((int)align); typeof(8) var__b = (8); (void)(&var__a == &var__b); var__a > 8 ? var__a : var__b; }); This is because they define sx_max() as follows: #ifndef __cplusplus
# if SX_COMPILER_GCC || SX_COMPILER_CLANG
# define sx_max(a, b) \
({ \
typeof(a) var__a = (a); \
typeof(b) var__b = (b); \
(void)(&var__a == &var__b); \
var__a > b ? var__a : var__b; \
})
// https://github.com/septag/sx/blob/master/include/sx/sx.h#L78 Looks like a block syntax using {}, gcc doesn't mind. |
This example uses a couple of GCC extensions: |
Source:
Results in error:
First line of function itself fails by itself.
The text was updated successfully, but these errors were encountered: