[PATCH] adjust thread db function declarations to match definitions (BZ 26686)
Martin Sebor
msebor@gmail.com
Mon Oct 5 21:43:30 GMT 2020
Similar to the issue with the RPC function declarations, building
Glibc with the latest GCC 11 also shows a couple of instances of
the new -Warray-parameter warning in the thread db APIs.
To avoid these, the attached patch changes the deefinitions of
the two functions to match their definitions.
I tested the patch by building Glibc with GCC trunk and confirming
the warnings are gone, and by running the tests and confirming no
new failures in the test suite.
Martin
PS The functions only appear to access the first element of the array
(via the DB_DESC_SIZE() macro), so I at first thought an alternate
change might be to have both their declarations and definitions take
a uint32_t[1] instead. But it turns out that they call
_td_locate_field with the array as an argument, and that function
accesses all three elements. So declaring them to take uint32_t[1]
leads to warnings about _td_locate_field accessing the array past
its end.
PPS Another change to consider here is to also use the [static]
notation when declaring the arrays in internal functions (in
public headers it would require hiding the "static" behind a macro
to work with C++). It's not necessary to enable bounds checking
with GCC 11 but it is with Clang.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glibc-26686-2.diff
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20201005/7f35a7e2/attachment-0001.bin>
More information about the Libc-alpha
mailing list