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

Re: [PATCH] Consolidating EOL functions to libsvn_subr/eol.c. (3rd try)

From: Edmund Wong <ed_at_kdtc.net>
Date: Thu, 20 Aug 2009 08:33:35 +0800

Julian Foad wrote:
> On Wed, 2009-08-19 at 09:02 +0800, Edmund Wong wrote:
>> Stefan Sperling wrote:
> [...]
>>>> +#include "svn_io.h"
>>>> +
>>>> +#include "svn_private_config.h"
>>>> +#include "private/svn_eol_private.h"
>>> It should still be possible to trim more headers.
>>> Maybe start with no header at all, and then add just the necessary
>>> headers to make it compile, one-by-one?
>> Thanks. I've done that but there is an item that I don't quite
>> understand. Since this is eol.c, should I not have
>> #include "private/svn_eol_private.h" in the header? Should it
>> (being the compiler) complain of a missing header if I were
>> to leave it out?
>>
>> I've whittled the headers down to two major ones and the
>> #include "private/svn_eol_private.h" one, but if I were to
>> take it out, the program still compiles. Does that mean
>> it isn't necessary to have his include line?
>
> A C file should always include the header that declares the functions it
> is defining. Doing so enables the compiler to check that the prototypes
> match the definitions. (To reinforce this practice, a compiler can warn
> if it sees a public (non-static) function for which it has not seen a
> prototype. For GCC, Subversion's Makefile uses the -Wmissing-prototypes
> option to do this.)

That's what I thought so which is why I don't understand why it
still compiles despite not having the header included. Anyway,
I've done the fixes. I need to keep my earnest in check.

Thanks for the help.

Edmund

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2385450
Received on 2009-08-20 02:38:43 CEST

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