Re: Remove MSVC scripts from the tree

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Remove MSVC scripts from the tree
Date: 2023-12-07 11:33:35
Message-ID: 202312071133.xqkoqngn5mt2@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-Dec-07, Peter Eisentraut wrote:

> On 06.12.23 21:52, Andrew Dunstan wrote:

> > Yes, if I comment out the call to structfunc() the test passes on VS2017
> > (compiler version 19.15.26726)
>
> This is strange, because we use code like that in the tree. There must be
> some small detail that trips it up here.

Well, We have things like these

typedef struct _archiveOpts
{
...
} ArchiveOpts;
#define ARCHIVE_OPTS(...) &(ArchiveOpts){__VA_ARGS__}

XL_ROUTINE is quite similar.

These are then used like
ARCHIVE_OPTS(.tag = "pg_largeobject",
.description = "pg_largeobject",
.section = SECTION_PRE_DATA,
.createStmt = loOutQry->data));

so the difference is that we're passing a pointer to a struct, not
the struct bare, which is what c99_test is doing:

struct named_init_test {
int a;
int b;
};

int main() {
...
structfunc((struct named_init_test){1, 0});
}

Maybe this would work if the function received the pointer too?

extern void structfunc(struct named_init_test *);

structfunc(&(struct named_init_test){1, 0});

The fact that this is called "structfunc" makes me wonder if the author
did indeed want to test passing a struct to the function. That'd be
odd, since the interesting thing in this line is the expression used to
initialize the struct argument. (We do pass structs, eg. ObjectAddress
to check_object_ownership; old code.)

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"No renuncies a nada. No te aferres a nada."

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-12-07 11:36:50 Re: Synchronizing slots from primary to standby
Previous Message vignesh C 2023-12-07 11:20:38 Re: pg_upgrade and logical replication