Skip to content

Commit

Permalink
fix MinGW format attribute
Browse files Browse the repository at this point in the history
Setting -D__USE_MINGW_ANSI_STDIO=1 is wrong and should not be used. MinGW
internally uses a macro to select between gnu_printf and printf. Just use
that instead of using a wrong format under clang backends.

Signed-off-by: Rosen Penev <[email protected]>
Signed-off-by: David Gibson <[email protected]>
  • Loading branch information
neheb authored and dgibson committed Mar 6, 2024
1 parent 24f6001 commit 5e6cefa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 0 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ add_project_arguments(
language: 'c'
)

if host_machine.system() == 'windows'
add_project_arguments(
'-D__USE_MINGW_ANSI_STDIO=1',
language: 'c'
)
endif

add_project_arguments(
'-DFDT_ASSUME_MASK=' + get_option('assume-mask').to_string(),
language: 'c'
Expand Down
4 changes: 3 additions & 1 deletion util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
*/

#ifdef __GNUC__
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#ifdef __MINGW_PRINTF_FORMAT
#define PRINTF(i, j) __attribute__((format (__MINGW_PRINTF_FORMAT, i, j)))
#elif __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#define PRINTF(i, j) __attribute__((format (gnu_printf, i, j)))
#else
#define PRINTF(i, j) __attribute__((format (printf, i, j)))
Expand Down

0 comments on commit 5e6cefa

Please sign in to comment.