strdup visibility

marco atzeri marco.atzeri@gmail.com
Mon Feb 8 12:36:04 GMT 2021


On Mon, Feb 8, 2021 at 7:57 AM Yaakov Selkowitz via Cygwin-developers wrote:
>
> On Mon, 2021-02-08 at 04:04 +0100, Marco Atzeri via Cygwin-developers wrote:
> > currently we have in  /usr/include/string.h
> >
> > #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
> > char    *strdup (const char *) __malloc_like __result_use_check;
> > #endif
> >
> >
> > but the function was moved to POSIX base some time ago
> > https://pubs.opengroup.org/onlinepubs/9699919799/functions/strdup.html
> >
> > should the conditional dropped ? Or I misunderstand it?
>
> Anything that is an extension in the ANSI C headers is conditionalized.  Those
> conditions match the progressive standardization of this function and it's
> eventual inclusion in POSIX-1.2008.
>
> Have you run into a real-world issue with these conditions?
>
> --
> Yaakov

I saw several source code expecting to access "strdup"
thelast one was Graphviz.

The fast solution, for me, is just to drop a
     #define _GNU_SOURCE 1
on config.h between cygconf and cygmake

Regards
Marco


More information about the Cygwin-developers mailing list