From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51398 invoked by alias); 4 Jun 2018 13:37:47 -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 50353 invoked by uid 89); 4 Jun 2018 13:37:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=concern, H*i:sk:7570b5d, H*f:sk:7570b5d, H*RU:209.85.218.67 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-oi0-f67.google.com Received: from mail-oi0-f67.google.com (HELO mail-oi0-f67.google.com) (209.85.218.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Jun 2018 13:37:44 +0000 Received: by mail-oi0-f67.google.com with SMTP id l22-v6so20695909oib.4; Mon, 04 Jun 2018 06:37:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=mI7ugHinV2OMWYnDNOKLYlmpY2aO6d9tPxni6jmKaOs=; b=IOr84gld1joenK0Sm52/CPvSjVf/gXWfdoJSl/LWq2jRNHJbUbf3cdCJFqGO87EDWM Cr2uZMKzPKsuSPnDThx1sLvWG84ZzMcYilimZbYfRrqmJjp/2wAkKw10ZuKpkuTHi2Fr g49KKjYrU8KiMf7//QOD8t00RrpGso5/ZbReccpD7sfOW/q9C0cPMpvspbAXodPQi1KX 5KKoQ9UiSUPUW6T5le6YQYzdSha9H9cS7+qu3vr5h2LXCVi07CH8u6/c2n7Q+NlVZBGc 0jWOBJDUV9lHCsAGZcmuagT6j57GNEKVRSkvR2zNvOXnxSokLmAZyfnHiPRE0uzXR8th Z9dw== X-Gm-Message-State: ALKqPwfmoWrg9xjbzQUNq2xXmlcs1Q9dIBP/faH1tnWGHoxH6orCtHvA 9gwUKD/rUjdeNEzBvHEvym9zeMIg6rzslxc2BN4= X-Google-Smtp-Source: ADUXVKIbH5oOYTb5PL4d0OoGY97j7C49/dWVc0x2F5zPZt420Z6Z6TwXx5vodOriYezbvIOh0JPA+s6STFWuFTX0mXw= X-Received: by 2002:aca:f545:: with SMTP id t66-v6mr8791405oih.316.1528119462664; Mon, 04 Jun 2018 06:37:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:7019:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 06:37:42 -0700 (PDT) In-Reply-To: <7570b5d9-f6c0-d9c5-3b44-34c130d13b47@redhat.com> References: <20180521121557.16535-1-hjl.tools@gmail.com> <7570b5d9-f6c0-d9c5-3b44-34c130d13b47@redhat.com> From: "H.J. Lu" Date: Mon, 04 Jun 2018 13:37:00 -0000 Message-ID: Subject: Re: [PATCH 1/3] Move gdb/common/diagnostics.h to include/diagnostics.h To: Pedro Alves Cc: John Marshall , "binutils@sourceware.org" , "gdb-patches@sourceware.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00063.txt.bz2 On Mon, Jun 4, 2018 at 6:35 AM, Pedro Alves wrote: > On 06/04/2018 02:12 PM, H.J. Lu wrote: >> On Mon, Jun 4, 2018 at 3:51 AM, John Marshall >> wrote: >>> On 21 May 2018, at 13:15, H dot J dot Lu wrote: >>>> Move gdb/common/diagnostics.h to include/diagnostics.h so that it can >>>> be used in binutils. >>> >>> This patch broke building gdb on MacOS with clang (i.e., after ./config= ure with no options): >>> >>> CXX gdb.o >>> In file included from ../../../binutils-gdb/gdb/gdb.c:19: >>> In file included from ../../../binutils-gdb/gdb/defs.h:531: >>> In file included from ../../../binutils-gdb/gdb/gdbarch.h:39: >>> In file included from ../../../binutils-gdb/gdb/frame.h:72: >>> In file included from ../../../binutils-gdb/gdb/language.h:26: >>> ../../../binutils-gdb/gdb/symtab.h:1361:1: error: _Pragma takes a paren= thesized string literal >>> DEF_VEC_P (symtab_ptr); > > I think clang is printing a bogus location here. symtab.h includes > vec.h, which includes diagnostics.h and does: > > /* clang has a bug that makes it warn (-Wunused-function) about unused fu= nctions > that are the result of the DEF_VEC_* macro expansion. See: > > https://bugs.llvm.org/show_bug.cgi?id=3D22712 > > We specifically ignore this warning for the vec functions when the com= piler > is clang. */ > #ifdef __clang__ > # define DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION \ > DIAGNOSTIC_IGNORE_UNUSED_FUNCTION > #else > # define DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION > #endif > > and that's most certainly what is tripping on the _Pragma+STRINGIFY. > >>> >>>> --- a/gdb/common/diagnostics.h >>>> +++ b/include/diagnostics.h >>>> [snip] >>>> @@ -15,10 +13,8 @@ >>>> You should have received a copy of the GNU General Public License >>>> along with this program. If not, see . */ >>>> >>>> -#ifndef COMMON_DIAGNOSTICS_H >>>> -#define COMMON_DIAGNOSTICS_H >>>> - >>>> -#include "common/preprocessor.h" >>> >>> Putting this #include back fixes the build. Apparently in this configur= ation, include/diagnostics.h doesn't otherwise have a definition of STRINGI= FY whereas on Linux or other platforms it does, via some coincidence of dif= ferent host-related includes or something. >> >> Please add >> >> #include "common/preprocessor.h" >> >> to gdb.c. >> > > I don't think so, see above. > > Where does binutils get the definition of STRINGIFY from? > > Your other patch does: > >> --- a/include/diagnostics.h >> +++ b/include/diagnostics.h >> @@ -19,8 +19,13 @@ >> #ifdef __GNUC__ >> # define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push") >> # define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop") >> + >> +/* Stringification. */ >> +# define DIAGNOSTIC_STRINGIFY_1(x) #x >> +# define DIAGNOSTIC_STRINGIFY(x) DIAGNOSTIC_STRINGIFY_1 (x) >> + >> # define DIAGNOSTIC_IGNORE(option) \ >> - _Pragma (STRINGIFY (GCC diagnostic ignored option)) >> + _Pragma (DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored option)) >> #else > > So I'm surprised by your suggestion. That DIAGNOSTIC_STRINGIFY > bit should be split out of that other patch and pushed in > separately, IMO. Alternatively, preprocessor.h should be shared too. > I pushed my second patch and will submit a follow up patch to address your concern on GCC version. --=20 H.J.