poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] Fix some warnings


From: Guillermo E. Martinez
Subject: [PATCH 2/2] Fix some warnings
Date: Mon, 22 Feb 2021 17:46:01 -0600

2021-02-22  Guillermo E. Martinez  <guillermo.e.martinez@oracle.com>

        * libpoke/pkl-asm.c: unused function parameter.
        * libpoke/pkl-ast.c: ushadown automatic/global variables (-Wshadow),
          perfomance improvement replacing fprintf by fputc.
        * libpoke/pkl-diag.c: comparison between signed/unsigned types.
        * libpoke/pkl.c: Likewise.
        * libpoke/pvm.jitter: unsigned variable compared with negative
          values
---
 libpoke/pkl-asm.c  |  2 +-
 libpoke/pkl-ast.c  | 14 +++++++-------
 libpoke/pkl-diag.c |  2 +-
 libpoke/pkl.c      |  6 +++---
 libpoke/pvm.jitter |  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/libpoke/pkl-asm.c b/libpoke/pkl-asm.c
index 8b6fc5cf..4328781e 100644
--- a/libpoke/pkl-asm.c
+++ b/libpoke/pkl-asm.c
@@ -743,7 +743,7 @@ pkl_asm_insn_binop (pkl_asm pasm,
 
 static void
 pkl_asm_insn_cdiv (pkl_asm pasm,
-                   enum pkl_asm_insn insn,
+                   enum pkl_asm_insn __attribute__ ((unused)) insn,
                    pkl_ast_node type)
 {
   pvm_val one = pvm_make_integral (1,
diff --git a/libpoke/pkl-ast.c b/libpoke/pkl-ast.c
index eb7f4ee6..9457cf05 100644
--- a/libpoke/pkl-ast.c
+++ b/libpoke/pkl-ast.c
@@ -1508,7 +1508,7 @@ pkl_ast_node
 pkl_ast_make_map (pkl_ast ast,
                   int strict_p,
                   pkl_ast_node type,
-                  pkl_ast_node ios,
+                  pkl_ast_node lios,
                   pkl_ast_node offset)
 {
   pkl_ast_node map = pkl_ast_make_node (ast, PKL_AST_MAP);
@@ -1517,7 +1517,7 @@ pkl_ast_make_map (pkl_ast ast,
 
   PKL_AST_MAP_STRICT_P (map) = strict_p;
   PKL_AST_MAP_TYPE (map) = ASTREF (type);
-  PKL_AST_MAP_IOS (map) = ASTREF (ios);
+  PKL_AST_MAP_IOS (map) = ASTREF (lios);
   PKL_AST_MAP_OFFSET (map) = ASTREF (offset);
 
   return map;
@@ -2611,12 +2611,12 @@ pkl_ast_lvalue_p (pkl_ast_node node)
 #define IPRINTF(...)                            \
   do                                            \
     {                                           \
-      int i;                                    \
-      for (i = 0; i < indent; i++)              \
-        if (indent >= 2 && i % 2 == 0)          \
-          fprintf (fp, "|");                    \
+      int ii;                                   \
+      for (ii = 0; ii < indent; ii++)           \
+        if (indent >= 2 && ii % 2 == 0)         \
+          fputc ('|', fp);                      \
         else                                    \
-          fprintf (fp, " ");                    \
+          fputc (' ', fp);                      \
       fprintf (fp, __VA_ARGS__);                \
     } while (0)
 
diff --git a/libpoke/pkl-diag.c b/libpoke/pkl-diag.c
index 1630cd10..1ad8014c 100644
--- a/libpoke/pkl-diag.c
+++ b/libpoke/pkl-diag.c
@@ -47,7 +47,7 @@ static void
 pkl_detailed_location (pkl_ast ast, pkl_ast_loc loc,
                        const char *style_class)
 {
-  size_t cur_line = 1;
+  int cur_line = 1;
   size_t cur_column = 1;
   int i;
 
diff --git a/libpoke/pkl.c b/libpoke/pkl.c
index 22d6457b..41f2b030 100644
--- a/libpoke/pkl.c
+++ b/libpoke/pkl.c
@@ -153,7 +153,7 @@ out_of_memory:
 void
 pkl_free (pkl_compiler compiler)
 {
-  size_t i;
+  int i;
 
   pkl_env_free (compiler->env);
   for (i = 0; i < compiler->num_modules; ++i)
@@ -588,8 +588,8 @@ pkl_set_alien_token_fn (pkl_compiler compiler,
 }
 
 pvm_program
-pkl_compile_call (pkl_compiler compiler, pvm_val cls, pvm_val *ret,
-                  va_list ap)
+pkl_compile_call (pkl_compiler compiler, pvm_val cls,
+                  pvm_val __attribute__((unused)) *ret, va_list ap)
 {
   pvm_program program;
   pkl_asm pasm;
diff --git a/libpoke/pvm.jitter b/libpoke/pvm.jitter
index 58fe030f..fc411602 100644
--- a/libpoke/pvm.jitter
+++ b/libpoke/pvm.jitter
@@ -3938,7 +3938,7 @@ instruction strref () # ( STR ULONG -- STR ULONG VAL )
      pvm_val string = JITTER_UNDER_TOP_STACK ();
      pvm_val index = JITTER_TOP_STACK ();
 
-    if (PVM_VAL_ULONG (index) < 0
+    if (((int64_t) PVM_VAL_ULONG (index)) < 0
         || (PVM_VAL_ULONG (index) >=
             strlen (PVM_VAL_STR (string))))
       PVM_RAISE_DFL (PVM_E_OUT_OF_BOUNDS);
-- 
2.30.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]