You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bert Huijben <be...@qqmail.nl> on 2012/11/23 17:10:58 UTC

RE: svn commit: r1412911 - in /subversion/trunk: subversion/libsvn_fs_fs/fs_fs.c subversion/libsvn_repos/reporter.c tools/client-side/svn-bench/null-log-cmd.c tools/server-side/fsfs-reorg.c

I can easily make these cases a compile error with Visual C++, but that
will probably make other developers call it a broken/old/(fill in your own
curse word) compiler for following such an old standard.

Suggestions?

Bert

 *From:* julianfoad@apache.org
*Sent:* November 23, 2012 4:19 PM
*To:* commits@subversion.apache.org
*Subject:* svn commit: r1412911 - in /subversion/trunk:
subversion/libsvn_fs_fs/fs_fs.c subversion/libsvn_repos/reporter.c
tools/client-side/svn-bench/null-log-cmd.c tools/server-side/fsfs-reorg.c

Author: julianfoad
Date: Fri Nov 23 15:18:48 2012
New Revision: 1412911

URL: http://svn.apache.org/viewvc?rev=1412911&view=rev
Log:
Do not use non-constant initializers in struct variables, since this
violates our C'89 coding standard.  Although most compilers used for
Subversion support non-constant initializers, some do not, such as Solaris
SunPRO.  Note that GCC requires the '-pedantic' option to report this.

A previous commit of this kind was r1352068.

Re: svn commit: r1412911 - in /subversion/trunk: subversion/libsvn_fs_fs/fs_fs.c subversion/libsvn_repos/reporter.c tools/client-side/svn-bench/null-log-cmd.c tools/server-side/fsfs-reorg.c

Posted by Philip Martin <ph...@wandisco.com>.
Julian Foad <ju...@btopenworld.com> writes:

> subversion/libsvn_subr/cmdline.c:621:26: ISO C forbids passing argument 3 of 'svn_auth_set_parameter' between function pointer and 'void *'

ISO C allows function pointers and void * to be a different sizes but
POSIX's dlsym(3) more-or-less guarantees they are the same size.

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download

Re: svn commit: r1412911 - in /subversion/trunk: subversion/libsvn_fs_fs/fs_fs.c subversion/libsvn_repos/reporter.c tools/client-side/svn-bench/null-log-cmd.c tools/server-side/fsfs-reorg.c

Posted by Julian Foad <ju...@btopenworld.com>.
Bert Huijben wrote:

> I can easily make these cases a compile error with Visual C++,
> but that will probably make other developers call it a broken/
> old/(fill in your own curse word) compiler for following such
> an old standard.
> 
> Suggestions?


Honestly, I would like to suggest that we find out whether Subversion packagers who have complained about their compiler not supporting this construct have an acceptable alternative. 

And then, if they do, I would like to add this constuct to a list of exceptions to C'89 that we allow in our code, and then use it, because it significantly improves code readability.

We already have other exceptions to strict C'89 compliance, which nobody has complained about.  Here's a couple of examples reported by "gcc -pedantic":

subversion/libsvn_subr/cmdline.c:621:26: ISO C forbids passing argument 3 of 'svn_auth_set_parameter' between function pointer and 'void *'
subversion/libsvn_subr/win32_crashrpt.c:1:0: ISO C forbids an empty translation unit


- Julian


> URL: http://svn.apache.org/viewvc?rev=1412911&view=rev
> Log:
> Do not use non-constant initializers in struct variables, since this
> violates our C'89 coding standard.  Although most compilers used for
> Subversion support non-constant initializers, some do not, such as Solaris
> SunPRO.  Note that GCC requires the '-pedantic' option to report this.
>
> A previous commit of this kind was r1352068.