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

fix webgpu delay load test #23157

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

fix webgpu delay load test #23157

wants to merge 2 commits into from

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Dec 19, 2024

Description

This change fixes the WebGPU delay load test.

The following C++ code outputs 2, 1 in MSVC, while it outputs 1, 1 in GCC:

#include <iostream>

#define A 1
#define B 1

#define ENABLE defined(A) && defined(B)

#if ENABLE
int x = 1;
#else
int x = 2;
#endif

#if defined(A) && defined(B)
int y = 1;
#else
int y = 2;
#endif

int main()
{
    std::cout << x << ", " << y << "\n";
}

Clang reports macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined].

Fix this by avoiding the UB.

@fs-eire fs-eire force-pushed the fs-eire/fix-delay-load-test branch from 69056fe to e512048 Compare December 20, 2024 04:51
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.

1 participant