From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id F12E02624D for ; Tue, 5 Feb 2019 12:46:24 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y7UESKXpCqKF for ; Tue, 5 Feb 2019 12:46:24 -0500 (EST) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id B077F2621D for ; Tue, 5 Feb 2019 12:46:24 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH 7/8] sql: clean-up affinity from SQL source code From: "n.pettik" In-Reply-To: Date: Tue, 5 Feb 2019 20:46:22 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <9A482763-8007-445F-A4EE-36F4F40F89A6@tarantool.org> References: <541AF1EA-6688-4B4F-92CB-2AA15765A62E@tarantool.org> <2cd04a2d-6cd8-9e0b-7d51-d9431b6c5d82@tarantool.org> <33150EBA-AB14-4089-8399-0FBD07C71BD8@tarantool.org> <1487a209-af7b-5d1f-6fff-fc589782d571@tarantool.org> <239B8EBA-F577-4C9A-BDD9-D76DE10FEB76@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Vladislav Shpilevoy >> - * 15 is 1111 in a binary form. >> - * Since all existing types can be fitted in 4 bits >> - * (field_type_MAX =3D=3D 10), it is enough to 'and' >> - * p5 with this constant. Node that all other flags >> - * that can be stored in p5 are >=3D 16. >> + * Since all existing types can be fitted in 4 >> + * bits (field_type_MAX =3D=3D 9), it is enough to >> + * 'and' p5 with field mask. Note that values of >> + * other flags that can be stored in p5 of these >> + * opcodes are >=3D FIELD_TYPE_MASK. >=20 > They can not be =3D=3D FIELD_TYPE_MASK. Please, again, do not try to > write here any constants, including bit counts. A definition named > MASK is already enough to make it clear, that p5 'and' mask give a > type. Ok, I won=E2=80=99t argue.=20 > Please, apply the diff below. I made enum field_type_mask an > anonymous enum, as we usually do with independent constants. Also, I > used FIELD_TYPE_MASK instead of 15 in static assertion, and removed > the comment from vdbe.c about what a mask is. Seems like compilers don=E2=80=99t allow to compare two different enums, even though their values are defined:=20 /tarantool/src/box/field_def.h:91:30: error: comparison between =E2=80=98e= num field_type=E2=80=99 and =E2=80=98enum =E2=80=99 = [-Werror=3Denum-compare] static_assert(field_type_MAX <=3D FIELD_TYPE_MASK, "values of enum = field_type "\ =20 So I added explicit cast: diff --git a/src/box/field_def.h b/src/box/field_def.h index dc7730f9f..f944de9d6 100644 --- a/src/box/field_def.h +++ b/src/box/field_def.h @@ -88,8 +88,8 @@ enum { * For detailed explanation see context of OP_Eq, OP_Lt etc * opcodes in vdbe.c. */ -static_assert(field_type_MAX <=3D FIELD_TYPE_MASK, "values of enum = field_type "\ - "should fit into 4 bits of VdbeOp.p5"); +static_assert((int) field_type_MAX <=3D (int) FIELD_TYPE_MASK, + "values of enum field_type should fit into 4 bits of = VdbeOp.p5=E2=80=9D); The rest of diff applied as is.