Skip to content
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

#224 #231 Macro VariadicArgument operator improves with stringification. #264

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TIMONz1535
Copy link

@TIMONz1535 TIMONz1535 commented Apr 19, 2024

Based on @Jasonchan35 pull request.

  • Checking token.ContextualKind instead of token.Kind.
  • Insert commas between variadic arguments into the parsing result list.
  • Don't report missing localize string NoVariadicArgumentParameter (causes a crash lol). Instead let the parser make the decision.
  • So macro parameter name __VA_ARGS__ consider to be valid. It doesn't actually have to be an ellipsis ....
  • Add stringification operation for variadic operator #__VA_ARGS__.
  • Huge variadic operator test with stringification and keyword as parameter. Correlates with the latest DXC release.
  • Tiny test for stringify with skipped parameters because I wanted to make sure.
#define CTR(...) = {__VA_ARGS__}
#define CTR3(x, ...) = float3(x, __VA_ARGS__)
float x CTR(0.0f);
float3 y CTR(1.0f, 2.0f, 3.0f);
float3 z CTR3(4.0f, 5.0f, 6.0f);
#define CTR_WTF(__VA_ARGS__) = float(__VA_ARGS__)
float3 w CTR_WTF(0.0f);
#define STRING(x, ...) #__VA_ARGS__
string Bar = STRING(7, Pass, 8);

produces

float x = {0.0f};
float3 y = {1.0f, 2.0f, 3.0f};
float3 z = float3(4.0f, 5.0f, 6.0f);

float3 w = float(0.0f);

string Bar = "Pass, 8";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants