[Groonga-commit] groonga/groonga at 4635438 [master] clang: suppress warnings

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jun 11 13:58:35 JST 2013


Kouhei Sutou	2013-06-11 13:58:35 +0900 (Tue, 11 Jun 2013)

  New Revision: 46354384a3e45d7479eb0cd2171874b5ff15a218
  https://github.com/groonga/groonga/commit/46354384a3e45d7479eb0cd2171874b5ff15a218

  Message:
    clang: suppress warnings
    
    Use uint32_t for object type. It should be uint8_t but GRN_B_DEC()
    requires uint32_t for result space. So I use uint32_t instead of
    uint8_t.
    
        lib/expr.c:440:18: warning: comparison of
              constant 32 with expression of type 'grn_expr_pack_type' is always false
              [-Wtautological-constant-out-of-range-compare]
            if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) { /* error */ }
                ~~~~~~~~ ^  ~~~~
        lib/expr.c:440:34: warning: comparison of
              constant 72 with expression of type 'grn_expr_pack_type' is always true
              [-Wtautological-constant-out-of-range-compare]
            if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) { /* error */ }
                                    ~~~~ ^  ~~~~~~~~~~~~~~~~
        lib/expr.c:467:20: warning: comparison of
              constant 32 with expression of type 'grn_expr_pack_type' is always false
              [-Wtautological-constant-out-of-range-compare]
              if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) {
                  ~~~~~~~~ ^  ~~~~
        lib/expr.c:467:36: warning: comparison of
              constant 72 with expression of type 'grn_expr_pack_type' is always true
              [-Wtautological-constant-out-of-range-compare]
              if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) {
                                      ~~~~ ^  ~~~~~~~~~~~~~~~~

  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+10 -6)
===================================================================
--- lib/expr.c    2013-06-11 13:42:10 +0900 (17f8aae)
+++ lib/expr.c    2013-06-11 13:58:35 +0900 (91971cf)
@@ -433,12 +433,13 @@ grn_expr_unpack(grn_ctx *ctx, const uint8_t *p, const uint8_t *pe, grn_obj *expr
   grn_expr *e = (grn_expr *)expr;
   GRN_B_DEC(n, p);
   for (i = 0; i < n; i++) {
+    uint32_t object_type;
     GRN_B_DEC(ns, p);
     v = grn_expr_add_var(ctx, expr, ns ? (const char *)p : NULL, ns);
     p += ns;
-    GRN_B_DEC(type, p);
-    if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) { /* error */ }
-    p = grn_obj_unpack(ctx, p, pe, type, 0, v);
+    GRN_B_DEC(object_type, p);
+    if (GRN_TYPE <= object_type && object_type <= GRN_COLUMN_INDEX) { /* error */ }
+    p = grn_obj_unpack(ctx, p, pe, object_type, 0, v);
     if (pe < p) {
       ERR(GRN_INVALID_FORMAT, "benced image is corrupt");
       return p;
@@ -463,16 +464,19 @@ grn_expr_unpack(grn_ctx *ctx, const uint8_t *p, const uint8_t *pe, grn_obj *expr
       }
       break;
     case GRN_EXPR_PACK_TYPE_OTHERS :
-      GRN_B_DEC(type, p);
-      if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) {
+      {
+        uint32_t object_type;
+      GRN_B_DEC(object_type, p);
+      if (GRN_TYPE <= object_type && object_type <= GRN_COLUMN_INDEX) {
         grn_id id;
         GRN_B_DEC(id, p);
         code->value = grn_ctx_at(ctx, id);
       } else {
         if (!(v = const_new(ctx, e))) { return NULL; }
-        p = grn_obj_unpack(ctx, p, pe, type, GRN_OBJ_EXPRCONST, v);
+        p = grn_obj_unpack(ctx, p, pe, object_type, GRN_OBJ_EXPRCONST, v);
         code->value = v;
       }
+      }
       break;
     }
     if (pe < p) {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index