Re: anonymous unions (C11)

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: anonymous unions (C11)
Date: 2025-09-23 23:19:05
Message-ID: CAEoWx2mv41hcyQAs2svi0ZSVW5C7T+DfD7=N-DR1L3cAPs2jXA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 23, 2025 at 5:38 PM Peter Eisentraut <peter(at)eisentraut(dot)org>
wrote:

>
>
> That said, I did go overboard here and converted all the struct/union
> combinations I could find, but I'm not necessarily proposing to apply
> all of them. I'm proposing patches 0001 through 0004, which are
> relatively simple or in areas that have already changed a few times
> recently (so backpatching would not be trivial anyway), and/or they
> are somewhat close to my heart because they originally motivated this
> work a long time ago. But if someone finds among the other patches
> one that they particularly like, we could add that one as well.

I went through all commits and code changes are neat and clear.

But when I tried to build on my Macbook M4, it got 18 errors
against cryptohash.c:
```
cryptohash.c:108:22: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
108 | pg_md5_init(&ctx->data.md5);
| ~~~ ^
cryptohash.c:111:23: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
111 | pg_sha1_init(&ctx->data.sha1);
| ~~~ ^
cryptohash.c:114:25: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
114 | pg_sha224_init(&ctx->data.sha224);
| ~~~ ^
cryptohash.c:117:25: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
117 | pg_sha256_init(&ctx->data.sha256);
| ~~~ ^
cryptohash.c:120:25: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
120 | pg_sha384_init(&ctx->data.sha384);
| ~~~ ^
cryptohash.c:123:25: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
123 | pg_sha512_init(&ctx->data.sha512);
| ~~~ ^
cryptohash.c:144:24: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
144 | pg_md5_update(&ctx->data.md5, data, len);
| ~~~ ^
cryptohash.c:147:25: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
147 | pg_sha1_update(&ctx->data.sha1, data, len);
| ~~~ ^
cryptohash.c:150:27: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
150 | pg_sha224_update(&ctx->data.sha224, data,
len);
Fixed build failure on Macbook M4
| ~~~ ^
cryptohash.c:153:27: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
153 | pg_sha256_update(&ctx->data.sha256, data,
len);
| ~~~ ^
cryptohash.c:156:27: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
156 | pg_sha384_update(&ctx->data.sha384, data,
len);
| ~~~ ^
cryptohash.c:159:27: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
159 | pg_sha512_update(&ctx->data.sha512, data,
len);
| ~~~ ^
cryptohash.c:185:23: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
185 | pg_md5_final(&ctx->data.md5, dest);
| ~~~ ^
cryptohash.c:193:24: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
193 | pg_sha1_final(&ctx->data.sha1, dest);
| ~~~ ^
cryptohash.c:201:26: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
201 | pg_sha224_final(&ctx->data.sha224, dest);
| ~~~ ^
cryptohash.c:209:26: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
209 | pg_sha256_final(&ctx->data.sha256, dest);
| ~~~ ^
cryptohash.c:217:26: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
217 | pg_sha384_final(&ctx->data.sha384, dest);
| ~~~ ^
cryptohash.c:225:26: error: no member named 'data' in 'struct
pg_cryptohash_ctx'
225 | pg_sha512_final(&ctx->data.sha512, dest);
| ~~~ ^
18 errors generated.
```

With the attached fix, the build passed then, "make check" also passed.

Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
0024-Fixed-build-failure-on-Macbook-M4.patch application/octet-stream 3.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-09-23 23:23:10 Re: [PATCH] Add tests for Bitmapset
Previous Message Michael Paquier 2025-09-23 22:55:12 Re: Add support for entry counting in pgstats