Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zn719-0006E2-4K for pgsql-bugs@arkaria.postgresql.org; Fri, 16 Oct 2015 15:34:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zn718-0005EH-Bm for pgsql-bugs@arkaria.postgresql.org; Fri, 16 Oct 2015 15:34:02 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zn70W-0004XT-Cg for pgsql-bugs@postgresql.org; Fri, 16 Oct 2015 15:33:24 +0000 Received: from gauss.credativ.com ([93.94.130.89]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Zn70T-00040d-K0 for pgsql-bugs@postgresql.org; Fri, 16 Oct 2015 15:33:23 +0000 Received: from gauss.credativ.com (localhost [127.0.0.1]) by gauss.credativ.com (Postfix) with ESMTP id CE9F61450038; Fri, 16 Oct 2015 17:33:18 +0200 (CEST) Received: from feivel (aftr-109-91-37-16.unity-media.net [109.91.37.16]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mme@gauss.credativ.com) by gauss.credativ.com (Postfix) with ESMTPSA id BB4A21450035; Fri, 16 Oct 2015 17:33:18 +0200 (CEST) Received: from feivel.localnet (localhost [127.0.0.1]) by feivel (Postfix) with ESMTP id 304E042F26; Fri, 16 Oct 2015 17:33:18 +0200 (CEST) From: Michael Meskes To: pgsql-bugs@postgresql.org Cc: glauciobb@hotmail.com Subject: Re: BUG #13676: C typedef code generated by ecpg with wrong syntax Date: Fri, 16 Oct 2015 17:33:17 +0200 Message-ID: <96336568.NSo5MdvYlz@feivel> User-Agent: KMail/4.14.10 (Linux/3.16.0-4-amd64; KDE/4.14.12; x86_64; ; ) In-Reply-To: <20151013192757.2798.91073@wrigleys.postgresql.org> References: <20151013192757.2798.91073@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org > I trying to migrate my application developed using Pro*c to ECPG. But, wh= en > I run the code below with "ecpg -c" command to generate c code, the syntax > for typedef generated appears to be wrong. Below is an sample code and the > steps to generate error return by C compiler due the wrong syntax for > typedef. Thanks for spotting and reporting. The order of the arguments seems to be=20 broken. Please try this to fix: diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer=20 b/src/interfaces/ecpg/preproc/ecpg.trailer index 8cc3844..16359a3 100644 --- a/src/interfaces/ecpg/preproc/ecpg.trailer +++ b/src/interfaces/ecpg/preproc/ecpg.trailer @@ -1311,7 +1311,7 @@ ECPGTypedef: TYPE_P if (auto_create_c =3D=3D false) $$ =3D cat_str(7, mm_strdup("/* exec sql ty= pe"),=20 mm_strdup($3), mm_strdup("is"), mm_strdup($5.type_str), mm_strdup($6.str), = $7,=20 mm_strdup("*/")); else - $$ =3D cat_str(6, mm_strdup("typedef "),=20 mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($6.str)= ,=20 mm_strdup($3), mm_strdup(";")); + $$ =3D cat_str(6, mm_strdup("typedef "),=20 mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($3),=20 mm_strdup($6.str), mm_strdup(";")); } ; Already committed to HEAD. Will do backports later. Thanks again. Michael --=20 Michael Meskes Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org) Meskes at (Debian|Postgresql) dot Org Jabber: michael.meskes at gmail dot com VfL Borussia! For=E7a Bar=E7a! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs