pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Cleaning up historical portability baggage
Date: Sat, 06 Aug 2022 19:08:27 -0400
Message-ID: <148623.1659827307@sss.pgh.pa.us> (raw)
In-Reply-To: <20220806000311.ywx65iuchvj4qn2k@awork3.anarazel.de>
References: <CA+hUKG+MOzmDkr27ceG8+uwgFxbJUUv699V3VP3DCioQigrf7A@mail.gmail.com>
	<1249825.1658622186@sss.pgh.pa.us>
	<CA+hUKGLryBW4fNYoXzMG9y1e0H-QOTdSiTG46xCr1DNuuPwbeg@mail.gmail.com>
	<CA+hUKGJMcwbzRyfTocfxbPBUhERqKE42d-L22jQ+vpB7an-NjQ@mail.gmail.com>
	<20220804013546.h65najrzig764jar@awork3.anarazel.de>
	<3295936.1659577924@sss.pgh.pa.us>
	<20220804023010.24snkyq3hser5pxq@awork3.anarazel.de>
	<CA+hUKGLjffiULiVs5K4mi8FO5dgfngjKx5n9vZdDzQB9hzfurw@mail.gmail.com>
	<CA+hUKGJJxtpG12XFu6XJRxo+1ZmTrnYwY9_e8FgrVS7K9ar5Mg@mail.gmail.com>
	<20220805210823.u546w4p4wzfany7p@awork3.anarazel.de>
	<20220806000311.ywx65iuchvj4qn2k@awork3.anarazel.de>

Andres Freund <andres@anarazel.de> writes:
> Thanks. Next in my quest for reducing autoconf vs meson pg_config.h
> differences is GETTIMEOFDAY stuff.

I just noticed that this could be simplified:

    #ifdef _MSC_VER
    struct timezone;
    /* Last parameter not used */
    extern int	gettimeofday(struct timeval *tp, struct timezone *tzp);
    #endif

because what POSIX actually says is

    int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

and

    If tzp is not a null pointer, the behavior is unspecified.

Indeed, we never call it with anything but a null tzp value,
nor does our Windows fallback implementation do anything with tzp.

So ISTM we should drop the bogus "struct timezone;" and declare
this parameter as "void *tzp".

			regards, tom lane





view thread (108+ messages)  latest in thread

Message-ID: <148623.1659827307@sss.pgh.pa.us>
Permalink:  ../148623.1659827307@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/148623.1659827307@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, thomas.munro@gmail.com, andrew@dunslane.net, robertmhaas@gmail.com
  Subject: Re: Cleaning up historical portability baggage
  In-Reply-To: <148623.1659827307@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox