[Top][All Lists]

[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: Fri, 02 Feb 2007 14:34:46 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Therefore all problems that installers would face from this technique
> will be noticeable by the maintainer already.

No, because the code might look like this (taken from mountlist):

#ifdef MOUNTED_VMOUNT           /* AIX.  */
        ignore = strstr (options, "ignore");

If the maintainer uses GNU/Linux, he won't see the use of strstr,
because the code is AIX-only.

The use is perfectly reasonable, since AIX always has strstr.
But our string.h replacement will replace strstr with an
unportability warning, so the installer will have a problem.

> Indeed that deserves some documentation. Here is a beginning:

I already understood the details.  But the combination of the details
in the current code is still confusing, at least to me.  There is too
much complexity for what ought to be a fairly simple thing.

> Hmm, I would much prefer if we could keep the facility for replacement / fixup
> of portability problems separate from the facility for detecting the 
> portability
> problems. Otherwise setting _GL_CHECK_PORTABILITY may hide portability
> problsm - which would defeat its purpose.

I don't see how setting it would hide portability problems.  What's the
scenario you're worried about?

>> @RPL_@ is normally rpl_ but could be something else if we
>> want to support multiple libraries.
> You don't need this. You can use rpl_ always.

Yay!  Thanks, that simplifies it a bit.  Also, I noticed that HAVE_
and REPLACE_ are inverses, which simplifies things even more, to this:

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

   @HAVE_STRSTR@ is:

     1 if 'configure' checks the system strstr and found it to be OK.

     0 if 'configure' checks the system strstr and found problems.

     (!_GL_CHECK_PORTABILITY) otherwise.

     Maintainers can compile with -D_GL_CHECK_PORTABILITY to
     enable portability checking.

reply via email to

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