Re: C11: should we use char32_t for unicode code points?
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: Thomas Munro <thomas.munro@gmail.com>, Peter Eisentraut <peter@eisentraut.org>
Cc: Tatsuo Ishii <ishii@postgresql.org>, pgsql-hackers@postgresql.org
Date: 2025-10-29T18:54:34Z
Lists: pgsql-hackers
Attachments
On Tue, 2025-10-28 at 14:54 -0700, Jeff Davis wrote:
> [21:48:21.794] ../../src/include/port/win32_port.h: At top level:
> [21:48:21.794] ../../src/include/port/win32_port.h:254:8: error:
> redefinition of ‘struct stat’
> [21:48:21.794] 254 | struct stat
> /* This should match struct __stat64 */
> [21:48:21.794] | ^~~~
> [21:48:21.794] In file included from /usr/share/mingw-
> w64/include/wchar.h:413,
> [21:48:21.794] from /usr/share/mingw-
> w64/include/uchar.h:28,
> [21:48:21.794] from ../../src/include/c.h:526:
> [21:48:21.794] /usr/share/mingw-w64/include/_mingw_stat64.h:40:10:
> note: originally defined here
> [21:48:21.794] 40 | struct stat {
> [21:48:21.794] | ^~~~
>
> https://cirrus-ci.com/task/4849300577976320
It seems to work on the two windows CI instances just fine, but fails
mingw_cross_warning.
Apparently, <uchar.h> somehow includes (some portion of?) <sys/stat.h>
on that platform, which then conflicts with the hackery done in
<win32_port.h> (which expects to include <sys/stat.h> itself after some
special #defines).
The attached patch moves the inclusion of <uchar.h> after "port.h",
which solves the problem. It's a bit out of place, but I added a note
in the comment explaining why. I'll go ahead and commit.
Regards,
Jeff Davis