From cf0dd6f02cd45d6dbb6bd87dde25dd3ed74eb7d0 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 17 Jun 2017 23:17:00 +0200 Subject: [PATCH] gdb: Pass -x c++ to the compiler 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 | 4 ++++ gdb/Makefile.in | 2 +- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/Makefile.in | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9062067bcf8..2c4f96e55d2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-06-17 Simon Marchi + + * Makefile.in (COMPILE.pre): Add "-x c++". + 2017-06-16 Alan Hayward Pedro Alves Yao Qi diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 5e5fcaae7ab..153a5dd6fb8 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -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 diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 80240ffe388..eef680cb347 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2017-06-17 Simon Marchi + + * Makefile.in (COMPILE.pre): Add "-x c++". + 2017-06-09 Sergio Durigan Junior * fork-child.c: Conditionally include . diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 834425dc44e..4a031e165a2 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -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 -- 2.30.2