You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2005/07/23 23:50:07 UTC

nls.c and svn_nls.h (new files): insufficient #include statements

subversion/include/svn_nls.h needs to include "svn_types.h" to get the 
declaration of svn_error_t, so that it can stand alone (i.e. it should not 
require other files to have been included before it).

subversion/libsvn_subr/nls.c needs to include svn_nls.h to get the prototypes 
of the functions that it implements, so that they can be verified to have the 
same signature.  I choose to have a compiler warning when that is not done.  It 
should include it before any other Subversion header files (and, ideally, 
before any other header files) to verify that "svn_nls.h" has no prerequisites.

I can do this if you want - just say so.

- Julian

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

Re: nls.c and svn_nls.h (new files): insufficient #include statements

Posted by David James <ja...@gmail.com>.
On 7/25/05, Julian Foad <ju...@btopenworld.com> wrote:
> I can recommend the following method of checking whether a header file can
> stand alone: try to compile it as if it were a C file.  This is from my
> "check-source.sh" script:
Hey, nice script! Perhaps we should add it to the test suite? Then
we'd know right away if one of the header files has broken
dependencies.

Cheers,

David

> echo "Check that each header file includes what it needs."
> for HEADER in subversion/include/*.h; do
>    gcc -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -Wall
> -Wundef -Wendif-labels -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
> -Wredundant-decls -Wnested-externs -g -Wmissing-declarations -pthread
> -DNEON_ZLIB -DSVN_DEBUG -DAP_DEBUG -Wpointer-arith -Wwrite-strings -Wshadow
> -I/usr/include/apache2 -I./subversion/include -I./subversion -I./neon/src
> -I/usr/local/include/neon -I/home/julianfoad/build/subversion/apr/include
> -I./apr/include   -I/home/julianfoad/build/subversion/apr-util/include
> -I./apr-util/include -o compiled-header.tmp -x c -c $HEADER
> done
Shall we add this 

-- 
David James -- http://www.cs.toronto.edu/~james

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


Re: nls.c and svn_nls.h (new files): insufficient #include statements

Posted by Julian Foad <ju...@btopenworld.com>.
David James wrote:
> On 7/24/05, Julian Foad <ju...@btopenworld.com> wrote:
> 
>>Done in r15403.  I looked at some of our other files and noticed that they are
>>generally not including the header containing their prototypes before other
>>headers, so they are not verifying the lack of prerequisites for their headers.
>>  Therefore I didn't make that a goal of this commit.
> 
> Thanks for your work, Julian. If you notice any other headerfiles
> which are missing prerequisites, please carbon copy me on the email.

I'd be glad to assist you if I can, but, to be honest, when this next occurs, 
probably in several months' time, and if it is me that first notices, I will 
probably have forgotton who you were by then.

> In order to improve the SWIG bindings, I am working on a parser for
> these header files, and my parser breaks when dependencies are not
> included. Thanks for your work!

I can recommend the following method of checking whether a header file can 
stand alone: try to compile it as if it were a C file.  This is from my 
"check-source.sh" script:

echo "Check that each header file includes what it needs."
for HEADER in subversion/include/*.h; do
   gcc -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -Wall 
-Wundef -Wendif-labels -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes 
-Wredundant-decls -Wnested-externs -g -Wmissing-declarations -pthread 
-DNEON_ZLIB -DSVN_DEBUG -DAP_DEBUG -Wpointer-arith -Wwrite-strings -Wshadow 
-I/usr/include/apache2 -I./subversion/include -I./subversion -I./neon/src 
-I/usr/local/include/neon -I/home/julianfoad/build/subversion/apr/include 
-I./apr/include   -I/home/julianfoad/build/subversion/apr-util/include 
-I./apr-util/include -o compiled-header.tmp -x c -c $HEADER
done

The option "-x c" is the one that tells GCC to treat the file as a C source 
file despite its name.

- Julian

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

Re: nls.c and svn_nls.h (new files): insufficient #include statements

Posted by David James <ja...@gmail.com>.
On 7/24/05, Julian Foad <ju...@btopenworld.com> wrote:
> Done in r15403.  I looked at some of our other files and noticed that they are
> generally not including the header containing their prototypes before other
> headers, so they are not verifying the lack of prerequisites for their headers.
>   Therefore I didn't make that a goal of this commit.
Thanks for your work, Julian. If you notice any other headerfiles
which are missing prerequisites, please carbon copy me on the email.
In order to improve the SWIG bindings, I am working on a parser for
these header files, and my parser breaks when dependencies are not
included. Thanks for your work!

Cheers,

David
-- 
David James -- http://www.cs.toronto.edu/~james

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


Re: nls.c and svn_nls.h (new files): insufficient #include statements

Posted by Julian Foad <ju...@btopenworld.com>.
Kouhei Sutou wrote:
>   Julian Foad <ju...@btopenworld.com> wrote:
>>subversion/include/svn_nls.h needs to include "svn_types.h" to get the 
>>declaration of svn_error_t, so that it can stand alone (i.e. it should not 
>>require other files to have been included before it).
>>
>>subversion/libsvn_subr/nls.c needs to include svn_nls.h to get the prototypes 
>>of the functions that it implements, so that they can be verified to have the 
>>same signature.  I choose to have a compiler warning when that is not done.  It 
>>should include it before any other Subversion header files (and, ideally, 
>>before any other header files) to verify that "svn_nls.h" has no prerequisites.
>>
>>I can do this if you want - just say so.
> 
> +1
> Please do.

Done in r15403.  I looked at some of our other files and noticed that they are 
generally not including the header containing their prototypes before other 
headers, so they are not verifying the lack of prerequisites for their headers. 
  Therefore I didn't make that a goal of this commit.

- Julian

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

Re: nls.c and svn_nls.h (new files): insufficient #include statements

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

In <42...@btopenworld.com>
  "nls.c and svn_nls.h (new files): insufficient #include statements" on Sun, 24 Jul 2005 00:50:07 +0100,
  Julian Foad <ju...@btopenworld.com> wrote:

> subversion/include/svn_nls.h needs to include "svn_types.h" to get the 
> declaration of svn_error_t, so that it can stand alone (i.e. it should not 
> require other files to have been included before it).
> 
> subversion/libsvn_subr/nls.c needs to include svn_nls.h to get the prototypes 
> of the functions that it implements, so that they can be verified to have the 
> same signature.  I choose to have a compiler warning when that is not done.  It 
> should include it before any other Subversion header files (and, ideally, 
> before any other header files) to verify that "svn_nls.h" has no prerequisites.
> 
> I can do this if you want - just say so.

+1
Please do.


Cheers,
--
kou

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