From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114457 invoked by alias); 3 Nov 2016 15:39:36 -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 114352 invoked by uid 89); 3 Nov 2016 15:39:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=yc, 2013-11, 201311, UD:y X-HELO: mail-pf0-f193.google.com Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Nov 2016 15:39:24 +0000 Received: by mail-pf0-f193.google.com with SMTP id n85so5168094pfi.3 for ; Thu, 03 Nov 2016 08:39:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=x8dnGuBbSsAOEv6sGK8yGxOHhtt3/C60Cmq8HYbikoQ=; b=Mt6SJPFJqxx6NeYVRetCgC8p/pQxUPNXXwn2YgBmfsUj93pAJIPjlKcDgDsBkHB8ae DhGZx4fFw2WYu/sZhSKorE3a0IX9DcqjmVU6gPW4AYrPPardklHpTXtkdXoGVUKDBOmG ap4JeQilyAfFweKQWTKorO4+N3jQCywcI/GQyB8KiSu6rTbmTKoDFWVFYh22NB+GuoX0 Br6M9Zl5cxuCSXKlG9ZsNDn7NhZm7SBlaDdiSd5NWa6tV6eQr0XniVxdNbCH6NLzLVHG 1BIwHy7niPpjnTwbrJwmI5wQcVES05VGs97Yw1lOFD9UldzyndNV8knsBaL68MaHDtgv 94gw== X-Gm-Message-State: ABUngvfQPITAAI1Uq9dta2/dUa37TjwHHPpHnEiUqnbAhd/0DuYkaTXEbUr73gjK/6LAEA== X-Received: by 10.99.189.1 with SMTP id a1mr14909237pgf.178.1478187563067; Thu, 03 Nov 2016 08:39:23 -0700 (PDT) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id a7sm13612222pfl.87.2016.11.03.08.39.21 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 03 Nov 2016 08:39:22 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] gdb: Require C++11 References: <1477596094-3244-1-git-send-email-palves@redhat.com> <1477596094-3244-3-git-send-email-palves@redhat.com> Date: Thu, 03 Nov 2016 15:39:00 -0000 In-Reply-To: <1477596094-3244-3-git-send-email-palves@redhat.com> (Pedro Alves's message of "Thu, 27 Oct 2016 20:21:34 +0100") Message-ID: <86twbo7eu6.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00056.txt.bz2 Pedro Alves writes: Hi Pedro, > to. The result would be that a make invocation from the build/gdb/ > directory would use "g++ -std=3Dgnu++11" as expected, while a make > invocation at the top level would not. This happens to break the build if bison is not new enough (bison 2.6.4), See details in the patch below, --=20 Yao (=E9=BD=90=E5=B0=A7) =46rom 9a1e3fb73cc1003eef75b895c6035857494f8ee8 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 3 Nov 2016 15:33:13 +0000 Subject: [PATCH] Replace YY_NULL with YY_NULLPTR in LANG-exp.c As we require c++11, GDB fails to build if bison is not new enough. I see the following error on the system (fedora 19) that bison is 2.6.4, g++ -std=3Dgnu++11 .... \ -c -o ada-exp.o -MT ada-exp.o -MMD -MP -MF .deps/ada-exp.Tpo 'if test -f a= da-exp.c; then echo ada-exp.c; else echo ../../binutils-gdb/gdb/ada-exp.c; = fi` In file included from ../../binutils-gdb/gdb/ada-exp.y:731:0: ada-lex.c:113:0: error: "YY_NULL" redefined [-Werror] #define YY_NULL 0 ^ ada-exp.c:158:0: note: this is the location of the previous definition # define YY_NULL nullptr ^ cc1plus: all warnings being treated as errors make: *** [ada-exp.o] Error 1 Both ada-exp.c and ada-lex.c has macro YY_NULL, like this, $ cat 1.c # ifndef YY_NULL # if defined __cplusplus && 201103L <=3D __cplusplus # define YY_NULL nullptr # else # define YY_NULL 0 # endif # endif #define YY_NULL 0 as we can see, YY_NULL is defined differently (nullptr vs 0) $ g++ -std=3Dc++11 -Wall 1.c -c 1.c:9:0: warning: "YY_NULL" redefined #define YY_NULL 0 ^ 1.c:3:0: note: this is the location of the previous definition # define YY_NULL nullptr ^ $ g++ -Wall 1.c -c bison renames YY_NULL to YY_NULLPTR in 2013 Nov, https://lists.gnu.org/archive/html/bison-patches/2013-11/msg00002.html and bison released later than 2013 Nov have this patch. Bison 3.0.2, released on 2013 Dec, is OK. The fix is to replace YY_NULL with YY_NULLPTR via sed. With old bison, YY_NULL becomes YY_NULLPTR; with new bison, YY_NULLPTR becomes YY_NULLPTRPTR, gdb: 2016-11-03 Yao Qi * Makefile.in (.y.c): Replace YY_NULL with YY_NULLPTR. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index d035d8e..6db63c7 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1894,6 +1894,7 @@ po/$(PACKAGE).pot: force -e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \ -e 's/\([ \t;,(]\)free$$/\1xfree/g' \ -e '/^#line.*y.tab.c/d' \ + -e 's/YY_NULL/YY_NULLPTR/g' \ < $@.tmp > $@ rm -f $@.tmp .l.c: