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

msvc: use /experimental:c11atomics when finding stdatomic #14233

Open
mochaaP opened this issue Feb 10, 2025 · 1 comment
Open

msvc: use /experimental:c11atomics when finding stdatomic #14233

mochaaP opened this issue Feb 10, 2025 · 1 comment

Comments

@mochaaP
Copy link

mochaaP commented Feb 10, 2025

Describe the bug
c11 atomics is behind a flag in msvc:
https://devblogs.microsoft.com/cppblog/c11-atomics-in-visual-studio-2022-version-17-5-preview-2/

To Reproduce

project('msvc-stdatomic', 'c', default_options: ['c_std=c11'])

cc = meson.get_compiler('c')
atomic_dep = dependency('atomic', required: false)
# atomic_flag_clear forwards to __c11_atomic_store in msvc,
# which behaves like __builtin_* in gcc, and we're unable to detect it with .has_function().
atomic_without_flag = cc.has_function('_Atomic_thread_fence', prefix: '#include <stdatomic.h>')
atomic_with_flag = cc.has_function(
  '_Atomic_thread_fence',
  args: '/experimental:c11atomics',
  prefix: '#include <stdatomic.h>',
)

summary(
  {
    'atomic_dep': atomic_dep.found(),
    'atomic_without_flag': atomic_without_flag,
    'atomic_with_flag': atomic_with_flag,
  },
)

Expected behavior
atomic_dep.found() == true

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    happens on both native vs2022 and wine-msvc.
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    Windows 10 (19045.4780)
  • what Python version are you using e.g. 3.8.0
    Python 3.13.2
  • what meson --version
    1.7.0-rc2 (master)
  • what ninja --version if it's a Ninja build
    1.12.1
@mochaaP
Copy link
Author

mochaaP commented Feb 10, 2025

the related headers from msvc 14.42.34433, if you need them:

stdatomic.h
vcruntime_c11_stdatomic.h
vcruntime_c11_atomic_support.h

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

No branches or pull requests

2 participants