BUG #14167: ecpg parser cann't ignore code in #ifdef ?

From: digoal(at)126(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14167: ecpg parser cann't ignore code in #ifdef ?
Date: 2016-06-01 03:33:34
Message-ID: 20160601033334.30388.39448@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14167
Logged by: Zhou Digoal
Email address: digoal(at)126(dot)com
PostgreSQL version: 9.6beta1
Operating system: CentOS 6.x x64
Description:

HI,
this is my pgc code.

#include <stdio.h>
#include <stdlib.h>
#include <pgtypes_numeric.h>;

EXEC SQL WHENEVER SQLERROR STOP;

int
main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
numeric *num;

#ifdef ABC
err *abc;
#endif
numeric *num2;
decimal *dec;
EXEC SQL END DECLARE SECTION;

EXEC SQL CONNECT TO tcp:postgresql://127.0.0.1:5432/postgres AS test
USER test USING test;

num = PGTYPESnumeric_new();
dec = PGTYPESdecimal_new();

EXEC SQL SELECT 12.345::numeric(4,2), 23.456::decimal(4,2) INTO :num,
:dec;

printf("numeric = %s\n", PGTYPESnumeric_to_asc(num, 0));
printf("numeric = %s\n", PGTYPESnumeric_to_asc(num, 1));
printf("numeric = %s\n", PGTYPESnumeric_to_asc(num, 2));

/* Convert decimal to numeric to show a decimal value. */
num2 = PGTYPESnumeric_new();
PGTYPESnumeric_from_decimal(dec, num2);

printf("decimal = %s\n", PGTYPESnumeric_to_asc(num2, 0));
printf("decimal = %s\n", PGTYPESnumeric_to_asc(num2, 1));
printf("decimal = %s\n", PGTYPESnumeric_to_asc(num2, 2));

PGTYPESnumeric_free(num2);
PGTYPESdecimal_free(dec);
PGTYPESnumeric_free(num);

EXEC SQL COMMIT;
EXEC SQL DISCONNECT ALL;
return 0;
}

this is ERROR
ecpg -t -c -I/home/digoal/pgsql9.6/include -o t.c t.pgc
t.pgc:15: ERROR: unrecognized data type name "err"

And use #ifndef and -DABC also error.
ECPG parser cann't skip code in #ifdef or #ifndef ?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Migowski 2016-06-01 04:46:50 Re: BUG #14162: No statistics for functions used as aggregates
Previous Message Andrew Gierth 2016-06-01 02:16:07 Re: BUG #14162: No statistics for functions used as aggregates