Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 49917200D4C for ; Thu, 30 Nov 2017 07:28:03 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 46FB7160BF4; Thu, 30 Nov 2017 06:28:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8D077160BEA for ; Thu, 30 Nov 2017 07:28:02 +0100 (CET) Received: (qmail 46603 invoked by uid 500); 30 Nov 2017 06:28:01 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 46581 invoked by uid 99); 30 Nov 2017 06:28:00 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Nov 2017 06:28:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 6BE18C12F5 for ; Thu, 30 Nov 2017 06:28:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.079 X-Spam-Level: ** X-Spam-Status: No, score=2.079 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, KB_WAM_FROM_NAME_SINGLEWORD=0.2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id UvJWietX1k7H for ; Thu, 30 Nov 2017 06:27:59 +0000 (UTC) Received: from mail-pl0-f52.google.com (mail-pl0-f52.google.com [209.85.160.52]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 104505F249 for ; Thu, 30 Nov 2017 06:27:59 +0000 (UTC) Received: by mail-pl0-f52.google.com with SMTP id bi12so3652887plb.6 for ; Wed, 29 Nov 2017 22:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=HjFv3TeAdr2vGmISQ1A9UXvd+mSgz6FIO1ln8H9cNZk=; b=j5aVJa9vf88naBnhsMh6KQySYKbQDLvofyesTncUpqXjSKi1f3/xoy8Q4En6fkDG36 ZUtGnARX/aSxuEEYsg1Xgau3iG+vw+xxqQHCdOYvl1X82kBKY//aHZItKijPXw+rExnW GrcX+wQ0UD7P3WOiB23B05AOW1PBSWcURgv+AeWuMxUmtbZg08ENxxfoUAGS3UmTB9TI sESZJxk11mbLIdtwRYwwknUbTHH/nA1RBM3CmooleSsA35ESFi+PayiwZIVi3QjAGDKJ 2eKQytD+aVd6BEAZRPbqGIRB0Y3Egu8ZG+1mTRZEVdbnILKic7PJNROEGn/w+QqWh8J2 ugMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=HjFv3TeAdr2vGmISQ1A9UXvd+mSgz6FIO1ln8H9cNZk=; b=SCN6qH5hjv/u60EPjUjZXiIZfYYw1kCph8zEMs1WX3PrnU6STR2YfFPFPBRi2TkQ/W ta1uqp6SX4t75FEt32fraEGTMy8gOMqDj34Sk/C6Za3nv1fLNUJaFmEpoOPdGSrEU2Iu K0bsflPe3aSqLvP5Z4NLQn5QLqfVDNKTp9m+TswKSHmbyqg+drccZZkPv+qpESK6pH6B LFX/MSU82p49ZY4tXBf0eR0Fqb7eULB9rFb4fHxuA74c0q8oftdl6KkpfuoJ2o4LizXo XDerd0oaJbTQSQ7dSOEyjd/42B4wqeRQkZtcaQ6sRX8kzVPF/B5iYt7MKLQob7FqZD8F 4DBQ== X-Gm-Message-State: AJaThX5yjZ1DnWh1gg0bkzTxWFyLQZtWsK6PEhlt0cpupg73KqIauxTQ 3yyFxyL1cvRaPW3+pfNKCf3BhmMgu7KAMjKfPYjmHg== X-Google-Smtp-Source: AGs4zMaYdKl5YwtxyMF30Npix5bxcCoRaT8WVD7pnnI249kIo87HSapG3tfqsaatAFIO+ad9tUCnBUTV+DvBrwxgEb8= X-Received: by 10.159.253.139 with SMTP id q11mr1486920pls.267.1512023277979; Wed, 29 Nov 2017 22:27:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.100.178.79 with HTTP; Wed, 29 Nov 2017 22:27:57 -0800 (PST) From: Chet Murthy Date: Wed, 29 Nov 2017 22:27:57 -0800 Message-ID: Subject: Question about t_const_value in plugin.thrift (and its relation to t_const_value in compiler/..../parse) To: dev@thrift.apache.org Content-Type: multipart/alternative; boundary="089e0828f4b4604f58055f2d5a81" archived-at: Thu, 30 Nov 2017 06:28:03 -0000 --089e0828f4b4604f58055f2d5a81 Content-Type: text/plain; charset="UTF-8" TL;DR I think that the definition of t_const_value in plugin.thrift needs to change, in an incompatible way, so that it can properly carry all the information from the compiler to plugins. Thoughts? Adivce? I was trying to understand the meaning of all the fields in plugin.thrift's messages, and found a discrepancy in t_const_value. The Thrift struct implies that "enum" is an *alternative*. But the code in both thrift.yy and in t_const_value.h tell a different story: there, the enum and the identifier_val go together, and are used to -compute- the integer_val for code-emitting. At the time when it comes for creating GeneratorInput, both the identifier_val and the enum are copied over into the "union". I've verified these assertions by: (a) adding code to plugin_output.cc, in the converter for t_const_value, to check that if the const_value is an identifier, then the enum_ member variable is set. (b) adding code to the Ocaml generator (t_ocaml_generator::render_const_value) to do the same check (c) writing a C++ "deserializer" to take the plugin GeneratorInput and dump it out in JSON, where I can see the enum_val came thru in the field below: { "struct_val": { "is_union": false, "is_xception": false, "members": [ { "key": 1, "name": "e", "reference": false, "req": "T_OPT_IN_REQ_OUT", "type": "1000000", "value": { "enum_val": "1000000", "identifier_val": "E.C" } } ], "metadata": { "annotations": {}, "name": "Urk", "program_id": "1000000" } } } (d) writing the same in Ocaml, again deserializing, to verify that the value has two different fields. it sure seems like this is a bug, not noticed b/c no plugin does anything nontrivial with the data? --chet-- --089e0828f4b4604f58055f2d5a81--