mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Fix C++ incompatibilities in ecpg/preproc/ header files.
There's probably no need to back-patch this, since it seems unlikely that anybody would be inserting C++ code into ecpg's preprocessor. Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru
This commit is contained in:
@ -99,13 +99,13 @@ add_preprocessor_define(char *define)
|
|||||||
/* symbol has a value */
|
/* symbol has a value */
|
||||||
for (tmp = ptr - 1; *tmp == ' '; tmp--);
|
for (tmp = ptr - 1; *tmp == ' '; tmp--);
|
||||||
tmp[1] = '\0';
|
tmp[1] = '\0';
|
||||||
defines->old = define_copy;
|
defines->olddef = define_copy;
|
||||||
defines->new = ptr + 1;
|
defines->newdef = ptr + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
defines->old = define_copy;
|
defines->olddef = define_copy;
|
||||||
defines->new = mm_strdup("1");
|
defines->newdef = mm_strdup("1");
|
||||||
}
|
}
|
||||||
defines->pertinent = true;
|
defines->pertinent = true;
|
||||||
defines->used = NULL;
|
defines->used = NULL;
|
||||||
@ -410,8 +410,8 @@ main(int argc, char *const argv[])
|
|||||||
defptr = defines;
|
defptr = defines;
|
||||||
defines = defines->next;
|
defines = defines->next;
|
||||||
|
|
||||||
free(defptr->new);
|
free(defptr->newdef);
|
||||||
free(defptr->old);
|
free(defptr->olddef);
|
||||||
free(defptr);
|
free(defptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,8 +423,8 @@ main(int argc, char *const argv[])
|
|||||||
{
|
{
|
||||||
defptr->next = this->next;
|
defptr->next = this->next;
|
||||||
|
|
||||||
free(this->new);
|
free(this->newdef);
|
||||||
free(this->old);
|
free(this->olddef);
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1114,14 +1114,14 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
|||||||
|
|
||||||
for (ptr = defines; ptr != NULL; ptr2 = ptr, ptr = ptr->next)
|
for (ptr = defines; ptr != NULL; ptr2 = ptr, ptr = ptr->next)
|
||||||
{
|
{
|
||||||
if (strcmp(yytext, ptr->old) == 0)
|
if (strcmp(yytext, ptr->olddef) == 0)
|
||||||
{
|
{
|
||||||
if (ptr2 == NULL)
|
if (ptr2 == NULL)
|
||||||
defines = ptr->next;
|
defines = ptr->next;
|
||||||
else
|
else
|
||||||
ptr2->next = ptr->next;
|
ptr2->next = ptr->next;
|
||||||
free(ptr->new);
|
free(ptr->newdef);
|
||||||
free(ptr->old);
|
free(ptr->olddef);
|
||||||
free(ptr);
|
free(ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1300,8 +1300,10 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
|||||||
yytext[i+1] = '\0';
|
yytext[i+1] = '\0';
|
||||||
|
|
||||||
for (defptr = defines;
|
for (defptr = defines;
|
||||||
defptr != NULL && strcmp(yytext, defptr->old) != 0;
|
defptr != NULL &&
|
||||||
defptr = defptr->next);
|
strcmp(yytext, defptr->olddef) != 0;
|
||||||
|
defptr = defptr->next)
|
||||||
|
/* skip */ ;
|
||||||
|
|
||||||
preproc_tos++;
|
preproc_tos++;
|
||||||
stacked_if_value[preproc_tos].else_branch = false;
|
stacked_if_value[preproc_tos].else_branch = false;
|
||||||
@ -1333,10 +1335,10 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
|||||||
|
|
||||||
for (ptr = defines; ptr != NULL; ptr = ptr->next)
|
for (ptr = defines; ptr != NULL; ptr = ptr->next)
|
||||||
{
|
{
|
||||||
if (strcmp(old, ptr->old) == 0)
|
if (strcmp(old, ptr->olddef) == 0)
|
||||||
{
|
{
|
||||||
free(ptr->new);
|
free(ptr->newdef);
|
||||||
ptr->new = mm_strdup(literalbuf);
|
ptr->newdef = mm_strdup(literalbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
@ -1344,8 +1346,8 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
|||||||
this = (struct _defines *) mm_alloc(sizeof(struct _defines));
|
this = (struct _defines *) mm_alloc(sizeof(struct _defines));
|
||||||
|
|
||||||
/* initial definition */
|
/* initial definition */
|
||||||
this->old = old;
|
this->olddef = old;
|
||||||
this->new = mm_strdup(literalbuf);
|
this->newdef = mm_strdup(literalbuf);
|
||||||
this->next = defines;
|
this->next = defines;
|
||||||
this->used = NULL;
|
this->used = NULL;
|
||||||
defines = this;
|
defines = this;
|
||||||
@ -1613,7 +1615,7 @@ static bool isdefine(void)
|
|||||||
/* is it a define? */
|
/* is it a define? */
|
||||||
for (ptr = defines; ptr; ptr = ptr->next)
|
for (ptr = defines; ptr; ptr = ptr->next)
|
||||||
{
|
{
|
||||||
if (strcmp(yytext, ptr->old) == 0 && ptr->used == NULL)
|
if (strcmp(yytext, ptr->olddef) == 0 && ptr->used == NULL)
|
||||||
{
|
{
|
||||||
struct _yy_buffer *yb;
|
struct _yy_buffer *yb;
|
||||||
|
|
||||||
@ -1626,7 +1628,7 @@ static bool isdefine(void)
|
|||||||
|
|
||||||
ptr->used = yy_buffer = yb;
|
ptr->used = yy_buffer = yb;
|
||||||
|
|
||||||
yy_scan_string(ptr->new);
|
yy_scan_string(ptr->newdef);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,8 +160,8 @@ struct typedefs
|
|||||||
|
|
||||||
struct _defines
|
struct _defines
|
||||||
{
|
{
|
||||||
char *old;
|
char *olddef;
|
||||||
char *new;
|
char *newdef;
|
||||||
int pertinent;
|
int pertinent;
|
||||||
void *used;
|
void *used;
|
||||||
struct _defines *next;
|
struct _defines *next;
|
||||||
|
Reference in New Issue
Block a user