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 a compile error by using clang-x86_64-pc-windows-msvc #1890

Conversation

kkitayam
Copy link
Contributor

Fix compile errors when using clang-x86_64-pc-windows-msvc

Please see also raspberrypi/picotool#129

  • Environment
$ clang --version
clang version 18.1.8
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
Error messages
  • An error message
C:/hoge/pico-sdk/src/host/pico_platform/include\pico/platform.h:99:24: error: definition of builtin function '__builtin_unreachable'
   99 | static __noreturn void __builtin_unreachable() {
      |                        ^
1 error generated.

@@ -47,7 +47,7 @@ extern void tight_loop_contents();
#define __STRING(x) #x
#endif

#ifndef _MSC_VER
#if !defined(_MSC_VER) || defined(__clang__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean if !defined(_MSC_VER) && !defined(__clang__)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's not. The changes were intended to disable LL.74-103 when using clang-x86_64-pc-windows-msvc.

clang-x86_64-pc-windows-msvc has built-in functions like gcc syntax. Specifically there are __builtin_unreachable and __builtin_clz. Also, clang-x86_64-pc-windows-msvc has a macro _MSC_VER already defined. So, LL.74-103 were enabled. As a result, the compilation fails.

@kilograham kilograham merged commit 3a79149 into raspberrypi:develop Sep 5, 2024
1 check passed
@kkitayam kkitayam deleted the fix_for_clang-x86_64-pc-windows-msvc branch September 5, 2024 21:01
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.

3 participants