W/ Clang, compile/link C++ test programs with "-x c++"
authorPedro Alves <palves@redhat.com>
Wed, 24 Jun 2020 22:18:19 +0000 (23:18 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 24 Jun 2020 22:18:19 +0000 (23:18 +0100)
commit221db974e653659edb280787af1b3efdd1615083
tree5fbc91e13f99de13bcb5a78e087f65b33eccc998
parent331733cd4e2f2fe76c0b7b6fdd81e54724572354
W/ Clang, compile/link C++ test programs with "-x c++"

Some testcases want to compile .c files with a C++ compiler.  So they
pass the "c++" option to gdb_compile.  That works fine with GCC, but
with Clang, it results in:

  gdb compile failed, clang-5.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]

and the testcase is skipped with UNTESTED.

A previous patch fixed a case like that in
gdb.compile/compile-cplus.exp, by adding -Wno-deprecated to the build
options.  However, there are other testcases that use the same
pattern, and all fail for the same reason.  For example:

 gdb.base/info-types-c++.exp
 gdb.base/max-depth-c++.exp
 gdb.base/msym-lang.exp
 gdb.base/whatis-ptype-typedefs.exp
 gdb.btrace/rn-dl-bind.exp

Fix this in a central place, within gdb_compile, by passing "-x c++"
to the compiler driver when we're compiling/linking C++.

This revealed that gdb.compile/compile-cplus.exp and
gdb.arch/amd64-entry-value-paramref.exp tests are compiling an
assembly file with the "c++" option, which would now fail to compile,
with the C++ compiler not grokking the assembly, of course.  We just
need to not pass "c++" and all the other related C++ options when
compiling an assembly file.

gdb/testsuite/ChangeLog:
2020-06-24  Pedro Alves  <palves@redhat.com>

* gdb.arch/amd64-entry-value-paramref.exp: Use
prepare_for_testing_full and don't pass "c++" for the .S file
build spec.
* gdb.compile/compile-cplus.exp: Don't compile $srcfile3 with
$options, since it's an assembly file.  Remove -Wno-deprecated.
* lib/gdb.exp (gdb_compile): Pass "-x c++" explicitly when
compiling C++ programs.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp
gdb/testsuite/gdb.compile/compile-cplus.exp
gdb/testsuite/lib/gdb.exp
This page took 0.025446 seconds and 4 git commands to generate.