From patchwork Thu Jun 13 08:25:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 33101 Received: (qmail 33059 invoked by alias); 13 Jun 2019 08:25:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 32979 invoked by uid 89); 13 Jun 2019 08:25:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= 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 ESMTP; Thu, 13 Jun 2019 08:25:24 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75C553082A27 for ; Thu, 13 Jun 2019 08:25:23 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 085C4614C8 for ; Thu, 13 Jun 2019 08:25:22 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Fix gdb build with -std=gnu++11 Date: Thu, 13 Jun 2019 09:25:20 +0100 Message-Id: <20190613082520.7359-1-palves@redhat.com> The options framework series broken the build with gcc 4.8, or any other compiler were we end up forcing -std=gnu++11, causing errors like these: ../../binutils-gdb/gdb/compile/compile.c: In function gdb::option::option_def_group make_compile_options_def_group(compile_options*): ../../binutils-gdb/gdb/compile/compile.c:266:44: error: could not convert (const gdb::option::option_def*)(& compile_command_option_defs) from const gdb::option::option_def* to gdb::array_view return {compile_command_option_defs, opts}; ^ CXX copying.o ../../binutils-gdb/gdb/compile/compile.c:267:1: error: control reaches end of non-void function [-Werror=return-type] } ^ This is a C++11 vs C++14 difference -- C++14 relaxed the rules for eliding braces. This commit fixes it by adding the missing (in C++11) braces. Tested with g++ 4.8. gdb/ChangeLog: 2019-06-13 Pedro Alves * compile/compile.c (make_compile_options_def_group): Add braces around array_view initializer. * thread.c (make_thread_apply_all_options_def_group) (make_thread_apply_all_options_def_group): Likewise. --- gdb/ChangeLog | 7 +++++++ gdb/compile/compile.c | 2 +- gdb/thread.c | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 307a84ddae1..029acd14dc9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2019-06-13 Pedro Alves + + * compile/compile.c (make_compile_options_def_group): Add braces + around array_view initializer. + * thread.c (make_thread_apply_all_options_def_group) + (make_thread_apply_all_options_def_group): Likewise. + 2019-06-13 Pedro Alves * NEWS (New commands): Mention "maint test-options diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index b467254fe83..25d0bfe6022 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -263,7 +263,7 @@ static const gdb::option::option_def compile_command_option_defs[] = { static gdb::option::option_def_group make_compile_options_def_group (compile_options *opts) { - return {compile_command_option_defs, opts}; + return {{compile_command_option_defs}, opts}; } /* Handle the input from the 'compile file' command. The "compile diff --git a/gdb/thread.c b/gdb/thread.c index 947427aa046..695572f3fb9 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1531,8 +1531,8 @@ make_thread_apply_all_options_def_group (int *ascending, qcs_flags *flags) { return {{ - { ascending_option_def.def (), ascending}, - { thr_qcs_flags_option_defs, flags }, + { {ascending_option_def.def ()}, ascending}, + { {thr_qcs_flags_option_defs}, flags }, }}; } @@ -1542,7 +1542,7 @@ make_thread_apply_all_options_def_group (int *ascending, static inline gdb::option::option_def_group make_thread_apply_options_def_group (qcs_flags *flags) { - return {thr_qcs_flags_option_defs, flags}; + return {{thr_qcs_flags_option_defs}, flags}; } /* Apply a GDB command to a list of threads. List syntax is a whitespace