From 30810905de7662b36b7ac9275bb9cbb2a563c277 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 3 Mar 2021 20:15:58 +0200 Subject: [PATCH] Fix compilation warnings in --with-wide-int build on Windows * src/comp.c (emit_rvalue_from_emacs_uint) (emit_rvalue_from_lisp_word_tag): Fix comparison of unsigned values. (gcc_jit_context_new_rvalue_from_ptr): Define only if LISP_WORDS_ARE_POINTERS, to avoid compilation warning. (init_gccjit_functions): Load gcc_jit_context_new_rvalue_from_ptr only if LISP_WORDS_ARE_POINTERS. --- src/comp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/comp.c b/src/comp.c index 21d1c1a23cf..d74f8328fda 100644 --- a/src/comp.c +++ b/src/comp.c @@ -179,8 +179,10 @@ DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_comparison, enum gcc_jit_comparison op, gcc_jit_rvalue *a, gcc_jit_rvalue *b)); DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_rvalue_from_long, (gcc_jit_context *ctxt, gcc_jit_type *numeric_type, long value)); +#if LISP_WORDS_ARE_POINTERS DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_rvalue_from_ptr, (gcc_jit_context *ctxt, gcc_jit_type *pointer_type, void *value)); +#endif DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_string_literal, (gcc_jit_context *ctxt, const char *value)); DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_new_unary_op, @@ -290,7 +292,9 @@ init_gccjit_functions (void) LOAD_DLL_FN (library, gcc_jit_context_new_param); LOAD_DLL_FN (library, gcc_jit_context_new_rvalue_from_int); LOAD_DLL_FN (library, gcc_jit_context_new_rvalue_from_long); +#if LISP_WORDS_ARE_POINTERS LOAD_DLL_FN (library, gcc_jit_context_new_rvalue_from_ptr); +#endif LOAD_DLL_FN (library, gcc_jit_context_new_string_literal); LOAD_DLL_FN (library, gcc_jit_context_new_struct_type); LOAD_DLL_FN (library, gcc_jit_context_new_unary_op); @@ -357,7 +361,9 @@ init_gccjit_functions (void) #define gcc_jit_context_new_param fn_gcc_jit_context_new_param #define gcc_jit_context_new_rvalue_from_int fn_gcc_jit_context_new_rvalue_from_int #define gcc_jit_context_new_rvalue_from_long fn_gcc_jit_context_new_rvalue_from_long -#define gcc_jit_context_new_rvalue_from_ptr fn_gcc_jit_context_new_rvalue_from_ptr +#if LISP_WORDS_ARE_POINTERS +# define gcc_jit_context_new_rvalue_from_ptr fn_gcc_jit_context_new_rvalue_from_ptr +#endif #define gcc_jit_context_new_string_literal fn_gcc_jit_context_new_string_literal #define gcc_jit_context_new_struct_type fn_gcc_jit_context_new_struct_type #define gcc_jit_context_new_unary_op fn_gcc_jit_context_new_unary_op @@ -1137,7 +1143,7 @@ static gcc_jit_rvalue * emit_rvalue_from_emacs_uint (EMACS_UINT val) { #ifdef WIDE_EMACS_INT - if (val > LONG_MAX || val < LONG_MIN) + if (val > ULONG_MAX) return emit_rvalue_from_long_long (comp.emacs_uint_type, val); #endif return gcc_jit_context_new_rvalue_from_long (comp.ctxt, @@ -1159,7 +1165,7 @@ static gcc_jit_rvalue * emit_rvalue_from_lisp_word_tag (Lisp_Word_tag val) { #ifdef WIDE_EMACS_INT - if (val > LONG_MAX || val < LONG_MIN) + if (val > ULONG_MAX) return emit_rvalue_from_long_long (comp.lisp_word_tag_type, val); #endif return gcc_jit_context_new_rvalue_from_long (comp.ctxt, -- 2.39.2