aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2005-03-18 10:00:43 +0000
committerMichael Meskes <meskes@postgresql.org>2005-03-18 10:00:43 +0000
commit1f418555cf959e9761d965696304ce3bf239a943 (patch)
treec70c8f3388366389e1641047d5664d5ef23b83d9 /src
parentcef01c3355975bdc6724fbc226e85d55316162a3 (diff)
downloadpostgresql-1f418555cf959e9761d965696304ce3bf239a943.tar.gz
postgresql-1f418555cf959e9761d965696304ce3bf239a943.zip
Added patch by Christof Petig <christof@petig-baender.de> to work around gcc bug on powerpc and amd64.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/ecpg/ChangeLog7
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c33
-rw-r--r--src/interfaces/ecpg/ecpglib/extern.h5
3 files changed, 34 insertions, 11 deletions
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 16332f014c5..ecd7bc6026e 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -1914,3 +1914,10 @@ Thu Feb 10 09:03:56 CET 2005
pointing out all these problems.
- Set ecpg version to 3.2.1.
+Fri Mar 18 10:54:47 CET 2005
+
+ - Added patch by Christof Petig <christof@petig-baender.de> to work
+ around gcc bug on powerpc and amd64.
+ - Set ecpg library version to 5.1.
+ - Set ecpg version to 4.1.1.
+
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index ac16e457dd8..db82073ad50 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38 2004/08/29 05:06:59 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.39 2005/03/18 10:00:43 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
@@ -69,15 +69,21 @@ quote_postgres(char *arg, int lineno)
return res;
}
+#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
+#define APREF ap
+#else
+#define APREF *ap
+#endif
+
void
-ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable * var, bool indicator)
+ECPGget_variable(va_list APREF, enum ECPGttype type, struct variable * var, bool indicator)
{
var->type = type;
- var->pointer = va_arg(*ap, char *);
+ var->pointer = va_arg(APREF, char *);
- var->varcharsize = va_arg(*ap, long);
- var->arrsize = va_arg(*ap, long);
- var->offset = va_arg(*ap, long);
+ var->varcharsize = va_arg(APREF, long);
+ var->arrsize = va_arg(APREF, long);
+ var->offset = va_arg(APREF, long);
if (var->arrsize == 0 || var->varcharsize == 0)
var->value = *((char **) (var->pointer));
@@ -97,11 +103,11 @@ ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable * var, bool i
if (indicator)
{
- var->ind_type = va_arg(*ap, enum ECPGttype);
- var->ind_pointer = va_arg(*ap, char *);
- var->ind_varcharsize = va_arg(*ap, long);
- var->ind_arrsize = va_arg(*ap, long);
- var->ind_offset = va_arg(*ap, long);
+ var->ind_type = va_arg(APREF, enum ECPGttype);
+ var->ind_pointer = va_arg(APREF, char *);
+ var->ind_varcharsize = va_arg(APREF, long);
+ var->ind_arrsize = va_arg(APREF, long);
+ var->ind_offset = va_arg(APREF, long);
if (var->ind_type != ECPGt_NO_INDICATOR
&& (var->ind_arrsize == 0 || var->ind_varcharsize == 0))
@@ -120,6 +126,7 @@ ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable * var, bool i
var->ind_varcharsize = 0;
}
}
+#undef APREF
/*
* create a list of variables
@@ -170,7 +177,11 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
if (!(var = (struct variable *) ECPGalloc(sizeof(struct variable), lineno)))
return false;
+#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
+ ECPGget_variable(ap, type, var, true);
+#else
ECPGget_variable(&ap, type, var, true);
+#endif
/* if variable is NULL, the statement hasn't been prepared */
if (var->pointer == NULL)
diff --git a/src/interfaces/ecpg/ecpglib/extern.h b/src/interfaces/ecpg/ecpglib/extern.h
index 8a04ad0aaf1..846e205d281 100644
--- a/src/interfaces/ecpg/ecpglib/extern.h
+++ b/src/interfaces/ecpg/ecpglib/extern.h
@@ -125,7 +125,12 @@ PGresult **ECPGdescriptor_lvalue(int line, const char *descriptor);
bool ECPGstore_result(const PGresult *results, int act_field,
const struct statement * stmt, struct variable * var);
bool ECPGstore_input(const int, const bool, const struct variable *, const char **, bool *);
+#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
+ // work around a gcc/ABI bug with va_lists on ppc+amd64
+void ECPGget_variable(va_list, enum ECPGttype, struct variable *, bool);
+#else
void ECPGget_variable(va_list *, enum ECPGttype, struct variable *, bool);
+#endif
/* SQLSTATE values generated or processed by ecpglib (intentionally
* not exported -- users should refer to the codes directly) */