public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: David Malcolm <dmalcolm@redhat.com>,
	Martin Jambor <mjambor@suse.cz>,
	GCC Mailing List <gcc@gcc.gnu.org>
Subject: Re: Mass rename of C++ .c files to .cc suffix?
Date: Mon, 10 Jan 2022 10:11:23 +0100	[thread overview]
Message-ID: <c5fb870d-3f02-df82-a03e-ea7d192cfd6a@suse.cz> (raw)
In-Reply-To: <34a5f90cd4a52b3a4a7fecb0ba7b082a02f0c6b7.camel@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]

On 1/7/22 16:59, David Malcolm via Gcc wrote:
> On Fri, 2022-01-07 at 11:25 +0100, Martin Jambor wrote:
>> Hi,
>>
>> Would anyone be terribly against mass renaming all *.c files (that are
>> actually C++ files) within the gcc subdirectory to ones with .cc
>> suffix?
>>
>> We already have 47 files with suffix .cc directly in the gcc
>> subdirectory and 160 if we also count those in (non-testsuite)
>> subdirectories, while the majority of our non-header C++ files still
>> has
>> the .c suffix.
>>
>> I have already missed stuff when grepping because I did not include
>> *.cc
>> files and the inconsistency is also just ugly and must be very
>> confusing
>> to anyone who encounters it for the first time.
>>
>> Since we have switched to git, this should have quite small effect on
>> anyone who does their development on branches.  With Martin Liška we
>> did
>> a few experiments and git blame, git rebase and even git gcc-backport
>> worked seamlessly across a rename.
>>
>> I would be fine waiting with it until GCC 12 gets released but see
>> little value in doing so.
>>
>> What do others think?  (Any important caveats I might have missed?)
> 
> +1 from me.
> 
> Various details:
> 
> Presumably the generated files should also change from .c to .cc (e.g.
> gengtype generates a gtype-desc.c which is actually C++).

Exactly. I'm willing to work on the transition.

I started with a replacement script that takes all *.c files in gcc/ subfolder
(excluding testsuite) and I made re.sub('\b${filename}\b', '${filename}c')
for all these files. It's quite surprising how many occurrences do we have
in comments (please see preliminary patch).

Martin

> 
> grep for "files_rules" in gengtype: it seems to have some hardcoded
> regex patterns that end in "\\.c" (not sure what these do, but should
> be investigated w.r.t. a renaming to .cc)
> 
> A minor detail that would be nice to get right: the selftests manually
> code the names of source files in function names; see
> selftest::run_tests in selftest-run-tests.c, which has lots of calls to
> functions of the form "foo_c_tests ();"  These function names should
> probably be renamed to "foo_cc_tests" if "foo.c" is renamed to
> "foo.cc".  Though perhaps that can wait to a followup, or be a separate
> commit, if that helps with backporting.
> 
> Hope this is constructive
> Dave
> 
> 

[-- Attachment #2: 0001-Renaming.patch.zst --]
[-- Type: application/zstd, Size: 199546 bytes --]

  parent reply	other threads:[~2022-01-10  9:11 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 10:25 Martin Jambor
2022-01-07 10:33 ` Richard Sandiford
2022-01-07 10:44   ` Andrew Pinski
2022-01-07 10:51 ` Jonathan Wakely
2022-01-07 10:51 ` Jakub Jelinek
2022-01-07 11:05   ` Jonathan Wakely
2022-01-07 12:55     ` Martin Liška
2022-01-07 14:42       ` Iain Sandoe
2022-01-07 14:49 ` Jeff Law
2022-01-07 15:45   ` Jeff Law
2022-01-07 15:59 ` David Malcolm
2022-01-07 17:31   ` Jonathan Wakely
2022-01-10  9:11   ` Martin Liška [this message]
2022-01-07 18:33 ` Alexandre Oliva
2022-01-07 19:01   ` Jakub Jelinek
2022-01-11 12:56 ` [PATCH] Mass rename of C++ .c files to .cc suffix Martin Liška
2022-01-11 15:48   ` Toon Moene
2022-01-11 15:50     ` Martin Liška
2022-01-11 15:56       ` Jakub Jelinek
2022-01-11 16:03         ` Martin Liška
2022-01-11 16:16           ` Jakub Jelinek
2022-01-12  8:58             ` Martin Liška
2022-01-12 15:54               ` [PATCH] git-backport: support renamed .cc files in commit message Martin Liška
2022-01-14  7:44                 ` Bernhard Reutner-Fischer
2022-01-14 15:26                   ` Martin Liška
2022-01-17 21:26                 ` Martin Liška
2022-01-18 19:10                   ` Harald Anlauf
2022-01-19  8:07                     ` Martin Liška
2022-01-11 18:00       ` [PATCH] Mass rename of C++ .c files to .cc suffix Harald Anlauf
2022-01-11 18:00         ` Harald Anlauf
2022-01-11 18:23         ` Jonathan Wakely
2022-01-11 18:36           ` Jakub Jelinek
2022-01-13 11:01     ` [ANNOUNCEMENT] Mass rename of C++ .c files to .cc suffix is going to happen on Jan 17 evening UTC TZ Martin Liška
2022-01-17 21:41       ` Martin Liška
2022-01-18  8:36         ` Eric Botcazou
2022-01-18  8:39           ` Martin Liška
2022-01-18  8:46             ` Eric Botcazou
2022-01-18  8:53               ` Richard Biener
2022-01-18  9:08                 ` Martin Liška
2022-01-18  9:13                   ` Jakub Jelinek
2022-01-18  9:43                     ` Martin Liška
2022-01-18 13:10         ` Richard Earnshaw
2022-01-18 13:16           ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5fb870d-3f02-df82-a03e-ea7d192cfd6a@suse.cz \
    --to=mliska@suse.cz \
    --cc=dmalcolm@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=mjambor@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).