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.
This commit is contained in:
Simon Marchi 2020-02-13 16:27:02 -05:00
parent 8f432634a5
commit 06b3c5bdb0
40 changed files with 139 additions and 133 deletions

View File

@ -1,3 +1,7 @@
2020-02-13 Simon Marchi <simon.marchi@efficios.com>
* Makefile.in: Rename gdbsupport source files from .c to .cc.
2020-02-12 Hannes Domani <ssbssa@yahoo.de>
* win32-low.c (win32_create_inferior): Set signal_pid.

View File

@ -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)

View File

@ -1,3 +1,12 @@
2020-02-13 Simon Marchi <simon.marchi@efficios.com>
* 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.
2020-02-11 Simon Marchi <simon.marchi@efficios.com>
* configure: Re-generate.

View File

@ -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.

View File

@ -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

View File

@ -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.