mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-16 19:11:13 +00:00
printf format specifiers are invalid for MinGW which causes misleading warnings #3592
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#3592
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version/Branch of Dear ImGui:
acb8ef2006(1.80 WIP (17905))Back-end/Renderer/Compiler/OS
Back-ends: https://github.com/mosra/magnum-integration/tree/master/src/Magnum/ImGuiIntegration
Compiler: MinGW GCC 10.2.1
Operating System: Windows
My Issue/Question:
Dear ImGui creates misleading warnings that do not match compiler's behavior. ImGui is using incorrect format specifiers. The current ImGui macro (
#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))) does not match MinGW's implementation.Standalone, minimal, complete and verifiable example: (see https://github.com/ocornut/imgui/issues/2261)
The code above (compiled with
-Wall -Wextra -Wpedantic -std=c++17) generates following warnings:The macro (whether commented or not) in the first line has no impact on warnings (at least in MinGW distribution I use). Warnings appear only for
printfandms_printfformat specifiers but MinGW's actual implementation is:Thus, if I call printf-style functions from Dear ImGui in my project, I'm getting warnings that
%zuis not supported while it actually is. I never get warnings for standardprintffunctions and they are used in ImGui's implementation. So in short, ImGui's functions are just incorrectly labeled.Hello,
Thanks for your report.
I am not sure I fully understand.
Do you suggest that if we changed the
IM_FMTARGS/IM_FMTLISTto use gnu_printf when__GNUC__is defined it would fix the issue for you?Done some tests on my side and pushed a fix for it :
7a135a763cThank you!
I would not use just
__GNUC__- it is a MinGW-specific issue, not for all GCCs. More like#if defined(__GNUG__) && defined(__MINGW32__).Note:
__MINGW32__is also present in 64-bit builds.@ocornut are you sure that the linked commit is the right solution? IMO if there were no problems with
__attribute__((format(printf, FMT, FMT+1)));it should only be changed tognu_printfunder MinGW toolchain, not any GCC.Tested with
https://github.com/ocornut/imgui/runs/1397751653?check_suite_focus=true
And removed with:
https://github.com/ocornut/imgui/runs/1397757816?check_suite_focus=true
Amended, you are right. Thank you!