Skip to content

Commit 1f41855

Browse files
author
Michael Meskes
committed
Added patch by Christof Petig <christof@petig-baender.de> to work around gcc bug on powerpc and amd64.
1 parent cef01c3 commit 1f41855

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,3 +1914,10 @@ Thu Feb 10 09:03:56 CET 2005
19141914
pointing out all these problems.
19151915
- Set ecpg version to 3.2.1.
19161916

1917+
Fri Mar 18 10:54:47 CET 2005
1918+
1919+
- Added patch by Christof Petig <christof@petig-baender.de> to work
1920+
around gcc bug on powerpc and amd64.
1921+
- Set ecpg library version to 5.1.
1922+
- Set ecpg version to 4.1.1.
1923+

src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38 2004/08/29 05:06:59 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.39 2005/03/18 10:00:43 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -69,15 +69,21 @@ quote_postgres(char *arg, int lineno)
6969
return res;
7070
}
7171

72+
#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
73+
#define APREF ap
74+
#else
75+
#define APREF *ap
76+
#endif
77+
7278
void
73-
ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable * var, bool indicator)
79+
ECPGget_variable(va_list APREF, enum ECPGttype type, struct variable * var, bool indicator)
7480
{
7581
var->type = type;
76-
var->pointer = va_arg(*ap, char *);
82+
var->pointer = va_arg(APREF, char *);
7783

78-
var->varcharsize = va_arg(*ap, long);
79-
var->arrsize = va_arg(*ap, long);
80-
var->offset = va_arg(*ap, long);
84+
var->varcharsize = va_arg(APREF, long);
85+
var->arrsize = va_arg(APREF, long);
86+
var->offset = va_arg(APREF, long);
8187

8288
if (var->arrsize == 0 || var->varcharsize == 0)
8389
var->value = *((char **) (var->pointer));
@@ -97,11 +103,11 @@ ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable * var, bool i
97103

98104
if (indicator)
99105
{
100-
var->ind_type = va_arg(*ap, enum ECPGttype);
101-
var->ind_pointer = va_arg(*ap, char *);
102-
var->ind_varcharsize = va_arg(*ap, long);
103-
var->ind_arrsize = va_arg(*ap, long);
104-
var->ind_offset = va_arg(*ap, long);
106+
var->ind_type = va_arg(APREF, enum ECPGttype);
107+
var->ind_pointer = va_arg(APREF, char *);
108+
var->ind_varcharsize = va_arg(APREF, long);
109+
var->ind_arrsize = va_arg(APREF, long);
110+
var->ind_offset = va_arg(APREF, long);
105111

106112
if (var->ind_type != ECPGt_NO_INDICATOR
107113
&& (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
120126
var->ind_varcharsize = 0;
121127
}
122128
}
129+
#undef APREF
123130

124131
/*
125132
* create a list of variables
@@ -170,7 +177,11 @@ create_statement(int lineno, int compat, int force_indicator, struct connection
170177
if (!(var = (struct variable *) ECPGalloc(sizeof(struct variable), lineno)))
171178
return false;
172179

180+
#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
181+
ECPGget_variable(ap, type, var, true);
182+
#else
173183
ECPGget_variable(&ap, type, var, true);
184+
#endif
174185

175186
/* if variable is NULL, the statement hasn't been prepared */
176187
if (var->pointer == NULL)

src/interfaces/ecpg/ecpglib/extern.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ PGresult **ECPGdescriptor_lvalue(int line, const char *descriptor);
125125
bool ECPGstore_result(const PGresult *results, int act_field,
126126
const struct statement * stmt, struct variable * var);
127127
bool ECPGstore_input(const int, const bool, const struct variable *, const char **, bool *);
128+
#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__))
129+
// work around a gcc/ABI bug with va_lists on ppc+amd64
130+
void ECPGget_variable(va_list, enum ECPGttype, struct variable *, bool);
131+
#else
128132
void ECPGget_variable(va_list *, enum ECPGttype, struct variable *, bool);
133+
#endif
129134

130135
/* SQLSTATE values generated or processed by ecpglib (intentionally
131136
* not exported -- users should refer to the codes directly) */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy