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

PRIxPTR format string causes "format specifies type 'unsigned int' but the argument has type 'uintptr_t' (aka 'unsigned long')" warning #13

Closed
zhuowei opened this issue Apr 13, 2019 · 2 comments · Fixed by #16

Comments

@zhuowei
Copy link

zhuowei commented Apr 13, 2019

The PRIxPTR macro, used to print uintptr_t values, seems to be incorrectly defined in wasi-sdk 3.0's headers.
To reproduce: compile this C file with wasi-sdk.

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

void printsomething() {
	uintptr_t a = 0x1234;
	printf("%" PRIxPTR "\n", a);
}

Expected: no warning occurs.
Actual:

$ bin/clang --sysroot `pwd`/share/sysroot -c test.c
test.c:7:27: warning: format specifies type 'unsigned int' but the argument has type 'uintptr_t' (aka 'unsigned long') [-Wformat]
        printf("%" PRIxPTR "\n", a);
                ~~~~~~~~~~       ^
1 warning generated.
sunfishcode added a commit that referenced this issue Apr 15, 2019
Musl's generic definitions for PRIxPTR and several others in
<inttypes.h> are incorrect for wasm, so introduce a new <inttypes.h>
and <__header_inttypes.h> in the basics module using compiler-provided
definitions.

Fixes #13.
@sunfishcode
Copy link
Member

Thanks for the report! I've now submitted #16 to fix this.

@zhuowei
Copy link
Author

zhuowei commented Apr 15, 2019

@sunfishcode Thanks!

sunfishcode added a commit that referenced this issue Apr 15, 2019
Musl's generic definitions for PRIxPTR and several others in
<inttypes.h> are incorrect for wasm, so introduce a new <inttypes.h>
and <__header_inttypes.h> in the basics module using compiler-provided
definitions.

Fixes #13.
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 a pull request may close this issue.

2 participants