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

macos not build (error: incompatible pointer types passing '_Atomic(double) *' to parameter of type 'double) #50

Open
fengve opened this issue Jan 20, 2021 · 2 comments

Comments

@fengve
Copy link

fengve commented Jan 20, 2021

/Users/fengwei/prometheus-client-c/prom/src/prom_metric_sample.c:69:54: error: incompatible pointer types passing
'_Atomic(double) *' to parameter of type 'double *' [-Werror,-Wincompatible-pointer-types]
if (atomic_compare_exchange_weak(&self->r_value, &old, new)) {
^~~~
/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/include/stdatomic.h:143:108: note: expanded from macro
'atomic_compare_exchange_weak'
#define atomic_compare_exchange_weak(object, expected, desired) __c11_atomic_compare_exchange_weak(object, expected, des...
^~~~~~~~
/Users/fengwei/prometheus-client-c/prom/src/prom_metric_sample.c:84:54: error: incompatible pointer types passing
'_Atomic(double) *' to parameter of type 'double *' [-Werror,-Wincompatible-pointer-types]
if (atomic_compare_exchange_weak(&self->r_value, &old, new)) {
^~~~
/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/include/stdatomic.h:143:108: note: expanded from macro
'atomic_compare_exchange_weak'
#define atomic_compare_exchange_weak(object, expected, desired) __c11_atomic_compare_exchange_weak(object, expected, des...

--------------------clang version--------------------------------
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

---------------os--------------
Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64

@czheji
Copy link

czheji commented Sep 8, 2021

atomic_load should return a bare type, which should be corrected to:
double old = atomic_load(&self->r_value);

@eakraly
Copy link

eakraly commented Oct 5, 2022

Fix in #71

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

No branches or pull requests

3 participants