From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61774 invoked by alias); 4 Oct 2016 14:34:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 61763 invoked by uid 89); 4 Oct 2016 14:34:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1604, risk X-HELO: mail-qt0-f196.google.com Received: from mail-qt0-f196.google.com (HELO mail-qt0-f196.google.com) (209.85.216.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Oct 2016 14:34:57 +0000 Received: by mail-qt0-f196.google.com with SMTP id y38so1596871qta.3 for ; Tue, 04 Oct 2016 07:34:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=nHrWac6/UcWJd9yjtM0wHyE0BM3tkjrNgeps6KbbPnw=; b=MC0MCqXArnmo2y/3hrXYVCGDQtJxhSAQUD3a2Ztxr2LHjMjM0Snvbb1bGrwqvRwX4b ZsP6c5RzPnb4wczBKfeTMPbWSbTS7pmLM9JNWNjja6CsfKiFzLp+ucIgFngGd3mrl9yQ xxQVPQ8XsuNN0cJ1vvn3NgtVBN8w2fwnk4v3/6VpmKffGU+oB/ifK2ny3CMgaZ4uf4ht lxh+bhYWnfR0l4+z3ultlfGnT8QSDeslAxBYHWjdazQpzE13nLN6nJ//GN3k8bemVzK+ /cT21zc0bhrTDBIc5saFAOa4jtx0vPJ/XuYUnmOnDePF0yZYarbgit/klKp8m6iXylqU B12g== X-Gm-Message-State: AA6/9RkBFQbPjBFiRmAzOsblM2h1uFygLMk4Sr2fwMLv+IEnCMU5lJw1JxNH1ralURchkQ== X-Received: by 10.200.45.246 with SMTP id q51mr3960222qta.108.1475591695851; Tue, 04 Oct 2016 07:34:55 -0700 (PDT) Received: from [192.168.0.26] (75-166-199-51.hlrn.qwest.net. [75.166.199.51]) by smtp.gmail.com with ESMTPSA id f56sm19609427qta.26.2016.10.04.07.34.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Oct 2016 07:34:55 -0700 (PDT) Subject: Re: [PATCH] add uClibc target hook (PR bootstrap/77819) To: Bernd Schmidt , Gcc Patch List References: <52a0ea48-cbfd-28c8-4711-22cea9481d1a@gmail.com> From: Martin Sebor Message-ID: <7ab9d030-106e-1716-f495-94844e94f17f@gmail.com> Date: Tue, 04 Oct 2016 14:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00161.txt.bz2 On 10/04/2016 02:42 AM, Bernd Schmidt wrote: > On 10/03/2016 12:02 AM, Martin Sebor wrote: >> I couldn't find a good uclibc-only file where to put the new >> definition of the hook so I conditionally added it to >> targethooks.c. > >> diff --git a/gcc/targhooks.c b/gcc/targhooks.c >> index d75650f..77b4a18 100644 >> --- a/gcc/targhooks.c >> +++ b/gcc/targhooks.c >> @@ -1523,6 +1523,26 @@ default_printf_pointer_format (tree, const char >> **flags) >> return "%zx"; >> } >> >> +#if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ > > I think DEFAULT_LIBC is defined only for linux targets, so this won't > do. Just define unconditionally, with a declaration in targhooks.h? I copied the conditional from config/linux.h but I admit I don't fully understand when the macro is defined. Should I still remove it from targhooks.c? > >> +const char* >> +uclibc_printf_pointer_format (tree arg, const char **flags) >> +{ >> + *flags = " +"; >> + >> + return arg && integer_zerop (arg) ? "(nil)" : "%#zx"; >> +} > > Then again, maybe also just move the hook from linux.c here, it appears > identical. Yes, the glibc and uclibc hooks are the same. I don't know what the convention is for these target hooks (i.e., whether they are expected to be duplicated across targets even if they are the same to reduce the risk of breaking one target as a result of changing another, or whether duplication should be avoided even at this risk). From your comment it sounds like it should be the latter and I'm okay with that. Thanks Martin