gdb: Pass -x c++ to the compiler
authorSimon Marchi <simon.marchi@ericsson.com>
Sat, 17 Jun 2017 21:17:00 +0000 (23:17 +0200)
committerSimon Marchi <simon.marchi@ericsson.com>
Sat, 17 Jun 2017 21:17:00 +0000 (23:17 +0200)
Because we are compiling .c files containing C++ code, clang++ complains
with:

  clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated

If renaming all the source files to .cpp is out of the question, an
alternative is to pass "-x c++" to convince the compiler that we are
really compiling C++.  It works fine with GCC too.

gdb/ChangeLog:

* Makefile.in (COMPILE.pre): Add "-x c++".

gdb/gdbserver/ChangeLog:

* Makefile.in (COMPILE.pre): Add "-x c++".

gdb/ChangeLog
gdb/Makefile.in
gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in

index 9062067bcf828a79de3b248490f6528ab92a2d32..2c4f96e55d217db8190f77853dd4bf928d259049 100644 (file)
@@ -1,3 +1,7 @@
+2017-06-17  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * Makefile.in (COMPILE.pre): Add "-x c++".
+
 2017-06-16  Alan Hayward  <alan.hayward@arm.com>
            Pedro Alves  <palves@redhat.com>
            Yao Qi  <yao.qi@linaro.org>
index 5e5fcaae7abafef67d290227dc3caabc303c6130..153a5dd6fb8817eab3dfeba3cd0dbff523f99c04 100644 (file)
@@ -114,7 +114,7 @@ depcomp = $(SHELL) $(srcdir)/../depcomp
 
 # Note that these are overridden by GNU make-specific code below if
 # GNU make is used.  The overrides implement dependency tracking.
-COMPILE.pre = $(CXX) $(CXX_DIALECT)
+COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
 COMPILE.post = -c -o $@
 COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
index 80240ffe388f7f0709142353d4fd127040ef8891..eef680cb347dfb32e0e8c3bbde28fddc4d57f4fa 100644 (file)
@@ -1,3 +1,7 @@
+2017-06-17  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * Makefile.in (COMPILE.pre): Add "-x c++".
+
 2017-06-09  Sergio Durigan Junior  <sergiodj@redhat.com>
 
        * fork-child.c: Conditionally include <signal.h>.
index 834425dc44ef8566901a48233ea0cfe2331703b5..4a031e165a2ccd1c0eb4a75b563f18a12ef21380 100644 (file)
@@ -65,7 +65,7 @@ depcomp = $(SHELL) $(srcdir)/../depcomp
 
 # Note that these are overridden by GNU make-specific code below if
 # GNU make is used.  The overrides implement dependency tracking.
-COMPILE.pre = $(CXX) $(CXX_DIALECT)
+COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
 COMPILE.post = -c -o $@
 COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
This page took 0.040727 seconds and 4 git commands to generate.