[1/2] gdbsupport: rename source files to .cc

Message ID 20200212225340.28865-1-simon.marchi@efficios.com
State New
Headers show
Series
  • [1/2] gdbsupport: rename source files to .cc
Related show

Commit Message

Simon Marchi Feb. 12, 2020, 10:53 p.m.
This patch renames the .c source files in gdbsupport to .cc.

In the gdb directory, there is an argument against renaming the source
files, which is that it makes using some git commands more difficult to
do archeology.  Some commands have some kind of "follow" option that
makes git try to follow renames, but it doesn't work in all situations.

Given that we have just moved the gdbsupport directory, that argument
doesn't hold for source files in that directory.  I therefore suggest
renaming them to .cc, so that they are automatically recognized as C++
by various tools and editors.

The original motivation behind this is that when building gdbsupport
with clang, I get:

      CC       agent.o
    clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

In the gdb/ directory, we make clang happy by passing "-x c++".  We
could do this in gdbsupport too, but I think that renaming the files is
a better long-term solution.

gdbserver still does its own build of gdbsupport, so a few changes in
its Makefile are necessary.

gdbsupport/ChangeLog:

	* Makefile.am: Rename source files from .c to .cc.
	* Makefile.in: Re-generate.
	* %.c: Rename to %.cc.

gdbserver/ChangeLog:

	* Makefile.in: Rename gdbsupport source files from .c to .cc.
---
 gdbserver/Makefile.in                         |  56 ++++----
 gdbsupport/Makefile.am                        |  68 +++++-----
 gdbsupport/Makefile.in                        | 121 +++++++++---------
 gdbsupport/{agent.c => agent.cc}              |   0
 .../{btrace-common.c => btrace-common.cc}     |   0
 gdbsupport/{buffer.c => buffer.cc}            |   0
 gdbsupport/{cleanups.c => cleanups.cc}        |   0
 .../{common-debug.c => common-debug.cc}       |   0
 ...mmon-exceptions.c => common-exceptions.cc} |   0
 .../{common-inferior.c => common-inferior.cc} |   0
 .../{common-regcache.c => common-regcache.cc} |   0
 .../{common-utils.c => common-utils.cc}       |   0
 gdbsupport/{environ.c => environ.cc}          |   0
 gdbsupport/{errors.c => errors.cc}            |   0
 gdbsupport/{fileio.c => fileio.cc}            |   0
 gdbsupport/{filestuff.c => filestuff.cc}      |   0
 gdbsupport/{format.c => format.cc}            |   0
 gdbsupport/{gdb-dlfcn.c => gdb-dlfcn.cc}      |   0
 ...gdb_tilde_expand.c => gdb_tilde_expand.cc} |   0
 gdbsupport/{gdb_vecs.c => gdb_vecs.cc}        |   0
 gdbsupport/{gdb_wait.c => gdb_wait.cc}        |   0
 gdbsupport/{job-control.c => job-control.cc}  |   0
 gdbsupport/{netstuff.c => netstuff.cc}        |   0
 gdbsupport/{new-op.c => new-op.cc}            |   0
 gdbsupport/{pathstuff.c => pathstuff.cc}      |   0
 gdbsupport/{print-utils.c => print-utils.cc}  |   0
 gdbsupport/{ptid.c => ptid.cc}                |   0
 gdbsupport/{rsp-low.c => rsp-low.cc}          |   0
 .../{run-time-clock.c => run-time-clock.cc}   |   0
 .../{safe-strerror.c => safe-strerror.cc}     |   0
 gdbsupport/{scoped_mmap.c => scoped_mmap.cc}  |   0
 gdbsupport/{selftest.c => selftest.cc}        |   0
 ...estore.c => signals-state-save-restore.cc} |   0
 gdbsupport/{signals.c => signals.cc}          |   0
 gdbsupport/{tdesc.c => tdesc.cc}              |   0
 gdbsupport/{thread-pool.c => thread-pool.cc}  |   0
 gdbsupport/{xml-utils.c => xml-utils.cc}      |   0
 37 files changed, 123 insertions(+), 122 deletions(-)
 rename gdbsupport/{agent.c => agent.cc} (100%)
 rename gdbsupport/{btrace-common.c => btrace-common.cc} (100%)
 rename gdbsupport/{buffer.c => buffer.cc} (100%)
 rename gdbsupport/{cleanups.c => cleanups.cc} (100%)
 rename gdbsupport/{common-debug.c => common-debug.cc} (100%)
 rename gdbsupport/{common-exceptions.c => common-exceptions.cc} (100%)
 rename gdbsupport/{common-inferior.c => common-inferior.cc} (100%)
 rename gdbsupport/{common-regcache.c => common-regcache.cc} (100%)
 rename gdbsupport/{common-utils.c => common-utils.cc} (100%)
 rename gdbsupport/{environ.c => environ.cc} (100%)
 rename gdbsupport/{errors.c => errors.cc} (100%)
 rename gdbsupport/{fileio.c => fileio.cc} (100%)
 rename gdbsupport/{filestuff.c => filestuff.cc} (100%)
 rename gdbsupport/{format.c => format.cc} (100%)
 rename gdbsupport/{gdb-dlfcn.c => gdb-dlfcn.cc} (100%)
 rename gdbsupport/{gdb_tilde_expand.c => gdb_tilde_expand.cc} (100%)
 rename gdbsupport/{gdb_vecs.c => gdb_vecs.cc} (100%)
 rename gdbsupport/{gdb_wait.c => gdb_wait.cc} (100%)
 rename gdbsupport/{job-control.c => job-control.cc} (100%)
 rename gdbsupport/{netstuff.c => netstuff.cc} (100%)
 rename gdbsupport/{new-op.c => new-op.cc} (100%)
 rename gdbsupport/{pathstuff.c => pathstuff.cc} (100%)
 rename gdbsupport/{print-utils.c => print-utils.cc} (100%)
 rename gdbsupport/{ptid.c => ptid.cc} (100%)
 rename gdbsupport/{rsp-low.c => rsp-low.cc} (100%)
 rename gdbsupport/{run-time-clock.c => run-time-clock.cc} (100%)
 rename gdbsupport/{safe-strerror.c => safe-strerror.cc} (100%)
 rename gdbsupport/{scoped_mmap.c => scoped_mmap.cc} (100%)
 rename gdbsupport/{selftest.c => selftest.cc} (100%)
 rename gdbsupport/{signals-state-save-restore.c => signals-state-save-restore.cc} (100%)
 rename gdbsupport/{signals.c => signals.cc} (100%)
 rename gdbsupport/{tdesc.c => tdesc.cc} (100%)
 rename gdbsupport/{thread-pool.c => thread-pool.cc} (100%)
 rename gdbsupport/{xml-utils.c => xml-utils.cc} (100%)

-- 
2.25.0

Comments

Tom Tromey Feb. 13, 2020, 2:04 p.m. | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:


Simon> This patch renames the .c source files in gdbsupport to .cc.

I support this change.

Note that this would let us remove these hacks from gdbsupport/Makefile.am:

override CXX += $(CXX_DIALECT)

override CC := $(CXX)
override CFLAGS := $(CXXFLAGS)

AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)


The CC and CFLAGS settings can be removed entirely.  AM_CFLAGS can be
renamed to AM_CXXFLAGS, and the CXX_DIALECT can be put there.

thanks,
Tom
Simon Marchi Feb. 13, 2020, 2:41 p.m. | #2
On 2020-02-13 9:04 a.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

> 

> Simon> This patch renames the .c source files in gdbsupport to .cc.

> 

> I support this change.

> 

> Note that this would let us remove these hacks from gdbsupport/Makefile.am:

> 

> override CXX += $(CXX_DIALECT)

> 

> override CC := $(CXX)

> override CFLAGS := $(CXXFLAGS)

> 

> AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

> 

> 

> The CC and CFLAGS settings can be removed entirely.  AM_CFLAGS can be

> renamed to AM_CXXFLAGS, and the CXX_DIALECT can be put there.

> 

> thanks,

> Tom

> 


Of course, here's the revised patch.

Actually, the AM_CFLAGS -> AM_CXXFLAGS change is necessary, otherwise the warning
flags are not applied at all.


From 9e024473dd550a7d272c68d94e8d859be830768d Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@efficios.com>

Date: Wed, 12 Feb 2020 16:10:10 -0500
Subject: [PATCH] gdbsupport: rename source files to .cc

This patch renames the .c source files in gdbsupport to .cc.

In the gdb directory, there is an argument against renaming the source
files, which is that it makes using some git commands more difficult to
do archeology.  Some commands have some kind of "follow" option that
makes git try to follow renames, but it doesn't work in all situations.

Given that we have just moved the gdbsupport directory, that argument
doesn't hold for source files in that directory.  I therefore suggest
renaming them to .cc, so that they are automatically recognized as C++
by various tools and editors.

The original motivation behind this is that when building gdbsupport
with clang, I get:

      CC       agent.o
    clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

In the gdb/ directory, we make clang happy by passing "-x c++".  We
could do this in gdbsupport too, but I think that renaming the files is
a better long-term solution.

gdbserver still does its own build of gdbsupport, so a few changes in
its Makefile are necessary.

gdbsupport/ChangeLog:

	* Makefile.am: Rename source files from .c to .cc.
	* Makefile.in: Re-generate.
	* %.c: Rename to %.cc.

gdbserver/ChangeLog:

	* Makefile.in: Rename gdbsupport source files from .c to .cc.
---
 gdbserver/Makefile.in                         |  56 ++++----
 gdbsupport/Makefile.am                        |  75 +++++------
 gdbsupport/Makefile.in                        | 126 +++++++++---------
 gdbsupport/{agent.c => agent.cc}              |   0
 .../{btrace-common.c => btrace-common.cc}     |   0
 gdbsupport/{buffer.c => buffer.cc}            |   0
 gdbsupport/{cleanups.c => cleanups.cc}        |   0
 .../{common-debug.c => common-debug.cc}       |   0
 ...mmon-exceptions.c => common-exceptions.cc} |   0
 .../{common-inferior.c => common-inferior.cc} |   0
 .../{common-regcache.c => common-regcache.cc} |   0
 .../{common-utils.c => common-utils.cc}       |   0
 gdbsupport/{environ.c => environ.cc}          |   0
 gdbsupport/{errors.c => errors.cc}            |   0
 gdbsupport/{fileio.c => fileio.cc}            |   0
 gdbsupport/{filestuff.c => filestuff.cc}      |   0
 gdbsupport/{format.c => format.cc}            |   0
 gdbsupport/{gdb-dlfcn.c => gdb-dlfcn.cc}      |   0
 ...gdb_tilde_expand.c => gdb_tilde_expand.cc} |   0
 gdbsupport/{gdb_vecs.c => gdb_vecs.cc}        |   0
 gdbsupport/{gdb_wait.c => gdb_wait.cc}        |   0
 gdbsupport/{job-control.c => job-control.cc}  |   0
 gdbsupport/{netstuff.c => netstuff.cc}        |   0
 gdbsupport/{new-op.c => new-op.cc}            |   0
 gdbsupport/{pathstuff.c => pathstuff.cc}      |   0
 gdbsupport/{print-utils.c => print-utils.cc}  |   0
 gdbsupport/{ptid.c => ptid.cc}                |   0
 gdbsupport/{rsp-low.c => rsp-low.cc}          |   0
 .../{run-time-clock.c => run-time-clock.cc}   |   0
 .../{safe-strerror.c => safe-strerror.cc}     |   0
 gdbsupport/{scoped_mmap.c => scoped_mmap.cc}  |   0
 gdbsupport/{selftest.c => selftest.cc}        |   0
 ...estore.c => signals-state-save-restore.cc} |   0
 gdbsupport/{signals.c => signals.cc}          |   0
 gdbsupport/{tdesc.c => tdesc.cc}              |   0
 gdbsupport/{thread-pool.c => thread-pool.cc}  |   0
 gdbsupport/{xml-utils.c => xml-utils.cc}      |   0
 37 files changed, 124 insertions(+), 133 deletions(-)
 rename gdbsupport/{agent.c => agent.cc} (100%)
 rename gdbsupport/{btrace-common.c => btrace-common.cc} (100%)
 rename gdbsupport/{buffer.c => buffer.cc} (100%)
 rename gdbsupport/{cleanups.c => cleanups.cc} (100%)
 rename gdbsupport/{common-debug.c => common-debug.cc} (100%)
 rename gdbsupport/{common-exceptions.c => common-exceptions.cc} (100%)
 rename gdbsupport/{common-inferior.c => common-inferior.cc} (100%)
 rename gdbsupport/{common-regcache.c => common-regcache.cc} (100%)
 rename gdbsupport/{common-utils.c => common-utils.cc} (100%)
 rename gdbsupport/{environ.c => environ.cc} (100%)
 rename gdbsupport/{errors.c => errors.cc} (100%)
 rename gdbsupport/{fileio.c => fileio.cc} (100%)
 rename gdbsupport/{filestuff.c => filestuff.cc} (100%)
 rename gdbsupport/{format.c => format.cc} (100%)
 rename gdbsupport/{gdb-dlfcn.c => gdb-dlfcn.cc} (100%)
 rename gdbsupport/{gdb_tilde_expand.c => gdb_tilde_expand.cc} (100%)
 rename gdbsupport/{gdb_vecs.c => gdb_vecs.cc} (100%)
 rename gdbsupport/{gdb_wait.c => gdb_wait.cc} (100%)
 rename gdbsupport/{job-control.c => job-control.cc} (100%)
 rename gdbsupport/{netstuff.c => netstuff.cc} (100%)
 rename gdbsupport/{new-op.c => new-op.cc} (100%)
 rename gdbsupport/{pathstuff.c => pathstuff.cc} (100%)
 rename gdbsupport/{print-utils.c => print-utils.cc} (100%)
 rename gdbsupport/{ptid.c => ptid.cc} (100%)
 rename gdbsupport/{rsp-low.c => rsp-low.cc} (100%)
 rename gdbsupport/{run-time-clock.c => run-time-clock.cc} (100%)
 rename gdbsupport/{safe-strerror.c => safe-strerror.cc} (100%)
 rename gdbsupport/{scoped_mmap.c => scoped_mmap.cc} (100%)
 rename gdbsupport/{selftest.c => selftest.cc} (100%)
 rename gdbsupport/{signals-state-save-restore.c => signals-state-save-restore.cc} (100%)
 rename gdbsupport/{signals.c => signals.cc} (100%)
 rename gdbsupport/{tdesc.c => tdesc.cc} (100%)
 rename gdbsupport/{thread-pool.c => thread-pool.cc} (100%)
 rename gdbsupport/{xml-utils.c => xml-utils.cc} (100%)

diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index 60a52d3412b9..d912a0babef9 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -207,32 +207,32 @@ SFILES = \
 	$(srcdir)/../gdb/arch/arm-get-next-pcs.c \
 	$(srcdir)/../gdb/arch/arm-linux.c \
 	$(srcdir)/../gdb/arch/ppc-linux-common.c \
-	$(srcdir)/../gdbsupport/btrace-common.c \
-	$(srcdir)/../gdbsupport/buffer.c \
-	$(srcdir)/../gdbsupport/cleanups.c \
-	$(srcdir)/../gdbsupport/common-debug.c \
-	$(srcdir)/../gdbsupport/common-exceptions.c \
-	$(srcdir)/../gdbsupport/common-inferior.c \
-	$(srcdir)/../gdbsupport/common-regcache.c \
-	$(srcdir)/../gdbsupport/common-utils.c \
-	$(srcdir)/../gdbsupport/errors.c \
-	$(srcdir)/../gdbsupport/environ.c \
-	$(srcdir)/../gdbsupport/fileio.c \
-	$(srcdir)/../gdbsupport/filestuff.c \
-	$(srcdir)/../gdbsupport/job-control.c \
-	$(srcdir)/../gdbsupport/gdb-dlfcn.c \
-	$(srcdir)/../gdbsupport/gdb_tilde_expand.c \
-	$(srcdir)/../gdbsupport/gdb_vecs.c \
-	$(srcdir)/../gdbsupport/gdb_wait.c \
-	$(srcdir)/../gdbsupport/netstuff.c \
-	$(srcdir)/../gdbsupport/new-op.c \
-	$(srcdir)/../gdbsupport/pathstuff.c \
-	$(srcdir)/../gdbsupport/print-utils.c \
-	$(srcdir)/../gdbsupport/ptid.c \
-	$(srcdir)/../gdbsupport/rsp-low.c \
-	$(srcdir)/../gdbsupport/safe-strerror.c \
-	$(srcdir)/../gdbsupport/tdesc.c \
-	$(srcdir)/../gdbsupport/xml-utils.c \
+	$(srcdir)/../gdbsupport/btrace-common.cc \
+	$(srcdir)/../gdbsupport/buffer.cc \
+	$(srcdir)/../gdbsupport/cleanups.cc \
+	$(srcdir)/../gdbsupport/common-debug.cc \
+	$(srcdir)/../gdbsupport/common-exceptions.cc \
+	$(srcdir)/../gdbsupport/common-inferior.cc \
+	$(srcdir)/../gdbsupport/common-regcache.cc \
+	$(srcdir)/../gdbsupport/common-utils.cc \
+	$(srcdir)/../gdbsupport/errors.cc \
+	$(srcdir)/../gdbsupport/environ.cc \
+	$(srcdir)/../gdbsupport/fileio.cc \
+	$(srcdir)/../gdbsupport/filestuff.cc \
+	$(srcdir)/../gdbsupport/job-control.cc \
+	$(srcdir)/../gdbsupport/gdb-dlfcn.cc \
+	$(srcdir)/../gdbsupport/gdb_tilde_expand.cc \
+	$(srcdir)/../gdbsupport/gdb_vecs.cc \
+	$(srcdir)/../gdbsupport/gdb_wait.cc \
+	$(srcdir)/../gdbsupport/netstuff.cc \
+	$(srcdir)/../gdbsupport/new-op.cc \
+	$(srcdir)/../gdbsupport/pathstuff.cc \
+	$(srcdir)/../gdbsupport/print-utils.cc \
+	$(srcdir)/../gdbsupport/ptid.cc \
+	$(srcdir)/../gdbsupport/rsp-low.cc \
+	$(srcdir)/../gdbsupport/safe-strerror.cc \
+	$(srcdir)/../gdbsupport/tdesc.cc \
+	$(srcdir)/../gdbsupport/xml-utils.cc \
 	$(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \
 	$(srcdir)/../gdb/nat/linux-btrace.c \
 	$(srcdir)/../gdb/nat/linux-namespaces.c \
@@ -600,7 +600,7 @@ arch/%-ipa.o: ../gdb/arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)

-gdbsupport/%-ipa.o: ../gdbsupport/%.c
+gdbsupport/%-ipa.o: ../gdbsupport/%.cc
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)

@@ -633,7 +633,7 @@ arch/%.o: ../gdb/arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)

-gdbsupport/%.o: ../gdbsupport/%.c
+gdbsupport/%.o: ../gdbsupport/%.cc
 	$(COMPILE) $<
 	$(POSTCOMPILE)

diff --git a/gdbsupport/Makefile.am b/gdbsupport/Makefile.am
index cd7b0adf6b4c..0e997cf2cc08 100644
--- a/gdbsupport/Makefile.am
+++ b/gdbsupport/Makefile.am
@@ -24,53 +24,48 @@ AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \
     -I../gnulib/import -I$(srcdir)/../gnulib/import \
     -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd

-override CXX += $(CXX_DIALECT)
-
-override CC := $(CXX)
-override CFLAGS := $(CXXFLAGS)
-
-AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+AM_CXXFLAGS = $(CXX_DIALECT) $(WARN_CFLAGS) $(WERROR_CFLAGS)

 noinst_LIBRARIES = libgdbsupport.a

 if SELFTEST
-selftest = selftest.c
+selftest = selftest.cc
 endif

 libgdbsupport_a_SOURCES = \
-    agent.c \
-    btrace-common.c \
-    buffer.c \
-    cleanups.c \
-    common-debug.c \
-    common-exceptions.c	\
-    common-inferior.c \
-    common-regcache.c \
-    common-utils.c \
-    environ.c \
-    errors.c \
-    fileio.c \
-    filestuff.c	\
-    format.c \
-    gdb-dlfcn.c	\
-    gdb_tilde_expand.c \
-    gdb_wait.c \
-    gdb_vecs.c \
-    job-control.c \
-    netstuff.c \
-    new-op.c \
-    pathstuff.c	\
-    print-utils.c \
-    ptid.c \
-    rsp-low.c \
-    run-time-clock.c \
-    safe-strerror.c \
-    scoped_mmap.c \
-    signals.c \
-    signals-state-save-restore.c \
-    tdesc.c \
-    thread-pool.c \
-    xml-utils.c	\
+    agent.cc \
+    btrace-common.cc \
+    buffer.cc \
+    cleanups.cc \
+    common-debug.cc \
+    common-exceptions.cc \
+    common-inferior.cc \
+    common-regcache.cc \
+    common-utils.cc \
+    environ.cc \
+    errors.cc \
+    fileio.cc \
+    filestuff.cc \
+    format.cc \
+    gdb-dlfcn.cc \
+    gdb_tilde_expand.cc \
+    gdb_wait.cc \
+    gdb_vecs.cc \
+    job-control.cc \
+    netstuff.cc \
+    new-op.cc \
+    pathstuff.cc \
+    print-utils.cc \
+    ptid.cc \
+    rsp-low.cc \
+    run-time-clock.cc \
+    safe-strerror.cc \
+    scoped_mmap.cc \
+    signals.cc \
+    signals-state-save-restore.cc \
+    tdesc.cc \
+    thread-pool.cc \
+    xml-utils.cc \
     $(selftest)

 # Double-check that no defines are missing from our configury.
diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in
index be4d53545311..4e12354598be 100644
--- a/gdbsupport/Makefile.in
+++ b/gdbsupport/Makefile.in
@@ -177,18 +177,19 @@ DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/../depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 =
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 =
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+	-o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 =
 SOURCES = $(libgdbsupport_a_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
@@ -353,50 +354,50 @@ AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \
     -I../gnulib/import -I$(srcdir)/../gnulib/import \
     -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd

-AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+AM_CXXFLAGS = $(CXX_DIALECT) $(WARN_CFLAGS) $(WERROR_CFLAGS)
 noinst_LIBRARIES = libgdbsupport.a
-@SELFTEST_TRUE@selftest = selftest.c
+@SELFTEST_TRUE@selftest = selftest.cc
 libgdbsupport_a_SOURCES = \
-    agent.c \
-    btrace-common.c \
-    buffer.c \
-    cleanups.c \
-    common-debug.c \
-    common-exceptions.c	\
-    common-inferior.c \
-    common-regcache.c \
-    common-utils.c \
-    environ.c \
-    errors.c \
-    fileio.c \
-    filestuff.c	\
-    format.c \
-    gdb-dlfcn.c	\
-    gdb_tilde_expand.c \
-    gdb_wait.c \
-    gdb_vecs.c \
-    job-control.c \
-    netstuff.c \
-    new-op.c \
-    pathstuff.c	\
-    print-utils.c \
-    ptid.c \
-    rsp-low.c \
-    run-time-clock.c \
-    safe-strerror.c \
-    scoped_mmap.c \
-    signals.c \
-    signals-state-save-restore.c \
-    tdesc.c \
-    thread-pool.c \
-    xml-utils.c	\
+    agent.cc \
+    btrace-common.cc \
+    buffer.cc \
+    cleanups.cc \
+    common-debug.cc \
+    common-exceptions.cc \
+    common-inferior.cc \
+    common-regcache.cc \
+    common-utils.cc \
+    environ.cc \
+    errors.cc \
+    fileio.cc \
+    filestuff.cc \
+    format.cc \
+    gdb-dlfcn.cc \
+    gdb_tilde_expand.cc \
+    gdb_wait.cc \
+    gdb_vecs.cc \
+    job-control.cc \
+    netstuff.cc \
+    new-op.cc \
+    pathstuff.cc \
+    print-utils.cc \
+    ptid.cc \
+    rsp-low.cc \
+    run-time-clock.cc \
+    safe-strerror.cc \
+    scoped_mmap.cc \
+    signals.cc \
+    signals-state-save-restore.cc \
+    tdesc.cc \
+    thread-pool.cc \
+    xml-utils.cc \
     $(selftest)

 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am

 .SUFFIXES:
-.SUFFIXES: .c .o .obj
+.SUFFIXES: .cc .o .obj
 am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
@@ -495,19 +496,19 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread-pool.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml-utils.Po@am__quote@

-.c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+.cc.o:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<

-.c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+.cc.obj:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`

 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -692,11 +693,6 @@ uninstall-am:
 .PRECIOUS: Makefile


-override CXX += $(CXX_DIALECT)
-
-override CC := $(CXX)
-override CFLAGS := $(CXXFLAGS)
-
 # Double-check that no defines are missing from our configury.
 check-defines:
 	cd $(srcdir) && emacs --script check-defines.el
diff --git a/gdbsupport/agent.c b/gdbsupport/agent.cc
similarity index 100%
rename from gdbsupport/agent.c
rename to gdbsupport/agent.cc
diff --git a/gdbsupport/btrace-common.c b/gdbsupport/btrace-common.cc
similarity index 100%
rename from gdbsupport/btrace-common.c
rename to gdbsupport/btrace-common.cc
diff --git a/gdbsupport/buffer.c b/gdbsupport/buffer.cc
similarity index 100%
rename from gdbsupport/buffer.c
rename to gdbsupport/buffer.cc
diff --git a/gdbsupport/cleanups.c b/gdbsupport/cleanups.cc
similarity index 100%
rename from gdbsupport/cleanups.c
rename to gdbsupport/cleanups.cc
diff --git a/gdbsupport/common-debug.c b/gdbsupport/common-debug.cc
similarity index 100%
rename from gdbsupport/common-debug.c
rename to gdbsupport/common-debug.cc
diff --git a/gdbsupport/common-exceptions.c b/gdbsupport/common-exceptions.cc
similarity index 100%
rename from gdbsupport/common-exceptions.c
rename to gdbsupport/common-exceptions.cc
diff --git a/gdbsupport/common-inferior.c b/gdbsupport/common-inferior.cc
similarity index 100%
rename from gdbsupport/common-inferior.c
rename to gdbsupport/common-inferior.cc
diff --git a/gdbsupport/common-regcache.c b/gdbsupport/common-regcache.cc
similarity index 100%
rename from gdbsupport/common-regcache.c
rename to gdbsupport/common-regcache.cc
diff --git a/gdbsupport/common-utils.c b/gdbsupport/common-utils.cc
similarity index 100%
rename from gdbsupport/common-utils.c
rename to gdbsupport/common-utils.cc
diff --git a/gdbsupport/environ.c b/gdbsupport/environ.cc
similarity index 100%
rename from gdbsupport/environ.c
rename to gdbsupport/environ.cc
diff --git a/gdbsupport/errors.c b/gdbsupport/errors.cc
similarity index 100%
rename from gdbsupport/errors.c
rename to gdbsupport/errors.cc
diff --git a/gdbsupport/fileio.c b/gdbsupport/fileio.cc
similarity index 100%
rename from gdbsupport/fileio.c
rename to gdbsupport/fileio.cc
diff --git a/gdbsupport/filestuff.c b/gdbsupport/filestuff.cc
similarity index 100%
rename from gdbsupport/filestuff.c
rename to gdbsupport/filestuff.cc
diff --git a/gdbsupport/format.c b/gdbsupport/format.cc
similarity index 100%
rename from gdbsupport/format.c
rename to gdbsupport/format.cc
diff --git a/gdbsupport/gdb-dlfcn.c b/gdbsupport/gdb-dlfcn.cc
similarity index 100%
rename from gdbsupport/gdb-dlfcn.c
rename to gdbsupport/gdb-dlfcn.cc
diff --git a/gdbsupport/gdb_tilde_expand.c b/gdbsupport/gdb_tilde_expand.cc
similarity index 100%
rename from gdbsupport/gdb_tilde_expand.c
rename to gdbsupport/gdb_tilde_expand.cc
diff --git a/gdbsupport/gdb_vecs.c b/gdbsupport/gdb_vecs.cc
similarity index 100%
rename from gdbsupport/gdb_vecs.c
rename to gdbsupport/gdb_vecs.cc
diff --git a/gdbsupport/gdb_wait.c b/gdbsupport/gdb_wait.cc
similarity index 100%
rename from gdbsupport/gdb_wait.c
rename to gdbsupport/gdb_wait.cc
diff --git a/gdbsupport/job-control.c b/gdbsupport/job-control.cc
similarity index 100%
rename from gdbsupport/job-control.c
rename to gdbsupport/job-control.cc
diff --git a/gdbsupport/netstuff.c b/gdbsupport/netstuff.cc
similarity index 100%
rename from gdbsupport/netstuff.c
rename to gdbsupport/netstuff.cc
diff --git a/gdbsupport/new-op.c b/gdbsupport/new-op.cc
similarity index 100%
rename from gdbsupport/new-op.c
rename to gdbsupport/new-op.cc
diff --git a/gdbsupport/pathstuff.c b/gdbsupport/pathstuff.cc
similarity index 100%
rename from gdbsupport/pathstuff.c
rename to gdbsupport/pathstuff.cc
diff --git a/gdbsupport/print-utils.c b/gdbsupport/print-utils.cc
similarity index 100%
rename from gdbsupport/print-utils.c
rename to gdbsupport/print-utils.cc
diff --git a/gdbsupport/ptid.c b/gdbsupport/ptid.cc
similarity index 100%
rename from gdbsupport/ptid.c
rename to gdbsupport/ptid.cc
diff --git a/gdbsupport/rsp-low.c b/gdbsupport/rsp-low.cc
similarity index 100%
rename from gdbsupport/rsp-low.c
rename to gdbsupport/rsp-low.cc
diff --git a/gdbsupport/run-time-clock.c b/gdbsupport/run-time-clock.cc
similarity index 100%
rename from gdbsupport/run-time-clock.c
rename to gdbsupport/run-time-clock.cc
diff --git a/gdbsupport/safe-strerror.c b/gdbsupport/safe-strerror.cc
similarity index 100%
rename from gdbsupport/safe-strerror.c
rename to gdbsupport/safe-strerror.cc
diff --git a/gdbsupport/scoped_mmap.c b/gdbsupport/scoped_mmap.cc
similarity index 100%
rename from gdbsupport/scoped_mmap.c
rename to gdbsupport/scoped_mmap.cc
diff --git a/gdbsupport/selftest.c b/gdbsupport/selftest.cc
similarity index 100%
rename from gdbsupport/selftest.c
rename to gdbsupport/selftest.cc
diff --git a/gdbsupport/signals-state-save-restore.c b/gdbsupport/signals-state-save-restore.cc
similarity index 100%
rename from gdbsupport/signals-state-save-restore.c
rename to gdbsupport/signals-state-save-restore.cc
diff --git a/gdbsupport/signals.c b/gdbsupport/signals.cc
similarity index 100%
rename from gdbsupport/signals.c
rename to gdbsupport/signals.cc
diff --git a/gdbsupport/tdesc.c b/gdbsupport/tdesc.cc
similarity index 100%
rename from gdbsupport/tdesc.c
rename to gdbsupport/tdesc.cc
diff --git a/gdbsupport/thread-pool.c b/gdbsupport/thread-pool.cc
similarity index 100%
rename from gdbsupport/thread-pool.c
rename to gdbsupport/thread-pool.cc
diff --git a/gdbsupport/xml-utils.c b/gdbsupport/xml-utils.cc
similarity index 100%
rename from gdbsupport/xml-utils.c
rename to gdbsupport/xml-utils.cc
-- 
2.25.0
Pedro Alves Feb. 13, 2020, 6:33 p.m. | #3
On 2/13/20 2:04 PM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

> 

> Simon> This patch renames the .c source files in gdbsupport to .cc.

> 

> I support this change.

> 

> Note that this would let us remove these hacks from gdbsupport/Makefile.am:

> 

> override CXX += $(CXX_DIALECT)

> 

> override CC := $(CXX)

> override CFLAGS := $(CXXFLAGS)

> 

> AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

> 

> 

> The CC and CFLAGS settings can be removed entirely.  AM_CFLAGS can be

> renamed to AM_CXXFLAGS, and the CXX_DIALECT can be put there.


I had preferred overriding CXX instead of CXXFLAGS for the reasons
explained at [1] [2].  Sounds like that defeats it.

[1] https://sourceware.org/ml/gdb-patches/2020-01/msg00453.html
[2] https://sourceware.org/ml/gdb-patches/2020-01/msg00460.html

Thanks,
Pedro Alves
Simon Marchi Feb. 13, 2020, 9:22 p.m. | #4
On 2020-02-13 1:33 p.m., Pedro Alves wrote:
> On 2/13/20 2:04 PM, Tom Tromey wrote:

>>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

>>

>> Simon> This patch renames the .c source files in gdbsupport to .cc.

>>

>> I support this change.

>>

>> Note that this would let us remove these hacks from gdbsupport/Makefile.am:

>>

>> override CXX += $(CXX_DIALECT)

>>

>> override CC := $(CXX)

>> override CFLAGS := $(CXXFLAGS)

>>

>> AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

>>

>>

>> The CC and CFLAGS settings can be removed entirely.  AM_CFLAGS can be

>> renamed to AM_CXXFLAGS, and the CXX_DIALECT can be put there.

> 

> I had preferred overriding CXX instead of CXXFLAGS for the reasons

> explained at [1] [2].  Sounds like that defeats it.

> 

> [1] https://sourceware.org/ml/gdb-patches/2020-01/msg00453.html

> [2] https://sourceware.org/ml/gdb-patches/2020-01/msg00460.html

> 

> Thanks,

> Pedro Alves

> 


No problem.  Here's the updated patch.

Given that you have not commented on it, I presume you don't object to renaming these files?


From 9fd1aad643992cc3439e022e166807e7af121b1c Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@efficios.com>

Date: Wed, 12 Feb 2020 16:10:10 -0500
Subject: [PATCH] gdbsupport: rename source files to .cc

This patch renames the .c source files in gdbsupport to .cc.

In the gdb directory, there is an argument against renaming the source
files, which is that it makes using some git commands more difficult to
do archeology.  Some commands have some kind of "follow" option that
makes git try to follow renames, but it doesn't work in all situations.

Given that we have just moved the gdbsupport directory, that argument
doesn't hold for source files in that directory.  I therefore suggest
renaming them to .cc, so that they are automatically recognized as C++
by various tools and editors.

The original motivation behind this is that when building gdbsupport
with clang, I get:

      CC       agent.o
    clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

In the gdb/ directory, we make clang happy by passing "-x c++".  We
could do this in gdbsupport too, but I think that renaming the files is
a better long-term solution.

gdbserver still does its own build of gdbsupport, so a few changes in
its Makefile are necessary.

gdbsupport/ChangeLog:

	* Makefile.am: Rename source files from .c to .cc.
	(CC, CFLAGS): Don't override.
	(AM_CFLAGS): Rename to ...
	(AM_CXXFLAGS): ... this.
	* Makefile.in: Re-generate.
	* %.c: Rename to %.cc.

gdbserver/ChangeLog:

	* Makefile.in: Rename gdbsupport source files from .c to .cc.
---
 gdbserver/Makefile.in                         |  56 ++++----
 gdbsupport/Makefile.am                        |  73 +++++-----
 gdbsupport/Makefile.in                        | 126 +++++++++---------
 gdbsupport/{agent.c => agent.cc}              |   0
 .../{btrace-common.c => btrace-common.cc}     |   0
 gdbsupport/{buffer.c => buffer.cc}            |   0
 gdbsupport/{cleanups.c => cleanups.cc}        |   0
 .../{common-debug.c => common-debug.cc}       |   0
 ...mmon-exceptions.c => common-exceptions.cc} |   0
 .../{common-inferior.c => common-inferior.cc} |   0
 .../{common-regcache.c => common-regcache.cc} |   0
 .../{common-utils.c => common-utils.cc}       |   0
 gdbsupport/{environ.c => environ.cc}          |   0
 gdbsupport/{errors.c => errors.cc}            |   0
 gdbsupport/{fileio.c => fileio.cc}            |   0
 gdbsupport/{filestuff.c => filestuff.cc}      |   0
 gdbsupport/{format.c => format.cc}            |   0
 gdbsupport/{gdb-dlfcn.c => gdb-dlfcn.cc}      |   0
 ...gdb_tilde_expand.c => gdb_tilde_expand.cc} |   0
 gdbsupport/{gdb_vecs.c => gdb_vecs.cc}        |   0
 gdbsupport/{gdb_wait.c => gdb_wait.cc}        |   0
 gdbsupport/{job-control.c => job-control.cc}  |   0
 gdbsupport/{netstuff.c => netstuff.cc}        |   0
 gdbsupport/{new-op.c => new-op.cc}            |   0
 gdbsupport/{pathstuff.c => pathstuff.cc}      |   0
 gdbsupport/{print-utils.c => print-utils.cc}  |   0
 gdbsupport/{ptid.c => ptid.cc}                |   0
 gdbsupport/{rsp-low.c => rsp-low.cc}          |   0
 .../{run-time-clock.c => run-time-clock.cc}   |   0
 .../{safe-strerror.c => safe-strerror.cc}     |   0
 gdbsupport/{scoped_mmap.c => scoped_mmap.cc}  |   0
 gdbsupport/{selftest.c => selftest.cc}        |   0
 ...estore.c => signals-state-save-restore.cc} |   0
 gdbsupport/{signals.c => signals.cc}          |   0
 gdbsupport/{tdesc.c => tdesc.cc}              |   0
 gdbsupport/{thread-pool.c => thread-pool.cc}  |   0
 gdbsupport/{xml-utils.c => xml-utils.cc}      |   0
 gnulib/Makefile.in                            |   4 +-
 38 files changed, 126 insertions(+), 133 deletions(-)
 rename gdbsupport/{agent.c => agent.cc} (100%)
 rename gdbsupport/{btrace-common.c => btrace-common.cc} (100%)
 rename gdbsupport/{buffer.c => buffer.cc} (100%)
 rename gdbsupport/{cleanups.c => cleanups.cc} (100%)
 rename gdbsupport/{common-debug.c => common-debug.cc} (100%)
 rename gdbsupport/{common-exceptions.c => common-exceptions.cc} (100%)
 rename gdbsupport/{common-inferior.c => common-inferior.cc} (100%)
 rename gdbsupport/{common-regcache.c => common-regcache.cc} (100%)
 rename gdbsupport/{common-utils.c => common-utils.cc} (100%)
 rename gdbsupport/{environ.c => environ.cc} (100%)
 rename gdbsupport/{errors.c => errors.cc} (100%)
 rename gdbsupport/{fileio.c => fileio.cc} (100%)
 rename gdbsupport/{filestuff.c => filestuff.cc} (100%)
 rename gdbsupport/{format.c => format.cc} (100%)
 rename gdbsupport/{gdb-dlfcn.c => gdb-dlfcn.cc} (100%)
 rename gdbsupport/{gdb_tilde_expand.c => gdb_tilde_expand.cc} (100%)
 rename gdbsupport/{gdb_vecs.c => gdb_vecs.cc} (100%)
 rename gdbsupport/{gdb_wait.c => gdb_wait.cc} (100%)
 rename gdbsupport/{job-control.c => job-control.cc} (100%)
 rename gdbsupport/{netstuff.c => netstuff.cc} (100%)
 rename gdbsupport/{new-op.c => new-op.cc} (100%)
 rename gdbsupport/{pathstuff.c => pathstuff.cc} (100%)
 rename gdbsupport/{print-utils.c => print-utils.cc} (100%)
 rename gdbsupport/{ptid.c => ptid.cc} (100%)
 rename gdbsupport/{rsp-low.c => rsp-low.cc} (100%)
 rename gdbsupport/{run-time-clock.c => run-time-clock.cc} (100%)
 rename gdbsupport/{safe-strerror.c => safe-strerror.cc} (100%)
 rename gdbsupport/{scoped_mmap.c => scoped_mmap.cc} (100%)
 rename gdbsupport/{selftest.c => selftest.cc} (100%)
 rename gdbsupport/{signals-state-save-restore.c => signals-state-save-restore.cc} (100%)
 rename gdbsupport/{signals.c => signals.cc} (100%)
 rename gdbsupport/{tdesc.c => tdesc.cc} (100%)
 rename gdbsupport/{thread-pool.c => thread-pool.cc} (100%)
 rename gdbsupport/{xml-utils.c => xml-utils.cc} (100%)

diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index 60a52d3412b9..d912a0babef9 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -207,32 +207,32 @@ SFILES = \
 	$(srcdir)/../gdb/arch/arm-get-next-pcs.c \
 	$(srcdir)/../gdb/arch/arm-linux.c \
 	$(srcdir)/../gdb/arch/ppc-linux-common.c \
-	$(srcdir)/../gdbsupport/btrace-common.c \
-	$(srcdir)/../gdbsupport/buffer.c \
-	$(srcdir)/../gdbsupport/cleanups.c \
-	$(srcdir)/../gdbsupport/common-debug.c \
-	$(srcdir)/../gdbsupport/common-exceptions.c \
-	$(srcdir)/../gdbsupport/common-inferior.c \
-	$(srcdir)/../gdbsupport/common-regcache.c \
-	$(srcdir)/../gdbsupport/common-utils.c \
-	$(srcdir)/../gdbsupport/errors.c \
-	$(srcdir)/../gdbsupport/environ.c \
-	$(srcdir)/../gdbsupport/fileio.c \
-	$(srcdir)/../gdbsupport/filestuff.c \
-	$(srcdir)/../gdbsupport/job-control.c \
-	$(srcdir)/../gdbsupport/gdb-dlfcn.c \
-	$(srcdir)/../gdbsupport/gdb_tilde_expand.c \
-	$(srcdir)/../gdbsupport/gdb_vecs.c \
-	$(srcdir)/../gdbsupport/gdb_wait.c \
-	$(srcdir)/../gdbsupport/netstuff.c \
-	$(srcdir)/../gdbsupport/new-op.c \
-	$(srcdir)/../gdbsupport/pathstuff.c \
-	$(srcdir)/../gdbsupport/print-utils.c \
-	$(srcdir)/../gdbsupport/ptid.c \
-	$(srcdir)/../gdbsupport/rsp-low.c \
-	$(srcdir)/../gdbsupport/safe-strerror.c \
-	$(srcdir)/../gdbsupport/tdesc.c \
-	$(srcdir)/../gdbsupport/xml-utils.c \
+	$(srcdir)/../gdbsupport/btrace-common.cc \
+	$(srcdir)/../gdbsupport/buffer.cc \
+	$(srcdir)/../gdbsupport/cleanups.cc \
+	$(srcdir)/../gdbsupport/common-debug.cc \
+	$(srcdir)/../gdbsupport/common-exceptions.cc \
+	$(srcdir)/../gdbsupport/common-inferior.cc \
+	$(srcdir)/../gdbsupport/common-regcache.cc \
+	$(srcdir)/../gdbsupport/common-utils.cc \
+	$(srcdir)/../gdbsupport/errors.cc \
+	$(srcdir)/../gdbsupport/environ.cc \
+	$(srcdir)/../gdbsupport/fileio.cc \
+	$(srcdir)/../gdbsupport/filestuff.cc \
+	$(srcdir)/../gdbsupport/job-control.cc \
+	$(srcdir)/../gdbsupport/gdb-dlfcn.cc \
+	$(srcdir)/../gdbsupport/gdb_tilde_expand.cc \
+	$(srcdir)/../gdbsupport/gdb_vecs.cc \
+	$(srcdir)/../gdbsupport/gdb_wait.cc \
+	$(srcdir)/../gdbsupport/netstuff.cc \
+	$(srcdir)/../gdbsupport/new-op.cc \
+	$(srcdir)/../gdbsupport/pathstuff.cc \
+	$(srcdir)/../gdbsupport/print-utils.cc \
+	$(srcdir)/../gdbsupport/ptid.cc \
+	$(srcdir)/../gdbsupport/rsp-low.cc \
+	$(srcdir)/../gdbsupport/safe-strerror.cc \
+	$(srcdir)/../gdbsupport/tdesc.cc \
+	$(srcdir)/../gdbsupport/xml-utils.cc \
 	$(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \
 	$(srcdir)/../gdb/nat/linux-btrace.c \
 	$(srcdir)/../gdb/nat/linux-namespaces.c \
@@ -600,7 +600,7 @@ arch/%-ipa.o: ../gdb/arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)

-gdbsupport/%-ipa.o: ../gdbsupport/%.c
+gdbsupport/%-ipa.o: ../gdbsupport/%.cc
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)

@@ -633,7 +633,7 @@ arch/%.o: ../gdb/arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)

-gdbsupport/%.o: ../gdbsupport/%.c
+gdbsupport/%.o: ../gdbsupport/%.cc
 	$(COMPILE) $<
 	$(POSTCOMPILE)

diff --git a/gdbsupport/Makefile.am b/gdbsupport/Makefile.am
index cd7b0adf6b4c..ee78a891b3b7 100644
--- a/gdbsupport/Makefile.am
+++ b/gdbsupport/Makefile.am
@@ -26,51 +26,48 @@ AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \

 override CXX += $(CXX_DIALECT)

-override CC := $(CXX)
-override CFLAGS := $(CXXFLAGS)
-
-AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+AM_CXXFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

 noinst_LIBRARIES = libgdbsupport.a

 if SELFTEST
-selftest = selftest.c
+selftest = selftest.cc
 endif

 libgdbsupport_a_SOURCES = \
-    agent.c \
-    btrace-common.c \
-    buffer.c \
-    cleanups.c \
-    common-debug.c \
-    common-exceptions.c	\
-    common-inferior.c \
-    common-regcache.c \
-    common-utils.c \
-    environ.c \
-    errors.c \
-    fileio.c \
-    filestuff.c	\
-    format.c \
-    gdb-dlfcn.c	\
-    gdb_tilde_expand.c \
-    gdb_wait.c \
-    gdb_vecs.c \
-    job-control.c \
-    netstuff.c \
-    new-op.c \
-    pathstuff.c	\
-    print-utils.c \
-    ptid.c \
-    rsp-low.c \
-    run-time-clock.c \
-    safe-strerror.c \
-    scoped_mmap.c \
-    signals.c \
-    signals-state-save-restore.c \
-    tdesc.c \
-    thread-pool.c \
-    xml-utils.c	\
+    agent.cc \
+    btrace-common.cc \
+    buffer.cc \
+    cleanups.cc \
+    common-debug.cc \
+    common-exceptions.cc \
+    common-inferior.cc \
+    common-regcache.cc \
+    common-utils.cc \
+    environ.cc \
+    errors.cc \
+    fileio.cc \
+    filestuff.cc \
+    format.cc \
+    gdb-dlfcn.cc \
+    gdb_tilde_expand.cc \
+    gdb_wait.cc \
+    gdb_vecs.cc \
+    job-control.cc \
+    netstuff.cc \
+    new-op.cc \
+    pathstuff.cc \
+    print-utils.cc \
+    ptid.cc \
+    rsp-low.cc \
+    run-time-clock.cc \
+    safe-strerror.cc \
+    scoped_mmap.cc \
+    signals.cc \
+    signals-state-save-restore.cc \
+    tdesc.cc \
+    thread-pool.cc \
+    xml-utils.cc \
     $(selftest)

 # Double-check that no defines are missing from our configury.
diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in
index be4d53545311..4e12354598be 100644
--- a/gdbsupport/Makefile.in
+++ b/gdbsupport/Makefile.in
@@ -177,18 +177,19 @@ DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/../depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 =
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 =
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+	-o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 =
 SOURCES = $(libgdbsupport_a_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
@@ -353,50 +354,50 @@ AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \
     -I../gnulib/import -I$(srcdir)/../gnulib/import \
     -I.. -I$(srcdir)/.. $(INCINTL) -I../bfd -I$(srcdir)/../bfd

-AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+AM_CXXFLAGS = $(CXX_DIALECT) $(WARN_CFLAGS) $(WERROR_CFLAGS)
 noinst_LIBRARIES = libgdbsupport.a
-@SELFTEST_TRUE@selftest = selftest.c
+@SELFTEST_TRUE@selftest = selftest.cc
 libgdbsupport_a_SOURCES = \
-    agent.c \
-    btrace-common.c \
-    buffer.c \
-    cleanups.c \
-    common-debug.c \
-    common-exceptions.c	\
-    common-inferior.c \
-    common-regcache.c \
-    common-utils.c \
-    environ.c \
-    errors.c \
-    fileio.c \
-    filestuff.c	\
-    format.c \
-    gdb-dlfcn.c	\
-    gdb_tilde_expand.c \
-    gdb_wait.c \
-    gdb_vecs.c \
-    job-control.c \
-    netstuff.c \
-    new-op.c \
-    pathstuff.c	\
-    print-utils.c \
-    ptid.c \
-    rsp-low.c \
-    run-time-clock.c \
-    safe-strerror.c \
-    scoped_mmap.c \
-    signals.c \
-    signals-state-save-restore.c \
-    tdesc.c \
-    thread-pool.c \
-    xml-utils.c	\
+    agent.cc \
+    btrace-common.cc \
+    buffer.cc \
+    cleanups.cc \
+    common-debug.cc \
+    common-exceptions.cc \
+    common-inferior.cc \
+    common-regcache.cc \
+    common-utils.cc \
+    environ.cc \
+    errors.cc \
+    fileio.cc \
+    filestuff.cc \
+    format.cc \
+    gdb-dlfcn.cc \
+    gdb_tilde_expand.cc \
+    gdb_wait.cc \
+    gdb_vecs.cc \
+    job-control.cc \
+    netstuff.cc \
+    new-op.cc \
+    pathstuff.cc \
+    print-utils.cc \
+    ptid.cc \
+    rsp-low.cc \
+    run-time-clock.cc \
+    safe-strerror.cc \
+    scoped_mmap.cc \
+    signals.cc \
+    signals-state-save-restore.cc \
+    tdesc.cc \
+    thread-pool.cc \
+    xml-utils.cc \
     $(selftest)

 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am

 .SUFFIXES:
-.SUFFIXES: .c .o .obj
+.SUFFIXES: .cc .o .obj
 am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
@@ -495,19 +496,19 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread-pool.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml-utils.Po@am__quote@

-.c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+.cc.o:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<

-.c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+.cc.obj:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`

 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -692,11 +693,6 @@ uninstall-am:
 .PRECIOUS: Makefile


-override CXX += $(CXX_DIALECT)
-
-override CC := $(CXX)
-override CFLAGS := $(CXXFLAGS)
-
 # Double-check that no defines are missing from our configury.
 check-defines:
 	cd $(srcdir) && emacs --script check-defines.el
diff --git a/gdbsupport/agent.c b/gdbsupport/agent.cc
similarity index 100%
rename from gdbsupport/agent.c
rename to gdbsupport/agent.cc
diff --git a/gdbsupport/btrace-common.c b/gdbsupport/btrace-common.cc
similarity index 100%
rename from gdbsupport/btrace-common.c
rename to gdbsupport/btrace-common.cc
diff --git a/gdbsupport/buffer.c b/gdbsupport/buffer.cc
similarity index 100%
rename from gdbsupport/buffer.c
rename to gdbsupport/buffer.cc
diff --git a/gdbsupport/cleanups.c b/gdbsupport/cleanups.cc
similarity index 100%
rename from gdbsupport/cleanups.c
rename to gdbsupport/cleanups.cc
diff --git a/gdbsupport/common-debug.c b/gdbsupport/common-debug.cc
similarity index 100%
rename from gdbsupport/common-debug.c
rename to gdbsupport/common-debug.cc
diff --git a/gdbsupport/common-exceptions.c b/gdbsupport/common-exceptions.cc
similarity index 100%
rename from gdbsupport/common-exceptions.c
rename to gdbsupport/common-exceptions.cc
diff --git a/gdbsupport/common-inferior.c b/gdbsupport/common-inferior.cc
similarity index 100%
rename from gdbsupport/common-inferior.c
rename to gdbsupport/common-inferior.cc
diff --git a/gdbsupport/common-regcache.c b/gdbsupport/common-regcache.cc
similarity index 100%
rename from gdbsupport/common-regcache.c
rename to gdbsupport/common-regcache.cc
diff --git a/gdbsupport/common-utils.c b/gdbsupport/common-utils.cc
similarity index 100%
rename from gdbsupport/common-utils.c
rename to gdbsupport/common-utils.cc
diff --git a/gdbsupport/environ.c b/gdbsupport/environ.cc
similarity index 100%
rename from gdbsupport/environ.c
rename to gdbsupport/environ.cc
diff --git a/gdbsupport/errors.c b/gdbsupport/errors.cc
similarity index 100%
rename from gdbsupport/errors.c
rename to gdbsupport/errors.cc
diff --git a/gdbsupport/fileio.c b/gdbsupport/fileio.cc
similarity index 100%
rename from gdbsupport/fileio.c
rename to gdbsupport/fileio.cc
diff --git a/gdbsupport/filestuff.c b/gdbsupport/filestuff.cc
similarity index 100%
rename from gdbsupport/filestuff.c
rename to gdbsupport/filestuff.cc
diff --git a/gdbsupport/format.c b/gdbsupport/format.cc
similarity index 100%
rename from gdbsupport/format.c
rename to gdbsupport/format.cc
diff --git a/gdbsupport/gdb-dlfcn.c b/gdbsupport/gdb-dlfcn.cc
similarity index 100%
rename from gdbsupport/gdb-dlfcn.c
rename to gdbsupport/gdb-dlfcn.cc
diff --git a/gdbsupport/gdb_tilde_expand.c b/gdbsupport/gdb_tilde_expand.cc
similarity index 100%
rename from gdbsupport/gdb_tilde_expand.c
rename to gdbsupport/gdb_tilde_expand.cc
diff --git a/gdbsupport/gdb_vecs.c b/gdbsupport/gdb_vecs.cc
similarity index 100%
rename from gdbsupport/gdb_vecs.c
rename to gdbsupport/gdb_vecs.cc
diff --git a/gdbsupport/gdb_wait.c b/gdbsupport/gdb_wait.cc
similarity index 100%
rename from gdbsupport/gdb_wait.c
rename to gdbsupport/gdb_wait.cc
diff --git a/gdbsupport/job-control.c b/gdbsupport/job-control.cc
similarity index 100%
rename from gdbsupport/job-control.c
rename to gdbsupport/job-control.cc
diff --git a/gdbsupport/netstuff.c b/gdbsupport/netstuff.cc
similarity index 100%
rename from gdbsupport/netstuff.c
rename to gdbsupport/netstuff.cc
diff --git a/gdbsupport/new-op.c b/gdbsupport/new-op.cc
similarity index 100%
rename from gdbsupport/new-op.c
rename to gdbsupport/new-op.cc
diff --git a/gdbsupport/pathstuff.c b/gdbsupport/pathstuff.cc
similarity index 100%
rename from gdbsupport/pathstuff.c
rename to gdbsupport/pathstuff.cc
diff --git a/gdbsupport/print-utils.c b/gdbsupport/print-utils.cc
similarity index 100%
rename from gdbsupport/print-utils.c
rename to gdbsupport/print-utils.cc
diff --git a/gdbsupport/ptid.c b/gdbsupport/ptid.cc
similarity index 100%
rename from gdbsupport/ptid.c
rename to gdbsupport/ptid.cc
diff --git a/gdbsupport/rsp-low.c b/gdbsupport/rsp-low.cc
similarity index 100%
rename from gdbsupport/rsp-low.c
rename to gdbsupport/rsp-low.cc
diff --git a/gdbsupport/run-time-clock.c b/gdbsupport/run-time-clock.cc
similarity index 100%
rename from gdbsupport/run-time-clock.c
rename to gdbsupport/run-time-clock.cc
diff --git a/gdbsupport/safe-strerror.c b/gdbsupport/safe-strerror.cc
similarity index 100%
rename from gdbsupport/safe-strerror.c
rename to gdbsupport/safe-strerror.cc
diff --git a/gdbsupport/scoped_mmap.c b/gdbsupport/scoped_mmap.cc
similarity index 100%
rename from gdbsupport/scoped_mmap.c
rename to gdbsupport/scoped_mmap.cc
diff --git a/gdbsupport/selftest.c b/gdbsupport/selftest.cc
similarity index 100%
rename from gdbsupport/selftest.c
rename to gdbsupport/selftest.cc
diff --git a/gdbsupport/signals-state-save-restore.c b/gdbsupport/signals-state-save-restore.cc
similarity index 100%
rename from gdbsupport/signals-state-save-restore.c
rename to gdbsupport/signals-state-save-restore.cc
diff --git a/gdbsupport/signals.c b/gdbsupport/signals.cc
similarity index 100%
rename from gdbsupport/signals.c
rename to gdbsupport/signals.cc
diff --git a/gdbsupport/tdesc.c b/gdbsupport/tdesc.cc
similarity index 100%
rename from gdbsupport/tdesc.c
rename to gdbsupport/tdesc.cc
diff --git a/gdbsupport/thread-pool.c b/gdbsupport/thread-pool.cc
similarity index 100%
rename from gdbsupport/thread-pool.c
rename to gdbsupport/thread-pool.cc
diff --git a/gdbsupport/xml-utils.c b/gdbsupport/xml-utils.cc
similarity index 100%
rename from gdbsupport/xml-utils.c
rename to gdbsupport/xml-utils.cc
diff --git a/gnulib/Makefile.in b/gnulib/Makefile.in
index 8530f3dcf527..acca8cc4ceb7 100644
--- a/gnulib/Makefile.in
+++ b/gnulib/Makefile.in
@@ -1,7 +1,7 @@
 # Makefile.in generated by automake 1.15.1 from Makefile.am.
 # @configure_input@

-# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.

 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,7 @@

 @SET_MAKE@

-# Copyright (C) 2019 Free Software Foundation, Inc.
+# Copyright (C) 2019-2020 Free Software Foundation, Inc.

 # This file is part of GDB.

-- 
2.25.0
Pedro Alves Feb. 13, 2020, 9:26 p.m. | #5
On 2/13/20 9:22 PM, Simon Marchi wrote:

> No problem.  Here's the updated patch.

> 

> Given that you have not commented on it, I presume you don't object to renaming these files?


Right, this is fine with me.

Thanks,
Pedro Alves
Simon Marchi Feb. 13, 2020, 9:30 p.m. | #6
On 2020-02-13 4:26 p.m., Pedro Alves wrote:
> On 2/13/20 9:22 PM, Simon Marchi wrote:

> 

>> No problem.  Here's the updated patch.

>>

>> Given that you have not commented on it, I presume you don't object to renaming these files?

> 

> Right, this is fine with me.

> 

> Thanks,

> Pedro Alves

> 


Thanks, I have pushed the two patches then.

Simon

Patch

diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index 60a52d3412b9..d912a0babef9 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -207,32 +207,32 @@  SFILES = \
 	$(srcdir)/../gdb/arch/arm-get-next-pcs.c \
 	$(srcdir)/../gdb/arch/arm-linux.c \
 	$(srcdir)/../gdb/arch/ppc-linux-common.c \
-	$(srcdir)/../gdbsupport/btrace-common.c \
-	$(srcdir)/../gdbsupport/buffer.c \
-	$(srcdir)/../gdbsupport/cleanups.c \
-	$(srcdir)/../gdbsupport/common-debug.c \
-	$(srcdir)/../gdbsupport/common-exceptions.c \
-	$(srcdir)/../gdbsupport/common-inferior.c \
-	$(srcdir)/../gdbsupport/common-regcache.c \
-	$(srcdir)/../gdbsupport/common-utils.c \
-	$(srcdir)/../gdbsupport/errors.c \
-	$(srcdir)/../gdbsupport/environ.c \
-	$(srcdir)/../gdbsupport/fileio.c \
-	$(srcdir)/../gdbsupport/filestuff.c \
-	$(srcdir)/../gdbsupport/job-control.c \
-	$(srcdir)/../gdbsupport/gdb-dlfcn.c \
-	$(srcdir)/../gdbsupport/gdb_tilde_expand.c \
-	$(srcdir)/../gdbsupport/gdb_vecs.c \
-	$(srcdir)/../gdbsupport/gdb_wait.c \
-	$(srcdir)/../gdbsupport/netstuff.c \
-	$(srcdir)/../gdbsupport/new-op.c \
-	$(srcdir)/../gdbsupport/pathstuff.c \
-	$(srcdir)/../gdbsupport/print-utils.c \
-	$(srcdir)/../gdbsupport/ptid.c \
-	$(srcdir)/../gdbsupport/rsp-low.c \
-	$(srcdir)/../gdbsupport/safe-strerror.c \
-	$(srcdir)/../gdbsupport/tdesc.c \
-	$(srcdir)/../gdbsupport/xml-utils.c \
+	$(srcdir)/../gdbsupport/btrace-common.cc \
+	$(srcdir)/../gdbsupport/buffer.cc \
+	$(srcdir)/../gdbsupport/cleanups.cc \
+	$(srcdir)/../gdbsupport/common-debug.cc \
+	$(srcdir)/../gdbsupport/common-exceptions.cc \
+	$(srcdir)/../gdbsupport/common-inferior.cc \
+	$(srcdir)/../gdbsupport/common-regcache.cc \
+	$(srcdir)/../gdbsupport/common-utils.cc \
+	$(srcdir)/../gdbsupport/errors.cc \
+	$(srcdir)/../gdbsupport/environ.cc \
+	$(srcdir)/../gdbsupport/fileio.cc \
+	$(srcdir)/../gdbsupport/filestuff.cc \
+	$(srcdir)/../gdbsupport/job-control.cc \
+	$(srcdir)/../gdbsupport/gdb-dlfcn.cc \
+	$(srcdir)/../gdbsupport/gdb_tilde_expand.cc \
+	$(srcdir)/../gdbsupport/gdb_vecs.cc \
+	$(srcdir)/../gdbsupport/gdb_wait.cc \
+	$(srcdir)/../gdbsupport/netstuff.cc \
+	$(srcdir)/../gdbsupport/new-op.cc \
+	$(srcdir)/../gdbsupport/pathstuff.cc \
+	$(srcdir)/../gdbsupport/print-utils.cc \
+	$(srcdir)/../gdbsupport/ptid.cc \
+	$(srcdir)/../gdbsupport/rsp-low.cc \
+	$(srcdir)/../gdbsupport/safe-strerror.cc \
+	$(srcdir)/../gdbsupport/tdesc.cc \
+	$(srcdir)/../gdbsupport/xml-utils.cc \
 	$(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \
 	$(srcdir)/../gdb/nat/linux-btrace.c \
 	$(srcdir)/../gdb/nat/linux-namespaces.c \
@@ -600,7 +600,7 @@  arch/%-ipa.o: ../gdb/arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%-ipa.o: ../gdbsupport/%.c
+gdbsupport/%-ipa.o: ../gdbsupport/%.cc
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -633,7 +633,7 @@  arch/%.o: ../gdb/arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%.o: ../gdbsupport/%.c
+gdbsupport/%.o: ../gdbsupport/%.cc
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
diff --git a/gdbsupport/Makefile.am b/gdbsupport/Makefile.am
index cd7b0adf6b4c..f9f809505b5f 100644
--- a/gdbsupport/Makefile.am
+++ b/gdbsupport/Makefile.am
@@ -34,43 +34,43 @@  AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 noinst_LIBRARIES = libgdbsupport.a
 
 if SELFTEST
-selftest = selftest.c
+selftest = selftest.cc
 endif
 
 libgdbsupport_a_SOURCES = \
-    agent.c \
-    btrace-common.c \
-    buffer.c \
-    cleanups.c \
-    common-debug.c \
-    common-exceptions.c	\
-    common-inferior.c \
-    common-regcache.c \
-    common-utils.c \
-    environ.c \
-    errors.c \
-    fileio.c \
-    filestuff.c	\
-    format.c \
-    gdb-dlfcn.c	\
-    gdb_tilde_expand.c \
-    gdb_wait.c \
-    gdb_vecs.c \
-    job-control.c \
-    netstuff.c \
-    new-op.c \
-    pathstuff.c	\
-    print-utils.c \
-    ptid.c \
-    rsp-low.c \
-    run-time-clock.c \
-    safe-strerror.c \
-    scoped_mmap.c \
-    signals.c \
-    signals-state-save-restore.c \
-    tdesc.c \
-    thread-pool.c \
-    xml-utils.c	\
+    agent.cc \
+    btrace-common.cc \
+    buffer.cc \
+    cleanups.cc \
+    common-debug.cc \
+    common-exceptions.cc \
+    common-inferior.cc \
+    common-regcache.cc \
+    common-utils.cc \
+    environ.cc \
+    errors.cc \
+    fileio.cc \
+    filestuff.cc \
+    format.cc \
+    gdb-dlfcn.cc \
+    gdb_tilde_expand.cc \
+    gdb_wait.cc \
+    gdb_vecs.cc \
+    job-control.cc \
+    netstuff.cc \
+    new-op.cc \
+    pathstuff.cc \
+    print-utils.cc \
+    ptid.cc \
+    rsp-low.cc \
+    run-time-clock.cc \
+    safe-strerror.cc \
+    scoped_mmap.cc \
+    signals.cc \
+    signals-state-save-restore.cc \
+    tdesc.cc \
+    thread-pool.cc \
+    xml-utils.cc \
     $(selftest)
 
 # Double-check that no defines are missing from our configury.
diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in
index be4d53545311..3942f31424a8 100644
--- a/gdbsupport/Makefile.in
+++ b/gdbsupport/Makefile.in
@@ -177,18 +177,19 @@  DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/../depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_@AM_V@)
-am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_@AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+	-o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 SOURCES = $(libgdbsupport_a_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
@@ -355,48 +356,48 @@  AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../gdb \
 
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 noinst_LIBRARIES = libgdbsupport.a
-@SELFTEST_TRUE@selftest = selftest.c
+@SELFTEST_TRUE@selftest = selftest.cc
 libgdbsupport_a_SOURCES = \
-    agent.c \
-    btrace-common.c \
-    buffer.c \
-    cleanups.c \
-    common-debug.c \
-    common-exceptions.c	\
-    common-inferior.c \
-    common-regcache.c \
-    common-utils.c \
-    environ.c \
-    errors.c \
-    fileio.c \
-    filestuff.c	\
-    format.c \
-    gdb-dlfcn.c	\
-    gdb_tilde_expand.c \
-    gdb_wait.c \
-    gdb_vecs.c \
-    job-control.c \
-    netstuff.c \
-    new-op.c \
-    pathstuff.c	\
-    print-utils.c \
-    ptid.c \
-    rsp-low.c \
-    run-time-clock.c \
-    safe-strerror.c \
-    scoped_mmap.c \
-    signals.c \
-    signals-state-save-restore.c \
-    tdesc.c \
-    thread-pool.c \
-    xml-utils.c	\
+    agent.cc \
+    btrace-common.cc \
+    buffer.cc \
+    cleanups.cc \
+    common-debug.cc \
+    common-exceptions.cc \
+    common-inferior.cc \
+    common-regcache.cc \
+    common-utils.cc \
+    environ.cc \
+    errors.cc \
+    fileio.cc \
+    filestuff.cc \
+    format.cc \
+    gdb-dlfcn.cc \
+    gdb_tilde_expand.cc \
+    gdb_wait.cc \
+    gdb_vecs.cc \
+    job-control.cc \
+    netstuff.cc \
+    new-op.cc \
+    pathstuff.cc \
+    print-utils.cc \
+    ptid.cc \
+    rsp-low.cc \
+    run-time-clock.cc \
+    safe-strerror.cc \
+    scoped_mmap.cc \
+    signals.cc \
+    signals-state-save-restore.cc \
+    tdesc.cc \
+    thread-pool.cc \
+    xml-utils.cc \
     $(selftest)
 
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .o .obj
+.SUFFIXES: .cc .o .obj
 am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
@@ -495,19 +496,19 @@  distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread-pool.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml-utils.Po@am__quote@
 
-.c.o:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+.cc.o:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
diff --git a/gdbsupport/agent.c b/gdbsupport/agent.cc
similarity index 100%
rename from gdbsupport/agent.c
rename to gdbsupport/agent.cc
diff --git a/gdbsupport/btrace-common.c b/gdbsupport/btrace-common.cc
similarity index 100%
rename from gdbsupport/btrace-common.c
rename to gdbsupport/btrace-common.cc
diff --git a/gdbsupport/buffer.c b/gdbsupport/buffer.cc
similarity index 100%
rename from gdbsupport/buffer.c
rename to gdbsupport/buffer.cc
diff --git a/gdbsupport/cleanups.c b/gdbsupport/cleanups.cc
similarity index 100%
rename from gdbsupport/cleanups.c
rename to gdbsupport/cleanups.cc
diff --git a/gdbsupport/common-debug.c b/gdbsupport/common-debug.cc
similarity index 100%
rename from gdbsupport/common-debug.c
rename to gdbsupport/common-debug.cc
diff --git a/gdbsupport/common-exceptions.c b/gdbsupport/common-exceptions.cc
similarity index 100%
rename from gdbsupport/common-exceptions.c
rename to gdbsupport/common-exceptions.cc
diff --git a/gdbsupport/common-inferior.c b/gdbsupport/common-inferior.cc
similarity index 100%
rename from gdbsupport/common-inferior.c
rename to gdbsupport/common-inferior.cc
diff --git a/gdbsupport/common-regcache.c b/gdbsupport/common-regcache.cc
similarity index 100%
rename from gdbsupport/common-regcache.c
rename to gdbsupport/common-regcache.cc
diff --git a/gdbsupport/common-utils.c b/gdbsupport/common-utils.cc
similarity index 100%
rename from gdbsupport/common-utils.c
rename to gdbsupport/common-utils.cc
diff --git a/gdbsupport/environ.c b/gdbsupport/environ.cc
similarity index 100%
rename from gdbsupport/environ.c
rename to gdbsupport/environ.cc
diff --git a/gdbsupport/errors.c b/gdbsupport/errors.cc
similarity index 100%
rename from gdbsupport/errors.c
rename to gdbsupport/errors.cc
diff --git a/gdbsupport/fileio.c b/gdbsupport/fileio.cc
similarity index 100%
rename from gdbsupport/fileio.c
rename to gdbsupport/fileio.cc
diff --git a/gdbsupport/filestuff.c b/gdbsupport/filestuff.cc
similarity index 100%
rename from gdbsupport/filestuff.c
rename to gdbsupport/filestuff.cc
diff --git a/gdbsupport/format.c b/gdbsupport/format.cc
similarity index 100%
rename from gdbsupport/format.c
rename to gdbsupport/format.cc
diff --git a/gdbsupport/gdb-dlfcn.c b/gdbsupport/gdb-dlfcn.cc
similarity index 100%
rename from gdbsupport/gdb-dlfcn.c
rename to gdbsupport/gdb-dlfcn.cc
diff --git a/gdbsupport/gdb_tilde_expand.c b/gdbsupport/gdb_tilde_expand.cc
similarity index 100%
rename from gdbsupport/gdb_tilde_expand.c
rename to gdbsupport/gdb_tilde_expand.cc
diff --git a/gdbsupport/gdb_vecs.c b/gdbsupport/gdb_vecs.cc
similarity index 100%
rename from gdbsupport/gdb_vecs.c
rename to gdbsupport/gdb_vecs.cc
diff --git a/gdbsupport/gdb_wait.c b/gdbsupport/gdb_wait.cc
similarity index 100%
rename from gdbsupport/gdb_wait.c
rename to gdbsupport/gdb_wait.cc
diff --git a/gdbsupport/job-control.c b/gdbsupport/job-control.cc
similarity index 100%
rename from gdbsupport/job-control.c
rename to gdbsupport/job-control.cc
diff --git a/gdbsupport/netstuff.c b/gdbsupport/netstuff.cc
similarity index 100%
rename from gdbsupport/netstuff.c
rename to gdbsupport/netstuff.cc
diff --git a/gdbsupport/new-op.c b/gdbsupport/new-op.cc
similarity index 100%
rename from gdbsupport/new-op.c
rename to gdbsupport/new-op.cc
diff --git a/gdbsupport/pathstuff.c b/gdbsupport/pathstuff.cc
similarity index 100%
rename from gdbsupport/pathstuff.c
rename to gdbsupport/pathstuff.cc
diff --git a/gdbsupport/print-utils.c b/gdbsupport/print-utils.cc
similarity index 100%
rename from gdbsupport/print-utils.c
rename to gdbsupport/print-utils.cc
diff --git a/gdbsupport/ptid.c b/gdbsupport/ptid.cc
similarity index 100%
rename from gdbsupport/ptid.c
rename to gdbsupport/ptid.cc
diff --git a/gdbsupport/rsp-low.c b/gdbsupport/rsp-low.cc
similarity index 100%
rename from gdbsupport/rsp-low.c
rename to gdbsupport/rsp-low.cc
diff --git a/gdbsupport/run-time-clock.c b/gdbsupport/run-time-clock.cc
similarity index 100%
rename from gdbsupport/run-time-clock.c
rename to gdbsupport/run-time-clock.cc
diff --git a/gdbsupport/safe-strerror.c b/gdbsupport/safe-strerror.cc
similarity index 100%
rename from gdbsupport/safe-strerror.c
rename to gdbsupport/safe-strerror.cc
diff --git a/gdbsupport/scoped_mmap.c b/gdbsupport/scoped_mmap.cc
similarity index 100%
rename from gdbsupport/scoped_mmap.c
rename to gdbsupport/scoped_mmap.cc
diff --git a/gdbsupport/selftest.c b/gdbsupport/selftest.cc
similarity index 100%
rename from gdbsupport/selftest.c
rename to gdbsupport/selftest.cc
diff --git a/gdbsupport/signals-state-save-restore.c b/gdbsupport/signals-state-save-restore.cc
similarity index 100%
rename from gdbsupport/signals-state-save-restore.c
rename to gdbsupport/signals-state-save-restore.cc
diff --git a/gdbsupport/signals.c b/gdbsupport/signals.cc
similarity index 100%
rename from gdbsupport/signals.c
rename to gdbsupport/signals.cc
diff --git a/gdbsupport/tdesc.c b/gdbsupport/tdesc.cc
similarity index 100%
rename from gdbsupport/tdesc.c
rename to gdbsupport/tdesc.cc
diff --git a/gdbsupport/thread-pool.c b/gdbsupport/thread-pool.cc
similarity index 100%
rename from gdbsupport/thread-pool.c
rename to gdbsupport/thread-pool.cc
diff --git a/gdbsupport/xml-utils.c b/gdbsupport/xml-utils.cc
similarity index 100%
rename from gdbsupport/xml-utils.c
rename to gdbsupport/xml-utils.cc