This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: many unused function warnings in gdb 7.9 on darwin
- From: Pedro Alves <palves at redhat dot com>
- To: Paul_Koning at Dell dot com, howarth dot mailing dot lists at gmail dot com
- Cc: gdb at sourceware dot org
- Date: Thu, 26 Feb 2015 20:21:36 +0000
- Subject: Re: many unused function warnings in gdb 7.9 on darwin
- Authentication-results: sourceware.org; auth=none
- References: <CADtEn-0a2XqyNySrYL-OrC=yYvBs_uuVFNnJE5KdHt_-7FHsaA at mail dot gmail dot com> <54EEF2D4 dot 2000602 at redhat dot com> <CADtEn-3Bg+ByB0bWyBodqa6V8QwHCoYsoFY_Eemmh0nNAwwLgw at mail dot gmail dot com> <CADtEn-1SF9Q_XE+wTwjpB-Zny4UEU5kCiPcXnUjf-8X4hmfd+A at mail dot gmail dot com> <024299DE-C682-4DB4-B1A1-FCF89C969C27 at dell dot com>
On 02/26/2015 07:55 PM, Paul_Koning@Dell.com wrote:
>
>> On Feb 26, 2015, at 2:41 PM, Jack Howarth <howarth.mailing.lists@gmail.com> wrote:
>>
>> The clang developers have comments on this issue in
>> http://llvm.org/bugs/show_bug.cgi?id=22712#c1. They ask (as I did
>> originally) why we aren't wrapping these functions to keep them from
>> being declared on darwin if they aren't used.
>
> I can think of a good reason: they are used as cleaner replacements for macros, defined in header files. So they are used in some files that include those headers, but not others. Thatâs why GCC has that rule about not warning if the function is static inline.
Right. In this case the functions are a result of preprocessor magic
that implements a templated vector type and its methods, in C. See it here:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/common/vec.h;h=41e41b5b22c9f5ec14711aac35ce4ae6bceab1e7;hb=HEAD
Now, the macros that define the static inline functions _are_ defined
in a header, but then those get expanded in the main source file,
resulting in static inline functions defined in the main source file.
I'm guessing that clang's rule of "header vs main source" is
missing that...
Thanks,
Pedro Alves