RFR: JDK-8306304: Fix xlc17 clang warnings in ppc and aix code [v2]

Kim Barrett kbarrett at openjdk.org
Thu May 18 15:23:00 UTC 2023


On Wed, 17 May 2023 09:44:47 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> os_aix.cpp:460:37: error: missing field 'gid' initializer [-Werror,-Wmissing-field-initializers]
>>       struct shmid_ds shm_buf = { 0 };
>> 
>> ={} seems to work, but I do not know if it works on every compiler because standard says: the initializer must be a **non-empty, (until C23)** brace-enclosed, comma-separated list of initializers for the members.
>> Should I then disable Warning missing-field-initializers?
>
> Use
> 
> struct shmid_ds shm_buf{};
> 
> to _value-initialize_.  Calls the default constructor if there is one. Otherwise, performs _zero-initialization_,
> which is what we want here.

The final suggested change (to value-initialize the object) seems to have *not* been made.

However, I think it doesn't matter.  The mentioned restriction against being non-empty until C23 is not relevant.
This is C++, not C.  Empty initializers are, and have always been, permitted by C++.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13953#discussion_r1197956866


More information about the hotspot-dev mailing list