On 11/7/14, Dongsheng Song <dongsheng.s...@gmail.com> wrote:
> On Fri, Nov 7, 2014 at 7:51 PM, Ozkan Sezer <seze...@gmail.com> wrote:
>> On 11/7/14, Ray Donnelly <mingw.andr...@gmail.com> wrote:
>>> On Fri, Nov 7, 2014 at 11:10 AM, Ozkan Sezer <seze...@gmail.com> wrote:
>>>> On 11/7/14, Ruben Van Boxem <vanboxem.ru...@gmail.com> wrote:
>>>>> 2014-11-07 9:25 GMT+01:00 Ozkan Sezer <seze...@gmail.com>:
>>>>>
>>>>>> On 11/7/14, Dongsheng Song <dongsheng.s...@gmail.com> wrote:
>>>>>> > If we define _POSIX_, then getpid (process.h) was hidden.
>>>>>> > Is it correct ?
>>>>>> >
>>>>>> > PS: MSVC 2012 is the last compiler which use _POSIX_, MSVC 2013 do
>>>>>> > not
>>>>>> > use _POSIX_ anymore.
>>>>>> > MSVC 2012/2013 guard getpid with !__STDC__.
>>>>>>
>>>>>> I believe (but not necessarily correct about iıt) that MSVC's _POSIX
>>>>>> symbol is intended for diffrerent purposes, i.e. windows posix
>>>>>> subsystem,
>>>>>> and I believe that we are doing a wrong thing with having those _POSIX
>>>>>> ifdefs in our headers..  Someone correct me if I'm wrong.
>>>>>>
>>>>>
>>>>> I have no idea, but be aware at least one reference in GCC showed up:
>>>>> https://gcc.gnu.org/bugzilla/attachment.cgi?id=20034&action=edit
>>>>>
>>>>> But maybe that's there exactly because _POSIX is in the MinGW-w64
>>>>> headers...
>>>>
>>>> I remember that they defined _POSIX only because mingw-w64 headers
>>>> required it for certain declarations
>>>
>>> Also, should we consider renaming _POSIX to _POSIX_SOURCE?
>>>
>>
>> What I am saying is that those two have different meanings.
>> If we ever get rid of _POSIX we will possibly need to remove
>> certain stuff too. Things that currently are guarded by _POSIX
>> but should actually be guarded by _POSIX_SOURCE are there too
>> and they are another part of the story.
>>
>
> During port libressl to Windows, I feel very painful on such macros.
> I want to use _POSIX_C_SOURCE to replace _POSIX, _POSIX_,
> _POSIX_SOURCE in all headers.
> The first is normalization in _mingw.h.in:
>
> --- a/mingw-w64-headers/crt/_mingw.h.in
> +++ b/mingw-w64-headers/crt/_mingw.h.in
> @@ -7,6 +7,26 @@
>  #ifndef _INC__MINGW_H
>  #define _INC__MINGW_H
>
> +#if defined(_POSIX) || defined(_POSIX_) \
> +       || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE)  \
> +       || defined(_REENTRANT) || defined(_THREAD_SAFE) ||
> defined(_POSIX_THREAD_SAFE_FUNCTIONS)
> +
> +/* This has been superseded by _POSIX_C_SOURCE. */
> +#ifndef _POSIX_SOURCE
> +#define _POSIX_SOURCE 1
> +#endif
> +
> +/* Functions like wcscasecmp() and strnlen() were only added in
> POSIX.1-2008 */
> +#ifndef _POSIX_C_SOURCE
> +#define _POSIX_C_SOURCE 200809L
> +#endif
> +
> +#if (defined(_REENTRANT) || defined(_THREAD_SAFE)) &&
> !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
> +#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
> +#endif
> +
> +#endif
> +
>
> comments ?

I'd say that this is lazy and wrong.  IMO, doing it right way should be
changing the correct (only the correct) _POSIX guards to _POSIX_SOURCE
instead, and hope that the project requesting such features are actually
defining _POSIX_SOURCE. (you should possily also cover _GNU_SOURCE, etc)

--
O.S.

------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to