mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 18:50:29 +00:00
libretro-common: improve PRI_SIZET for non-windows platforms
In non-windows platfoms, the `size_t` type may not necessarily use the `%lu` format specification. For example in 32 bits platforms instead it needs to be `%u`. Therefore, for non-windows platforms, it is better to define PRI_SIZET more precisely. Silences these types of warnings in 32 bits non-windows platforms: libretro-common/file/config_file.c: In function ‘config_get_size_t’: libretro-common/file/config_file.c:694:32: warning: format ‘%lu’ expects argument of type ‘long unsigned int *’, but argument 3 has type ‘size_t * {aka unsigned int *}’ [-Wformat=] if (sscanf(entry->value, "%" PRI_SIZET, &val) == 1) ^~~ Discussed in #8191
This commit is contained in:
parent
4ce93b11ee
commit
e2b620ae05
@ -159,14 +159,22 @@ typedef struct
|
|||||||
# ifdef _WIN64
|
# ifdef _WIN64
|
||||||
# define PRI_SIZET PRIu64
|
# define PRI_SIZET PRIu64
|
||||||
# else
|
# else
|
||||||
#if _MSC_VER == 1800
|
# if _MSC_VER == 1800
|
||||||
# define PRI_SIZET PRIu32
|
# define PRI_SIZET PRIu32
|
||||||
#else
|
# else
|
||||||
# define PRI_SIZET "u"
|
# define PRI_SIZET "u"
|
||||||
#endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define PRI_SIZET "lu"
|
# if (SIZE_MAX == 0xFFFF)
|
||||||
|
# define PRI_SIZET "hu"
|
||||||
|
# elif (SIZE_MAX == 0xFFFFFFFF)
|
||||||
|
# define PRI_SIZET "u"
|
||||||
|
# elif (SIZE_MAX == 0xFFFFFFFFFFFFFFFF)
|
||||||
|
# define PRI_SIZET "lu"
|
||||||
|
# else
|
||||||
|
# error PRI_SIZET: unknown SIZE_MAX
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user