public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Fix build errors in with clang in gdb.compile/compile-cplus.c
Date: Sat, 30 May 2020 04:38:38 -0400	[thread overview]
Message-ID: <678048e8079ace915052f3070b2df97bcaea58d2@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 678048e8079ace915052f3070b2df97bcaea58d2 ***

commit 678048e8079ace915052f3070b2df97bcaea58d2
Author:     Gary Benson <gbenson@redhat.com>
AuthorDate: Fri May 29 17:43:17 2020 +0100
Commit:     Gary Benson <gbenson@redhat.com>
CommitDate: Fri May 29 17:43:17 2020 +0100

    Fix build errors in with clang in gdb.compile/compile-cplus.c
    
    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.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 667dbfddec..d4e7220b32 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-29  Gary Benson <gbenson@redhat.com>
+
+	* gdb.compile/compile-cplus.exp (additional_flags): Also
+	set when building with clang.
+	(additional_flags, srcfilesoptions): Pass -Wno-deprecated
+	when building with clang.
+
 2020-05-29  Gary Benson <gbenson@redhat.com>
 
 	* gdb.arch/i386-avx.exp (additional_flags): Also set when
diff --git a/gdb/testsuite/gdb.compile/compile-cplus.exp b/gdb/testsuite/gdb.compile/compile-cplus.exp
index cca5b20520..85b2f20a8f 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
 }


             reply	other threads:[~2020-05-30  8:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-30  8:38 gdb-buildbot [this message]
2020-05-30  8:38 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot
2020-06-30  7:42 ` Failures on Fedora-i686, " gdb-buildbot
2020-06-30  8:19 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-06-30  8:21 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-06-30  8:53 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-06-30  9:07 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-06-30  9:40 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-06-30  9:44 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-06-30 10:18 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=678048e8079ace915052f3070b2df97bcaea58d2@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).