Hi Rafaël,

On Sat, 26 Jul 2014 12:52:44 +0200, Rafaël Carré <fun...@videolan.org> wrote:
> On 07/21/14 23:21, Stephen Kitt wrote:
> >    * Merge upstream implementation of strtok_r, so it's available on
> >      Windows XP. Thanks to Gianluigi Tiesi for pointing out the problem,
> >      and to Jonathan Young for pointing out that he'd fixed it upstream.
> >      (Closes: #755448.)
> 
> This change breaks VLC, as the strtok_r prototype is not available anymore.
> 
> According to:
> http://anonscm.debian.org/gitweb/?p=collab-maint/mingw-w64.git;a=blobdiff;f=debian/patches/strtok_r.patch;h=95e4b5e974f19b5725ad3bd349ac74ec6b2d994d;hp=c4aa476dd10754657fe752ee1aeab9cfa4871a83;hb=8625b8bcfd8a66d92ddbb76391e25ddf9e077857;hpb=362f462455a593a5316c72fdf39dc6df342b3da5
> the prototype is only defined under the condition:
> #if defined (_SVID_SOURCE) || defined (_BSD_SOURCE) || (_POSIX_C_SOURCE
> >= 1) || defined(_XOPEN_SOURCE) || defined (_POSIX_SOURCE)

This condition perfectly matches the glibc strtok_r documentation (see
http://man7.org/linux/man-pages/man3/strtok.3.html for example or your local
glibc documentation). But POSIX doesn't specify any conditions (see
http://pubs.opengroup.org/onlinepubs/009695399/functions/strtok.html for
details).

> However autoconf defines neither of these, but only _GNU_SOURCE
> 
> glibc's features.h defines all the above features if _GNU_SOURCE is defined,
> but mingw-w64 does not.

I'm not sure it makes sense for mingw-w64 to support _GNU_SOURCE, because
_GNU_SOURCE requests GNU extensions, which aren't available in the Microsoft
runtime. (One could argue that this could be used to request GNU-compatible
extensions provided by mingw-w64 of course...)

> I suggest removing the ifdef altogether, as strtok_r will always be
> available.

Strictly speaking, VLC should define one of the relevant _SOURCE macros
(beyond _GNU_SOURCE) to conform to the glibc documentation (on glibc
platforms), and that would fix the problem as a side-effect on mingw-w64. But
I agree with you, removing the ifdef in mingw-w64 should be fine and would
also fix the problem...

Regards,

Stephen

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to