git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Faye-Lund <kusmabite@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: mduft@gentoo.org, git@vger.kernel.org
Subject: Re: [PATCH 2/2] Include unistd.h.
Date: Wed, 25 May 2011 23:52:44 +0200	[thread overview]
Message-ID: <BANLkTi=w1hpmrK8_Vv8vTLtDF+qf6cETEw@mail.gmail.com> (raw)
In-Reply-To: <7vd3j64oq6.fsf@alter.siamese.dyndns.org>

On Wed, May 25, 2011 at 8:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
> mduft@gentoo.org writes:
>
>> At least on Interix, NULL is defined in unistd.h, and not including it
>> causes compilation failure.
>>
>> Signed-off-by: Markus Duft <mduft@gentoo.org>
>> ---
>>  compat/fnmatch/fnmatch.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c
>> index 14feac7..0238cca 100644
>> --- a/compat/fnmatch/fnmatch.c
>> +++ b/compat/fnmatch/fnmatch.c
>> @@ -25,6 +25,7 @@
>>  # define _GNU_SOURCE 1
>>  #endif
>>
>> +#include <unistd.h>
>>  #include <errno.h>
>>  #include <fnmatch.h>
>>  #include <ctype.h>
>
> The header stddef.h is where NULL is supposed to be defined, and commonly
> used headers are supposed to define NULL the same way as stddef.h does.
> There is a conditional inclusion of stdlib.h in fnmatch.c and stdlib.h is
> one of those files; probably that is how the upstream pulls in NULL when
> compiling this.
>
> But we don't define STDC_HEADERS nor _LIBC (and we shouldn't), so I don't
> know how the existing users of compat/fnmatch/ gets the defintion of NULL
> from. Output from "gcc -E -dD -DNO_FNMATCH compat/fnmatch/fnmatch.c" does
> not seem to show any NULL defined.
>
> Other platforms (e.g. SunOS, IRIX, HPUX, Windows) use NO_FNMATCH_CASEFOLD
> and compile this file.  How are they getting their NULLs?

Windows/MinGW:

$ gcc -E -dD -DNO_FNMATCH compat/fnmatch/fnmatch.c | grep NULL
compat/fnmatch/fnmatch.c:29:21: error: fnmatch.h: No such file or directory
#define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
#undef __need_NULL
#define __need_NULL
#undef NULL
#define NULL ((void *)0)
#undef __need_NULL

The "#define NULL ((void *)0)"-line comes from stddef.h, which is
included from string.h, which in turn is included by fnmatch.c.

  parent reply	other threads:[~2011-05-25 21:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 14:15 [PATCH] Interix catch-ups for recent changes/releases mduft
2011-05-25 14:15 ` [PATCH 1/2] Add additional build options for Interix, and remove obsolete ones mduft
2011-05-25 17:51   ` Junio C Hamano
2011-05-26  6:29   ` Markus Duft
2011-05-26 18:06     ` Junio C Hamano
2011-05-25 14:15 ` [PATCH 2/2] Include unistd.h mduft
2011-05-25 18:30   ` Junio C Hamano
2011-05-25 20:37     ` Tor Arntsen
2011-05-25 21:00       ` Junio C Hamano
2011-05-25 21:52     ` Erik Faye-Lund [this message]
2011-05-26  2:20   ` Jonathan Nieder
2011-05-26 15:48     ` Junio C Hamano
2011-05-26 16:39       ` Jonathan Nieder
2011-05-30  6:51         ` Markus Duft
2011-06-15  9:31           ` Markus Duft
2011-06-15  9:48             ` Jonathan Nieder
2011-06-15 11:34               ` [PATCH] Update the Interix default build configuration mduft
2011-05-27  6:27   ` [PATCH 2/2] Include unistd.h Markus Duft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=w1hpmrK8_Vv8vTLtDF+qf6cETEw@mail.gmail.com' \
    --to=kusmabite@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mduft@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).