You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2002/09/26 21:23:23 UTC

ansi compilers (was: svn commit: rev 3235 ...)

On Thu, Sep 26, 2002 at 03:59:35PM -0400, Michael Price wrote:
>...
>  > * adm_ops.c (svn_wc_delete): umm, don't declare a variable after a
>  >   function call.  This wouldn't compile in my gcc 2.95.4.
> 
> Because c99 support wasn't added until the 3.X series in gcc.
>...
> $ gcc -Wall -std=c89 -pedantic test.c
> test.c: In function `main':
> test.c:8: warning: ISO C89 forbids mixed declarations and code
> $ gcc -Wall -std=c99 -pedantic test.c
> $ ./a.out
> just testing

Hmm. I think that if we find the compiler is GCC 3.X, then we should add
that -std=c89 to the command line. That will help us catch these problems,
and remain compatible with more ANSI compilers.

(while APR removes our need for a solid ANSI library, we have to deal with
 the compiler...)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: ansi compilers (was: svn commit: rev 3235 ...)

Posted by Michael Price <mp...@atl.lmco.com>.
Greg Stein writes:
 > Hmm. I think that if we find the compiler is GCC 3.X, then we should add
 > that -std=c89 to the command line. That will help us catch these problems,
 > and remain compatible with more ANSI compilers.
 > 
 > (while APR removes our need for a solid ANSI library, we have to deal with
 >  the compiler...)

If that is really what you want then specifying '-ansi -pedantic' will
produce the desired effect.

Here are the relevant portions of the gcc manual on the '-ansi' flag:

  In C mode, support all ISO C89 programs. In C++ mode, remove GNU
  extensions that conflict with ISO C++.

  [snip]

  The -ansi option does not cause non-ISO programs to be rejected
  gratuitously. For that, -pedantic is required in addition to -ansi. See
  Warning Options.

However, I think encouraging people (and vendors) to support C99 is far
better than supporting compilers vendors have chosen to forget.

Just my $.02

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: ansi compilers (was: svn commit: rev 3235 ...)

Posted by Branko Čibej <br...@xbc.nu>.
Greg Stein wrote:

>On Thu, Sep 26, 2002 at 03:59:35PM -0400, Michael Price wrote:
>  
>
>>...
>> > * adm_ops.c (svn_wc_delete): umm, don't declare a variable after a
>> >   function call.  This wouldn't compile in my gcc 2.95.4.
>>
>>Because c99 support wasn't added until the 3.X series in gcc.
>>...
>>$ gcc -Wall -std=c89 -pedantic test.c
>>test.c: In function `main':
>>test.c:8: warning: ISO C89 forbids mixed declarations and code
>>$ gcc -Wall -std=c99 -pedantic test.c
>>$ ./a.out
>>just testing
>>    
>>
>
>Hmm. I think that if we find the compiler is GCC 3.X, then we should add
>that -std=c89 to the command line. That will help us catch these problems,
>and remain compatible with more ANSI compilers.
>
Can I vote for --std=c90, and compatibility with ISO compiler's instead? :-)

>(while APR removes our need for a solid ANSI library, we have to deal with
> the compiler...)
>  
>

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org