This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 01/15] Add back declarations for _initialize functions
- From: Simon Marchi <simon dot marchi at efficios dot com>
- To: John Baldwin <jhb at FreeBSD dot org>, gdb-patches at sourceware dot org
- Date: Thu, 9 Jan 2020 17:22:57 -0500
- Subject: Re: [PATCH 01/15] Add back declarations for _initialize functions
- Dkim-filter: OpenDKIM Filter v2.10.3 mail.efficios.com 2234E69690A
- References: <20191125052655.22696-1-simon.marchi@efficios.com> <20191125052655.22696-2-simon.marchi@efficios.com> <f34cc19e-f4df-82eb-4e35-9132c9f84eea@FreeBSD.org>
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