[PATCH 01/15] Add back declarations for _initialize functions
Simon Marchi
simon.marchi@efficios.com
Thu Jan 9 22:23:00 GMT 2020
On 2020-01-09 1:46 p.m., John Baldwin wrote:
> On 11/24/19 9:26 PM, Simon Marchi wrote:
>> I'd like to enable the -Wmissing-declarations warning. However, it
>> warns for every _initialize function, for example:
>>
>> CXX dcache.o
>> /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’:
>> /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations]
>> _initialize_dcache (void)
>> ^~~~~~~~~~~~~~~~~~
>>
>> The only practical way forward I found is to add back the declarations,
>> which were removed by this commit:
>>
>> commit 481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9
>> Author: John Baldwin <jhb@FreeBSD.org>
>> Date: Sat Sep 9 11:02:37 2017 -0700
>>
>> Remove unnecessary function prototypes.
>>
>> I don't think it's a big problem to have the declarations for these
>> functions, but if anybody has a better solution for this, I'll be happy
>> to use it.
>
> (Sorry for the late reply, but I don't think I've seen this pushed in yet?)
>
> I don't have a better solution. I feel like clang warned about the
> declarations perhaps, but I can't find the reason for making this change
> in the old branch. It might be worth testing a build with clang to see
> if this adds new warnings there or not. I can help with doing that if needed.
> If it does trigger a warning on clang we might also just choose to mute that
> warning (I think since the original commit we have added the ability to have
> clang- and gcc-specific warning flags).
Thanks for bringing this up, I have forgotten to follow up on it. As Tom
noted on patch 15, gdbserver also uses warning.m4, and I had forgotten to
run autoconf on it. And of course, it revealed more spots that would need
fixing. And among those, the functions used both in the in-process agent
and in gdbserver itself are problematic, because they should be exported when
built for the IPA, but static when built for gdbserver. So I gave up on it
for the moment. This patch (01/15) would only be relevant if the rest goes in
too, but I note your comment about clang.
Thanks,
Simon
More information about the Gdb-patches
mailing list