Commit 782dbebf by Nicolas Capens Committed by Nicolas Capens

Prevent 'most vexing parse' issue

A statement like "If(Bool(b)) {}" would lead to interpreting part of its maco expansion "IfElseData ifElse__(Bool(b));" as a function declaration. See https://en.wikipedia.org/wiki/Most_vexing_parse Fix it by using C++11 universal initialization syntax. Bug: b/155148722 Change-Id: I64d0a28f64a4735a61776a44dfb7560d2854cde3 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/49808 Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent b0e426fc
......@@ -3503,8 +3503,8 @@ enum
IFELSE_NUM__
};
#define If(cond) \
for(IfElseData ifElse__(cond); ifElse__ < IFELSE_NUM__; ++ifElse__) \
#define If(cond) \
for(IfElseData ifElse__{ cond }; ifElse__ < IFELSE_NUM__; ++ifElse__) \
if(ifElse__ == IF_BLOCK__)
#define Else \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment