This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, SH] Add support for inlined builtin-strcmp (1/2)


On Fri, 2013-10-18 at 09:38 +0200, Christian Bruel wrote:
> On 10/18/2013 12:53 AM, Oleg Endo wrote:
> > Hi,
> >
> > On Thu, 2013-10-17 at 16:13 +0200, Christian Bruel wrote:
> >> Hello,
> >>
> >> This patch just reorganizes the SH code used for memory builtins into
> >> its own file, in preparation of the RTL strcmp hoisting in the next part.
> >>
> > Since GCC is now being compiled as C++, it's probably better to name
> > newly added source files .cc instead of .c.  Could you please rename the
> > new file to sh-mem.cc?
> >
> > Thanks,
> > Oleg
> Hello Oleg,
> 
> I have no objection to rename a pure C file to a c++ suffixed file. 
> I'll conform to whatever
>  the general guidelines for pure C code is.
> 
> For now it doesn't seem to be the tendency.
> 
> grep -i "ew File" ChangeLog | grep .c:
>         * gimple-builder.c: New File.
>         * config/winnt-c.c: New file
>         * ipa-profile.c: New file.
>         * ubsan.c: New file.
>         * ipa-devirt.c: New file.
>         * vtable-verify.c: New file.
>         * config/arm/aarch-common.c: ... here.  New file.
>         * diagnostic-color.c: New file.
>         * config/linux-android.c: New file.
> 

Yeah, the thing is that pure C files (.c) are also compiled as C++.
There is no distinction of how .c and .cc files are compiled.  Thus it's
quite easy for C++ code to "slip in", e.g. by follow up changes.  So I
think it's better to have new files checked in as .cc in the first place
in order to avoid more confusion.

> I haven't seen any reference to this in the GCC coding guidelines,
> should we prefer .cc, cxx, C,  cpp., c++.. ?

There was some discussion on the GCC list regarding this.
gcc/ChangeLog can be used as a summarizing conclusion:

2013-03-27  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* Makefile.in (.SUFFIXES): Add .cc.
	(.c.o): Apply same recipe for implicit rule .cc.o.

2013-09-20  Basile Starynkevitch  <basile@starynkevitch.net>

	* gengtype.c (file_rules): Added rule for *.cc files.

2013-09-25  Tom Tromey  <tromey@redhat.com>

	* Makefile.in (CCDEPMODE, DEPDIR, depcomp, COMPILE.base)
	(COMPILE, POSTCOMPILE): New variables.
	(.cc.o .c.o): Use COMPILE, POSTCOMPILE.

> Also I'm wondering if there is any plan to rename all files in the tree
> so we have a consistent source tree.

It's been discussed a while ago on the GCC list.  The decision was not
to do it in order to avoid SVN mass renames for now.  See also:

http://gcc.gnu.org/ml/gcc/2012-08/msg00311.html
http://gcc.gnu.org/ml/gcc/2012-08/msg00312.html
http://gcc.gnu.org/ml/gcc/2012-08/msg00315.html

Cheers,
Oleg


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]