Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm7lr-0005Kd-9A for pgsql-bugs@arkaria.postgresql.org; Tue, 13 Oct 2015 22:10:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zm7lq-0001tR-K5 for pgsql-bugs@arkaria.postgresql.org; Tue, 13 Oct 2015 22:10:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zm5F1-0007ir-I4 for pgsql-bugs@postgresql.org; Tue, 13 Oct 2015 19:28:07 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Zm5Ex-0003cy-Ho for pgsql-bugs@postgresql.org; Tue, 13 Oct 2015 19:28:06 +0000 MIME-Version: 1.0 Subject: BUG #13676: C typedef code generated by ecpg with wrong syntax To: pgsql-bugs@postgresql.org From: glauciobb@hotmail.com Date: Tue, 13 Oct 2015 19:27:57 +0000 Message-ID: <20151013192757.2798.91073@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" 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 The following bug has been logged on the website: Bug reference: 13676 Logged by: Gláucio Barros Barcelos Email address: glauciobb@hotmail.com PostgreSQL version: 9.4.5 Operating system: Oracle Linux Server release 6.7 Description: Dear, 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. Step 1: Create a file with pgc extension with the code below: #include EXEC SQL TYPE t_char_10 IS char[10]; int main() { int status = 0; return status; } Step 2: pre compile the file with command: ecpg -c file.pgc. This command will generate the c code below. Note that the syntax for typedef is wrong. /* Processed by ecpg (4.10.0) */ /* These include files are added by the preprocessor */ #include #include #include /* End of automatic include section */ #line 1 "example.pgc" #include typedef char [ 10 ] t_char_10 ; #line 3 "example.pgc" int main() { int status = 0; return status; } Step 3: Try to compile the c code with command "cc -I/usr/pgsql-9.4/include -c file.c". file.pgc:3 error: expected indentifier or '(' before '[' token best regards, Gláucio -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs