From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26194 invoked by alias); 11 Apr 2014 19:32:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 26183 invoked by uid 89); 11 Apr 2014 19:32:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ve0-f177.google.com Received: from mail-ve0-f177.google.com (HELO mail-ve0-f177.google.com) (209.85.128.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 11 Apr 2014 19:32:44 +0000 Received: by mail-ve0-f177.google.com with SMTP id sa20so5094903veb.8 for ; Fri, 11 Apr 2014 12:32:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ZXnza4Ht8QqzFMDymCiXowPetOQ2J9ztPXIGaQ/Mh9g=; b=Ww4FO/I9VT+G09p0x2h9mdOKXwaBEgcDrkSlEXjCkFI5/1LeiZ3NuOCDHObfKTqSn+ Eba1PdAx93Zxd0f4Q97d/6za8OLx4QqAOIdd5254ukerkgJpXWgJMFtdW1W9P/QqS2Hh R0yie2yRSP3mKZDF5isU6i4txOXkbS2Bq38tBI5NHRAzoJGrtD6q9IJkW7E6UOadFmqu AEJOkNNqKPPnvtVffNtp64pOJ9zt41d2+/YqzZUHq5i7sumIBVRhYFM0H9tCzt8KL6GL hGe5T3/Z+gZwkkkhaGwPyQIXbJ6FDUBOLh82vx4PgxLWiD2VJwYfV7VE1EOvU9ybncug w/Sg== X-Gm-Message-State: ALoCoQn37tXFn+7mOx7NDjhAd5gUoRJIHz/bUeMwmYXlz3jmVXJ8VFucCpjh9+JH8T7N5s8+5G82IyOIK45DaPc1RI8LMGSM+uyh5V+6ABYUXyt0QQUNEc6DlqGc0iFasKB30yGM9HRrO84nZN1Qer7EBgXiVWAhYq9TNFCpGaF2uHB38MMo1fTIcuXFRR2KsYHfm8BH+q+EAprSqDsKk4598iexn+rxXw== MIME-Version: 1.0 X-Received: by 10.52.99.168 with SMTP id er8mr7154678vdb.26.1397244762839; Fri, 11 Apr 2014 12:32:42 -0700 (PDT) Received: by 10.52.13.101 with HTTP; Fri, 11 Apr 2014 12:32:42 -0700 (PDT) In-Reply-To: References: Date: Fri, 11 Apr 2014 19:32:00 -0000 Message-ID: Subject: Re: [patch] Fix unused static symbols so they're not dropped by clang From: Doug Evans To: David Blaikie Cc: gdb-patches , Eric Christopher Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00216.txt.bz2 On Fri, Apr 11, 2014 at 11:23 AM, Doug Evans wrote: > On Thu, Apr 10, 2014 at 11:51 PM, David Blaikie wrote: >> Several tests used file-static functions and variables that were not >> referenced by the code. Even at -O0, clang omits these entities at the >> frontend so the tests fail. >> >> Since it doesn't look like these tests needed this functionality for >> what they were testing, I've modified the variables/functions to >> either be non-static, or marked them with __attribute__((used)). >> >> If it's preferred that I use the attribute more pervasively, rather >> than just making the entities non-static, I can provide a patch for >> that (or some other preferred solution). There's certainly precedent >> for both (non-static entities and __attribute__((used)) in the >> testsuite already and much more of the former than the latter). >> >> I have commit-after-review access, so just looking for sign-off here. > > Yikes. > > This is becoming more and more painful (not your fault of course!). > I can imagine this being a never ending source of regressions. > > Does clang perchance have a -O0-and-yes-I-really-mean-O0 option? Failing that, making the entries non-static without adding a comment to explain why things are the way they are will leave things in a more fragile state, and if we're going to add a comment we might just as well use an attribute throughout I guess. However using the attribute is, technically, more complicated than that because we shouldn't unnecessarily break testing with other compilers. That suggests putting the attribute in a macro in a header protected by appropriate #ifdefs. The testsuite doesn't yet have a single location for such headers (testsuite/include or some such, though there is already testsuite/lib (cough) but if it's just for the one header ...).