From: Kai Tietz <ktietz70@googlemail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: asmwarrior@gmail.com, tromey@redhat.com, yao@codesourcery.com,
gdb-patches@sourceware.org
Subject: Re: [MinGW-w64]Build gdb/ctf.c failed
Date: Mon, 25 Mar 2013 16:14:00 -0000 [thread overview]
Message-ID: <CAEwic4aPEWywfDQLqPYdUsoOxqv4zr4eFrHDEb2EtoJjOApsVg@mail.gmail.com> (raw)
In-Reply-To: <83wqsv1v4b.fsf@gnu.org>
2013/3/25 Eli Zaretskii <eliz@gnu.org>:
>> Date: Mon, 25 Mar 2013 13:42:52 +0100
>> From: Kai Tietz <ktietz70@googlemail.com>
>> Cc: asmwarrior@gmail.com, tromey@redhat.com, yao@codesourcery.com,
>> gdb-patches@sourceware.org
>>
>> So, you claimed MinGW-w64 did something wrong ... well, if we wouldn't
>> declare mkdir here, indeed it would be worth a bug-report ...
>
> Actually, Posix says mkdir should be in sys/stat.h, not in unistd.h.
> And it looks like MinGW64 does indeed have mkdir in stat.h, not in
> unistd.h. Which IMO is another unfortunate incompatibility with
> mingw.org.
Well, our sys/stat.h header depends on io.h and by this it gets also
the mkdir prototype. From our POV this is the proper thing to do
here.
>> So what differences you were talking about?
>
> The difference that caused the warning -- the fact that _mkdir's
> prototype was not visible after including unistd.h.
Right, and it isn't something POSIX requests. So well, we could
prototype it in io.h header, too. But well, I can put apple-juice
into a milk-bottle, and technical it is ok, but logical people
wouldn't expect it there. It is an MS extension, so include proper
header for it ...
>> The function mkdir is declared for MinGW.org, and for MinGW-w64. It
>> is the POSIX compliant API name and both ventures are declaring it
>> in an POSIX-helper header.
>
> Yes (but see below about its Posix nature).
>
>> So you mean yet _mkdir?
>
> Yes, of course. _mkdir was the reason for the compiler warning. If
> it were declared in io.h, then the warning would not have been
> emitted.
And here is the confusion. See aboive that _mkdir is an MS extension
and you shouldn't expect that declared as side-effect. Actual that
you get it by mingw.org's unistd.h is an implementation detail you
should never rely on.
>> if you want to use a posix function, include the corresponding posix
>> header; if you want to a MS API, use the header MS defines the
>> function/interface lives in. it wouldn't really help portability
>> (in either direction) to support including a posix header, and
>> getting a MS API function, so mingw doesn't lay its headers that
>> way.
>
> Unfortunately, this isn't so simple, as MS API offers mkdir as well
> (see direct.h in any MS SDK), albeit while discouraging/deprecating
> its use:
Well, we are pretty aware about that, but it doesn't make it more
reasonable why _mkdir should be declared by unistd.h header (or io.h
header). Actual mingw-w64 even provides a feature to warn about his
deprecated API, if you are eager to see that.
> http://msdn.microsoft.com/en-us/library/vstudio/ms235326%28v=vs.100%29.aspx
>
> Thus, mkdir is both a Posix API and an MS API. Moreover, the Posix
> mkdir accepts 2 arguments, not one. So what MinGW provides is not
> really a Posix API, but rather a slightly incompatible variant
> thereof.
Yeah, that is something created by history ... I admit that unistd.h
should better do actual the define for mkdir ... not sure how many
ventures might get affected for their Windows port here. Additional a
define has the disadvantage of not providing proper function-point
feature, but a static function in header might cause other issues ...
>> The header io.h isn't a POSIX one, and therefore you should just
>> expect what actual is documented by vendor (in msdn) for it and not
>> what one implementation mightz does.
>
> MinGW's unistd.h includes io.h, and thus gets both mkdir and _mkdir.
Yeah, and that's an implementation detail and IMHO even a bug, because
msdn is documenting it differently ... but well that is in this case
just nit-picking.
> One could perhaps argue that this is or isn't a mistake, but given the
> precedence, having a different arrangement in MinGW64 is unfortunate,
> since it will mean more #ifdef'ing in the projects that want to
> support both. For yet another example of such incompatibilities, see
Yeah, therefore don't rely on implementation details.
> http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00611.html
Yeah, saw that too.
next prev parent reply other threads:[~2013-03-25 13:30 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-15 2:02 New ARI warning Fri Mar 15 02:02:12 UTC 2013 in -D 2013-03-15-gmt GDB Administrator
2013-03-15 9:05 ` Yao Qi
2013-03-15 9:48 ` Compilation failure for mingw64 target (was New ARI warning Fri Mar 15 02:02:12 UTC 2013 in -D 2013-03-15-gmt) Pierre Muller
2013-03-15 11:06 ` Yao Qi
2013-03-15 11:24 ` Pierre Muller
2013-03-15 14:05 ` Yao Qi
2013-03-15 14:43 ` Yao Qi
2013-03-15 16:52 ` Tom Tromey
2013-03-15 16:55 ` Pierre Muller
[not found] ` <20313.4872871034$1363366373@news.gmane.org>
2013-03-15 17:01 ` Tom Tromey
2013-03-15 18:22 ` Eli Zaretskii
2013-03-15 18:24 ` Tom Tromey
2013-03-15 18:33 ` Eli Zaretskii
2013-03-15 18:53 ` Mike Frysinger
2013-03-15 18:58 ` Eli Zaretskii
2013-03-15 19:45 ` Mike Frysinger
2013-03-16 4:23 ` [PATCH 0/3] Fix build failure caused by ctf.c Yao Qi
2013-03-16 4:23 ` [PATCH 2/3] Write CTF in host byte order Yao Qi
2013-03-19 21:26 ` Joel Brobecker
2013-03-20 3:48 ` Yao Qi
2013-03-16 4:23 ` [PATCH 3/3] Don't use unportable macros Yao Qi
2013-03-19 17:12 ` Doug Evans
2013-03-20 2:48 ` Yao Qi
2013-03-20 15:17 ` Doug Evans
2013-03-21 1:58 ` Yao Qi
2013-03-20 17:36 ` Eli Zaretskii
2013-03-20 17:40 ` Tom Tromey
2013-03-25 4:08 ` [MinGW-w64]Build gdb/ctf.c failed asmwarrior
2013-03-25 6:41 ` asmwarrior
2013-03-25 8:28 ` Yao Qi
2013-03-25 8:39 ` Eli Zaretskii
2013-03-25 8:40 ` Eli Zaretskii
2013-03-25 9:15 ` Kai Tietz
2013-03-25 9:42 ` Yao Qi
2013-03-25 10:12 ` Kai Tietz
2013-03-25 12:43 ` Eli Zaretskii
2013-03-25 14:40 ` Yao Qi
2013-03-25 9:54 ` Eli Zaretskii
2013-03-25 10:50 ` Kai Tietz
2013-03-25 13:12 ` Eli Zaretskii
2013-03-25 13:21 ` Kai Tietz
2013-03-25 14:25 ` Eli Zaretskii
2013-03-25 15:18 ` Kai Tietz
2013-03-25 15:44 ` Eli Zaretskii
2013-03-25 16:14 ` Kai Tietz [this message]
2013-03-25 16:25 ` Eli Zaretskii
2013-03-16 7:35 ` [PATCH 1/3] Import mkdir module Yao Qi
2013-03-19 16:32 ` Doug Evans
2013-03-19 17:20 ` Eli Zaretskii
2013-03-19 21:23 ` Joel Brobecker
2013-03-15 16:22 ` New ARI warning Fri Mar 15 02:02:12 UTC 2013 in -D 2013-03-15-gmt Pedro Alves
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=CAEwic4aPEWywfDQLqPYdUsoOxqv4zr4eFrHDEb2EtoJjOApsVg@mail.gmail.com \
--to=ktietz70@googlemail.com \
--cc=asmwarrior@gmail.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
--cc=yao@codesourcery.com \
/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