IM_FMTARGS attributes not enabled for GCC on Linux #4183

Closed
opened 2021-05-30 19:17:55 +00:00 by audetto · 1 comment
audetto commented 2021-05-30 19:17:55 +00:00 (Migrated from github.com)

I am using the (as of now) latest version of ImGui,

ocornut/imgui@79e18896fe/imgui.h (L95)

Format warning are not enabled for GCC on Linux.

I was reading https://github.com/ocornut/imgui/issues/3592 and I believe excluding gcc was an unintentional side effect?

I am using the (as of now) latest version of ImGui, https://github.com/ocornut/imgui/blob/79e18896fee8c28f6dae0750b1e808c1b27d7807/imgui.h#L95 Format warning are **not** enabled for GCC on Linux. I was reading https://github.com/ocornut/imgui/issues/3592 and I believe excluding gcc was an unintentional side effect?
ocornut commented 2021-05-31 11:06:47 +00:00 (Migrated from github.com)

Hello Andrea,
You are right. I've reworked the #ifdef block now. Thank you!
It becames

#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__)
#define IM_FMTARGS(FMT)             __attribute__((format(gnu_printf, FMT, FMT+1)))
#define IM_FMTLIST(FMT)             __attribute__((format(gnu_printf, FMT, 0)))
#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))
#define IM_FMTARGS(FMT)             __attribute__((format(printf, FMT, FMT+1)))
#define IM_FMTLIST(FMT)             __attribute__((format(printf, FMT, 0)))
#else
#define IM_FMTARGS(FMT)
#define IM_FMTLIST(FMT)
#endif

(Based on the test and discussions in #3592 that gnu_printf is only required on MinGW32)

Hello Andrea, You are right. I've reworked the #ifdef block now. Thank you! It becames ``` #if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) #define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1))) #define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0))) #elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__)) #define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) #define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0))) #else #define IM_FMTARGS(FMT) #define IM_FMTLIST(FMT) #endif ``` (Based on the test and discussions in #3592 that gnu_printf is only required on MinGW32)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#4183
No description provided.