[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: [PATCH] Allow building with g++

From: Bert Huijben <bert_at_qqmail.nl>
Date: Tue, 12 Mar 2013 11:41:39 +0100

> -----Original Message-----
> From: MARTIN PHILIP [mailto:codematters_at_ntlworld.com] On Behalf Of
> Philip Martin
> Sent: dinsdag 12 maart 2013 11:09
> To: dev_at_subversion.apache.org
> Subject: [PATCH] Allow building with g++
>
> The patch below allows Subversion to be compiled with g++ provided the
> the option -fpermissive is used. The advantage of doing this is that we
> get extra warnings, in particular we get enum type checking (in C any
> enum can be passed where an enum is expected). This isn't a conversion
> to C++, Subversion is still C, it's simply an option to allow another
> compiler.
>
> There are two major obstacles to building Subversion with a C++
> compiler: Subversion uses C++ keywords (new, delete, private, this,
> namespace) as identifiers, and C allows the implicit conversion of
> pointers to and from void*.
>
> Using "g++ -fpermissive" solves the void* issue but does mean that g++
> is probably the only C++ compiler that can be used (clang++ doesn't
> work).
>
> The patch involves:
>
> - renaming identifiers to avoid C++ keywords
>
> - moving enums declared inside structures outside the structure
>
> - one cast to resolve strchr overload
>
> - one static zero initialisation extended to cope with const members
>
> - one initialisation converted to assignment to allow goto
>
> - one variable made extern
>
> - one struct renamed to avoid the POSIX name key_t
>
> None of the changes affect Subversion's public API.
>
> Renaming is the largest part of the change. One ugly rename is that
> Apache's mod_dav.h uses 'namespace' so I added "#define namespace ns"
> before including the file and then I did not need to explicitly rename
> the identifier in those source files. I could have used this #define
> technique in other files but chose to explicitly rename instead.
>
> What do people think? Good idea? Too ugly for the limited benefit?

+1

Would be nice if we can use a buildbot to build in this mode.

        Bert
Received on 2013-03-12 11:43:57 CET

This is an archived mail posted to the Subversion Dev mailing list.