Re: Improve readability by using designated initializers when possible

Jelte Fennema-Nio <postgres@jeltef.nl>

From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: Japin Li <japinli@hotmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, jian he <jian.universality@gmail.com>, Jeff Davis <pgsql@j-davis.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Alvaro Herrera <alvherre@alvh.no-ip.org>, pgsql-hackers@lists.postgresql.org
Date: 2024-03-05T17:53:16Z
Lists: pgsql-hackers
On Tue, 5 Mar 2024 at 15:30, Japin Li <japinli@hotmail.com> wrote:
> There is a warning if remove it, so I keep it.
>
> /home/japin/Codes/postgres/build/../src/backend/executor/execExprInterp.c:118:33: warning: label ‘CASE_EEOP_LAST’ defined but not used [-Wunused-label]
>   118 | #define EEO_CASE(name)          CASE_##name:
>       |                                 ^~~~~
> /home/japin/Codes/postgres/build/../src/backend/executor/execExprInterp.c:1845:17: note: in expansion of macro ‘EEO_CASE’
>  1845 |                 EEO_CASE(EEOP_LAST)
>       |                 ^~~~~~~~

I think if you remove the EEO_CASE(EEOP_LAST) block the warning should
go away. That block is clearly marked as unreachable, so it doesn't
really serve a purpose.



Commits

  1. Remove ObjectClass type

  2. Simplify pg_enc2gettext_tbl[] with C99-designated initializer syntax

  3. Use C99-designated initializer syntax for arrays related to encodings

  4. Remove last NULL element in config_group_names[]

  5. Use C99-designated initializer syntax for more arrays

  6. Remove unnecessary array object_classes[] in dependency.c

  7. Add trailing commas to enum definitions