From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57245 invoked by alias); 26 Feb 2015 20:21:46 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 57230 invoked by uid 89); 26 Feb 2015 20:21:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 26 Feb 2015 20:21:45 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1QKLdUM027989 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 26 Feb 2015 15:21:39 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1QKLbBR015434; Thu, 26 Feb 2015 15:21:38 -0500 Message-ID: <54EF8050.3010302@redhat.com> Date: Fri, 27 Feb 2015 09:13:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Paul_Koning@Dell.com, howarth.mailing.lists@gmail.com CC: gdb@sourceware.org Subject: Re: many unused function warnings in gdb 7.9 on darwin References: <54EEF2D4.2000602@redhat.com> <024299DE-C682-4DB4-B1A1-FCF89C969C27@dell.com> In-Reply-To: <024299DE-C682-4DB4-B1A1-FCF89C969C27@dell.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2015-02/txt/msg00076.txt.bz2 On 02/26/2015 07:55 PM, Paul_Koning@Dell.com wrote: > >> On Feb 26, 2015, at 2:41 PM, Jack Howarth 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