From: Michael Meskes <meskes@postgresql.org>
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> (raw)
In-Reply-To: <20151013192757.2798.91073@wrigleys.postgresql.org>
References: <20151013192757.2798.91073@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
> I trying to migrate my application developed using Pro*c to ECPG. But, when
> 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
broken.
Please try this to fix:
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer
b/src/interfaces/ecpg/preproc/ecpg.trailer
index 8cc3844..16359a3 100644inline patch 1: src/interfaces/ecpg/preproc/ecpg.trailer (+0/-0 lines) download inline-1.patch--- 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 == false)
$$ = cat_str(7, mm_strdup("/* exec sql type"),
mm_strdup($3), mm_strdup("is"), mm_strdup($5.type_str), mm_strdup($6.str), $7,
mm_strdup("*/"));
else
- $$ = cat_str(6, mm_strdup("typedef "),
mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($6.str),
mm_strdup($3), mm_strdup(";"));
+ $$ = cat_str(6, mm_strdup("typedef "),
mm_strdup($5.type_str), *$7?mm_strdup("*"):mm_strdup(""), mm_strdup($3),
mm_strdup($6.str), mm_strdup(";"));
}
;
Already committed to HEAD. Will do backports later.
Thanks again.
Michael
--
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ça Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: meskes@postgresql.org, glauciobb@hotmail.com
Subject: Re: BUG #13676: C typedef code generated by ecpg with wrong syntax
In-Reply-To: <96336568.NSo5MdvYlz@feivel>
References: <20151013192757.2798.91073@wrigleys.postgresql.org> <96336568.NSo5MdvYlz@feivel>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox