getline: protect prototype better

2005-08-23 Thread Simon Josefsson
How about this?  If for some reason HAVE_DECL_GETLINE is not defined
at all, the header file fail to parse.  This uses the idiom that is
suggested by the autoconf manual.

2005-08-23  Simon Josefsson  [EMAIL PROTECTED]

* getline.h (getline): Protect prototype better.

--- getline.h   17 Jul 2005 11:39:14 +0200  1.16
+++ getline.h   23 Aug 2005 13:28:13 +0200  
@@ -23,6 +23,6 @@
 # include stdio.h
 # include sys/types.h
 
-#if !HAVE_DECL_GETLINE
+#if defined(HAVE_DECL_GETLINE)  !HAVE_DECL_GETLINE
 ssize_t getline (char **lineptr, size_t *n, FILE *stream);
 #endif /* !HAVE_GETLINE */


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: getline: protect prototype better

2005-08-23 Thread Ben Pfaff
Simon Josefsson [EMAIL PROTECTED] writes:

 How about this?  If for some reason HAVE_DECL_GETLINE is not defined
 at all, the header file fail to parse.  This uses the idiom that is
 suggested by the autoconf manual.

 2005-08-23  Simon Josefsson  [EMAIL PROTECTED]

   * getline.h (getline): Protect prototype better.

 --- getline.h 17 Jul 2005 11:39:14 +0200  1.16
 +++ getline.h 23 Aug 2005 13:28:13 +0200  
 @@ -23,6 +23,6 @@
  # include stdio.h
  # include sys/types.h
  
 -#if !HAVE_DECL_GETLINE
 +#if defined(HAVE_DECL_GETLINE)  !HAVE_DECL_GETLINE

A symbol that is not defined expands in the preprocessor to 0, so
the former should parse properly.  If it does not, then the
latter will not parse properly either.

The latter can be preferred because of its different meaning, not
because it should parse properly when the former does not.
Furthermore, in gnulib we know that the test will be performed,
so I don't see a reason to prefer the latter.
-- 
Ben Pfaff 
email: [EMAIL PROTECTED]
web: http://benpfaff.org



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: [bug-gnulib] getline: protect prototype better

2005-08-23 Thread Bruno Haible
Simon Josefsson wrote:
 How about this?  If for some reason HAVE_DECL_GETLINE is not defined
 at all, the header file fail to parse.

What's the point in trying to use lib/getline.c without m4/getline.m4 ?
We engage ourselves to maintain both in sync, since they are part of a
single gnulib module. Anyone using only the .c file but not the .m4 will
have endless maintenance problems anyway.

Bruno



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: getline: protect prototype better

2005-08-23 Thread Simon Josefsson
Bruno Haible [EMAIL PROTECTED] writes:

 Simon Josefsson wrote:
 This was also discovered while porting GNU SASL to uClinux.

 Perhaps I should investigate how difficult it would be to make uClinux
 run ./configure properly instead of maintaining the HAVE_* symbols
 manually.

 Definitely. uClinux has a shell and a compilation environment (and you can
 also cross-compile to it). That's exactly what autoconf was designed for.

Right, although now I was incorporating GNU SASL into the uClinux
build framework.  All autoconf based programs that have been ported
to uClinux appear to use hand-written Makefile's.  The reason I went
through the hassle of incorporating GNU SASL into the uClinux
framework was to get the tools included in the uClinux generated ROMFS
root file system automatically.  But it is likely much simpler to
cross-compile it first (which, incidentally, I've already done), and
manually move the tools on to the root file system.  I'll likely do
that, thanks for the heads-up.

Regards,
Simon


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: getline: protect prototype better

2005-08-23 Thread Bruno Haible
Simon Josefsson wrote:
 This was also discovered while porting GNU SASL to uClinux.

 Perhaps I should investigate how difficult it would be to make uClinux
 run ./configure properly instead of maintaining the HAVE_* symbols
 manually.

Definitely. uClinux has a shell and a compilation environment (and you can
also cross-compile to it). That's exactly what autoconf was designed for.

Bruno



___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib