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 printf format warnings on mingw clang #4626

Closed
wants to merge 1 commit into from

Conversation

guusw
Copy link
Contributor

@guusw guusw commented Oct 4, 2021

Hey,
When compiling with mingw bundled clang, it will complain that the gnu_printf format argument is not supported.
using the other macro with printf however works fine.

./imgui.h:608:118: warning: 'format' attribute argument not supported: gnu_printf [-Wignored-attributes]
    IMGUI_API bool          TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);
                                                                                                                     ^
./imgui.h:98:52: note: expanded from macro 'IM_FMTLIST'
#define IM_FMTLIST(FMT)             __attribute__((format(gnu_printf, FMT, 0)))
                                                   ^

I changed the conditions so it will use format(printf, ...) on mingw clang, but still use format(gnu_printf,...) for mingw gcc

Tested with mingw clang/gcc and also native windows clang. All report no errors with this fix.

>g++ --version
g++.exe (Rev5, Built by MSYS2 project) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>clang++ --version
clang version 12.0.1
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin
>/a/LLVM/bin/clang++ --version              
clang version 12.0.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: A:\LLVM\bin

@guusw guusw changed the title fix printf macro Fix printf format warnings on mingw clang Oct 4, 2021
@ocornut
Copy link
Owner

ocornut commented Oct 6, 2021

Merged, thank you!

@ocornut ocornut closed this Oct 6, 2021
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.

None yet

2 participants