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

Remove printf() format warning on Windows oneAPI. #3838

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/accum.c
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,7 @@ test_swmr_write_big(bool newest_format)
ZeroMemory(&pi, sizeof(pi));

if (0 == CreateProcess(NULL, SWMR_READER, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) {
printf("CreateProcess failed (%d).\n", GetLastError());
printf("CreateProcess failed (%lu).\n", GetLastError());
Copy link
Member

@derobins derobins Nov 7, 2023

Choose a reason for hiding this comment

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

This should be PRIu32 so it's always true since GetLastError() returns a DWORD.

https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried but it doesn't work:

cmake --build . --config Debug
[1/2] Building C object test\CMakeFiles\accum.dir\accum.c.obj
C:\Users\JoeLee\source\repos\hdf5\test\accum.c(2197,61): warning: format specifies type 'unsigned int' but the argument has type 'DWORD' (aka 'unsigned long') [-Wformat]
            printf("CreateProcess failed (%" PRIu32 ").\n", GetLastError());
                                          ~~~~~~~~~         ^~~~~~~~~~~~~~
1 warning generated.
[2/2] Linking C executable bin\accum.exe

Copy link
Member

Choose a reason for hiding this comment

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

Oh, Microsoft...

FAIL_STACK_ERROR;
}

Expand Down