From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 5D2413987016 for ; Fri, 29 May 2020 16:43:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5D2413987016 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-307-x7gaZP_BPiiv8C5y0Qt8ow-1; Fri, 29 May 2020 12:43:57 -0400 X-MC-Unique: x7gaZP_BPiiv8C5y0Qt8ow-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C11980183C for ; Fri, 29 May 2020 16:43:56 +0000 (UTC) Received: from blade.nx (ovpn-114-240.ams2.redhat.com [10.36.114.240]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F3B27A1ED for ; Fri, 29 May 2020 16:43:56 +0000 (UTC) Received: from blade.com (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 64AEB816CCA9 for ; Fri, 29 May 2020 17:43:55 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [OB PATCH] Fix build errors in with clang in gdb.compile/compile-cplus.c Date: Fri, 29 May 2020 17:43:54 +0100 Message-Id: <1590770634-26360-1-git-send-email-gbenson@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-16.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2020 16:44:00 -0000 Clang fails to compile the file, with the following error: fatal error: 'iostream' file not found This prevents the following testcase from executing: gdb.compile/compile-cplus.exp The testcase sets additional_flags when building with GCC, which this commit causes to also be set when building with clang. This makes the testcase fail to build with a different error: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] so this commit adds -Wno-deprecated in two places to sidestep this. Note that, while allowing the testcase to build, this commit reveals failures when the testsuite is built using clang. gdb/testsuite/ChangeLog: * gdb.compile/compile-cplus.exp (additional_flags): Also set when building with clang. (additional_flags, srcfilesoptions): Pass -Wno-deprecated when building with clang. --- gdb/testsuite/ChangeLog | 7 +++++++ gdb/testsuite/gdb.compile/compile-cplus.exp | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp index cca5b20..85b2f20 100644 --- a/gdb/testsuite/gdb.compile/compile-cplus.exp +++ b/gdb/testsuite/gdb.compile/compile-cplus.exp @@ -19,11 +19,16 @@ standard_testfile .c compile-shlib.c compile-constvar.S compile-nodebug.c get_compiler_info set options {} -if [test_compiler_info gcc*] { +if { [test_compiler_info gcc*] || [test_compiler_info clang*] } { lappend options additional_flags=-g3 lappend options additional_flags=-std=gnu++11 lappend options c++ } +if [test_compiler_info clang*] { + # Treating C input as C++ is deprecated in Clang, so + # the build will fail without disabling -Wdeprecated. + lappend options additional_flags=-Wno-deprecated +} if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { verbose "Skipping x86_64 LOC_CONST test." @@ -34,7 +39,13 @@ set srcfilesoptions [list ${srcfile} ${options}] if { $srcfile3 != "" } { lappend srcfilesoptions $srcfile3 ${options} } -lappend srcfilesoptions $srcfile4 "nodebug c++" +set srcfile4options "nodebug c++" +if [test_compiler_info clang*] { + # Treating C input as C++ is deprecated in Clang, so + # the build will fail without disabling -Wdeprecated. + set srcfile4options "$srcfile4options additional_flags=-Wno-deprecated" +} +lappend srcfilesoptions $srcfile4 $srcfile4options if { [eval build_executable_from_specs ${testfile}.exp $testfile {$options} ${srcfilesoptions}] } { return -1 } -- 1.8.3.1