bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: portability checks, errors and warnings


From: Paul Eggert
Subject: Re: portability checks, errors and warnings
Date: Sun, 04 Feb 2007 00:20:39 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

> I'm worried that if you activate the replacement
>   # define strstr rpl_strstr
> with its lib/strstr.o file depending on _GL_CHECK_PORTABILITY, or if you
> activate the declaration
>   extern char *strstr (char const *__haystack, char const *__needle);
> only if _GL_CHECK_PORTABILITY, then the program may compile fine with
> _GL_CHECK_PORTABILITY and break without it.

I don't see how that could happen.  If _GL_CHECK_PORTABILITY is
defined, we have "# define strstr rpl_strstr" and "extern char
*rpl_strstr (...);".  That can work only if a strstr.o has been built,
which means HAVE_STRSTR was not defined, which means "# define strstr
rpl_strstr" and "extern char *rpl_strstr (...);" are already in effect.

>>      #if ! @HAVE_STRSTR@
>>      # undef strstr
>>      # define strstr rpl_strstr
>>      #endif
>
> As mentioned above, for some functions, no "# define strstr rpl_strstr"
> is desired.

As I understand it, this is for convenience in debugging.  I suppose
that might be worthwhile in some cases.  So I guess I should go back
to @address@hidden

> What does "otherwise" mean? Either 'configure' finds the system's strstr
> OK or it finds problems. What is the third alternative?

The third alternative is that 'configure' does not check whether the
the system's strstr is OK.

Here's the proposal again, amended as per the above:

     #if @REPLACE_STRSTR@
     # undef strstr
     # define strstr rpl_strstr
     #endif
     #if @REPLACE_STRSTR@ || ! @HAVE_DECL_STRSTR@
     extern char *strstr (char const *__haystack, char const *__needle);
     #endif

   @REPLACE_STRSTR@ is:

     0 if 'configure' checks the system strstr and found it to be OK
     or absent.

     1 if 'configure' checks the system strstr and found that it
     exists but has problems.

     _GL_CHECK_PORTABILITY if 'configure' did not check the system
     strstr.

     Maintainers can compile with -D_GL_CHECK_PORTABILITY to
     enable portability checking.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]