mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Avoid compiler warning about mismatched printf types
Under Unix with SEXP_64_BIT defined, sexp_sint_t is defined as 'long'. But we would get the equivalent format specifier SEXP_PRIdFIXNUM from the OS-defined PRId64 in <inttypes.h>. MacOS defines it as "lld". This causes the clang printf checker to emit a warning about the 'long' and 'long long' mismatch. Fix by avoiding system-defined PRId32 and PRId64 format specifiers and always defining SEXP_PRIdFIXNUM as "d", "ld" or "lld" according to our definition of sexp_sint_t as int, long or long long. This also means we don't need to include <inttypes.h> any more.
This commit is contained in:
parent
105a4672e7
commit
2dc4353604
1 changed files with 5 additions and 11 deletions
|
@ -215,10 +215,12 @@ enum sexp_types {
|
|||
typedef unsigned int sexp_tag_t;
|
||||
typedef unsigned long long sexp_uint_t;
|
||||
typedef long long sexp_sint_t;
|
||||
#define SEXP_PRIdFIXNUM "lld"
|
||||
#else
|
||||
typedef unsigned short sexp_tag_t;
|
||||
typedef unsigned int sexp_uint_t;
|
||||
typedef int sexp_sint_t;
|
||||
#define SEXP_PRIdFIXNUM "d"
|
||||
#endif
|
||||
#define sexp_heap_align(n) sexp_align(n, 5)
|
||||
#define sexp_heap_chunks(n) (sexp_heap_align(n)>>5)
|
||||
|
@ -226,18 +228,21 @@ typedef int sexp_sint_t;
|
|||
typedef unsigned int sexp_tag_t;
|
||||
typedef unsigned long sexp_uint_t;
|
||||
typedef long sexp_sint_t;
|
||||
#define SEXP_PRIdFIXNUM "ld"
|
||||
#define sexp_heap_align(n) sexp_align(n, 5)
|
||||
#define sexp_heap_chunks(n) (sexp_heap_align(n)>>5)
|
||||
#elif defined(__CYGWIN__)
|
||||
typedef unsigned short sexp_tag_t;
|
||||
typedef unsigned int sexp_uint_t;
|
||||
typedef int sexp_sint_t;
|
||||
#define SEXP_PRIdFIXNUM "d"
|
||||
#define sexp_heap_align(n) sexp_align(n, 5)
|
||||
#define sexp_heap_chunks(n) (sexp_heap_align(n)>>5)
|
||||
#else
|
||||
typedef unsigned short sexp_tag_t;
|
||||
typedef unsigned int sexp_uint_t;
|
||||
typedef int sexp_sint_t;
|
||||
#define SEXP_PRIdFIXNUM "d"
|
||||
#define sexp_heap_align(n) sexp_align(n, 4)
|
||||
#define sexp_heap_chunks(n) (sexp_heap_align(n)>>4)
|
||||
#endif
|
||||
|
@ -290,17 +295,6 @@ typedef short sexp_int32_t;
|
|||
#define SEXP_PRIdOFF "ld"
|
||||
#endif
|
||||
|
||||
#if SEXP_USE_INTTYPES
|
||||
#include <inttypes.h>
|
||||
#if SEXP_64_BIT
|
||||
#define SEXP_PRIdFIXNUM PRId64
|
||||
#else
|
||||
#define SEXP_PRIdFIXNUM PRId32
|
||||
#endif
|
||||
#else
|
||||
#define SEXP_PRIdFIXNUM "ld"
|
||||
#endif
|
||||
|
||||
#if SEXP_USE_LONG_PROCEDURE_ARGS
|
||||
typedef int sexp_proc_num_args_t;
|
||||
#else
|
||||
|
|
Loading…
Add table
Reference in a new issue