Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf9f31aa

Browse files
committed
Make parseNodeString() C idiom compatible with Visual Studio 2015.
Between v15 and now, this function's "else if" chain grew from 252 linesto 592 lines, exceeding a compiler limit that manifests as "fatal errorC1026: parser stack overflow, program too complex (compiling source filesrc/backend/nodes/readfuncs.c)". Use "if (...) return ...;" instead.Reviewed by Tom Lane, Peter Eisentraut and Michael Paquier. Not allreviewers endorse this.Discussion:https://postgr.es/m/20230607185458.GA1334487@rfd.leadboat.com
1 parent4327f6c commitf9f31aa

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

‎src/backend/nodes/gen_node_support.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,9 @@ sub elem
924924
."\t\t\t\t_out${n}(str, obj);\n"
925925
."\t\t\t\tbreak;\n";
926926

927-
print$rfs"\telse if (MATCH(\"$N\","
927+
print$rfs"\tif (MATCH(\"$N\","
928928
.length($N) ."))\n"
929-
."\t\treturn_value = _read${n}();\n"
929+
."\t\treturn (Node *) _read${n}();\n"
930930
unless$no_read;
931931

932932
nextif elem$n,@custom_read_write;

‎src/backend/nodes/readfuncs.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,6 @@ _readExtensibleNode(void)
697697
Node*
698698
parseNodeString(void)
699699
{
700-
void*return_value;
701-
702700
READ_TEMP_LOCALS();
703701

704702
/* Guard against stack overflow due to overly complex expressions */
@@ -709,16 +707,10 @@ parseNodeString(void)
709707
#defineMATCH(tokname,namelen) \
710708
(length == namelen && memcmp(token, tokname, namelen) == 0)
711709

712-
if (false)
713-
;
714710
#include"readfuncs.switch.c"
715-
else
716-
{
717-
elog(ERROR,"badly formatted node string \"%.32s\"...",token);
718-
return_value=NULL;/* keep compiler quiet */
719-
}
720711

721-
return (Node*)return_value;
712+
elog(ERROR,"badly formatted node string \"%.32s\"...",token);
713+
returnNULL;/* keep compiler quiet */
722714
}
723715

724716

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp