Re: Remove MSVC scripts from the tree

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, 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 18:49:44
Message-ID: 09fef3e9-e1a9-db2e-7766-29c553d9010a@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2023-12-07 Th 12:34, Andres Freund wrote:
> Hi,
>
> On 2023-12-07 12:33:35 +0100, Alvaro Herrera wrote:
>> 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.)
> It seems like both might be interesting? But I think there's no reason to not
> evolve this test if we need to. I think I wrote it testing with a few old *nix
> compilers to see where -std=c99 was needed, not more. It's not too surprising
> that it might need some massaging for older msvc...
>
>
> However: I used godbolt to compile the test code on msvc, and it seems to
> build with 19.15 (which is the version Andrew referenced upthread), with a
> warning that's triggered independent of the structfunc bit.
>
> https://godbolt.org/z/j99E9MeEK
>
>
> Andrew, could you attach meson.log from the failed build?
>
>

The odd thing is I tried to reproduce the issue and instead it's now
compiling with VS2017. The only thing I have changed on the machine was
to install VS2022 alongside VS2017, as well as switching which perl to
link to, which should have no effect on this.

So never mind, we make progress.

Not sure about VS 2015 though.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-12-07 18:52:59 Re: errors building on windows using meson
Previous Message Alvaro Herrera 2023-12-07 18:41:55 Re: remaining sql/json patches