Hello,

2009/10/22 Sisyphus <[email protected]>:
> Hi,
> The test script (try.c):
>
> ###############################
> C:\_32\C>type try.c
> #include <stdio.h>
>
> int main(void) {
>
> #ifdef NO_OLDNAMES
> printf("\"NO_OLDNAMES\" defined\n");
> #else
> printf("\"NO_OLDNAMES\" not defined\n");
> #endif
>
> #define popen 1
>
> printf("%d\n", popen);
>
> return 0;
>
> }
>
>
> C:\_32\C>
> ###############################
>
> Irrespective of whether I compile that script with mingw32 (either 3.4.5 or
> 4.4.0) or mingw64 (4.5.0), the executable outputs the same:
>
> ###############################
> C:\_32\C>try
> "NO_OLDNAMES" not defined
> 1
>
> C:\_32\C>
> ###############################
>
> No problem with that ... what puzzles me is that, while the script compiles
> silently with mingw32 (even with '-pedantic -Wall') when I compile with
> mingw64 I get a warning about popen being redefined:
>
> ###############################
> C:\_32\C>x86_64-w64-mingw32-gcc -o try.exe try.c
> try.c: In function 'main':
> try.c:12:0: warning: "popen" redefined
> c:/_64/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/stdio.h:213:0: note:
> this is the location of the previous definition
Well, I am not sure why we used here define instead of prototyping.
IIRC it had something to do with previous defined popen, but I think I
can solve this better here.

> C:\_32\C>
> ###############################
>
> Why the difference ? (It's not so much a question of "Why do I get that
> warning with mingw64 ?" ... rather, what puzzles me is "Why *don't* I get
> that warning with mingw32 ?".)
Well you would get a error by mingw.org, if you would define popen
before including headers.

> The relevant section of mingw64's stdio.h is:
>
> 212: #if !defined(NO_OLDNAMES) && !defined(popen)
> 213: #define popen      _popen
> 214: #define pclose     _pclose
> 215: #endif
>
> With mingw32's stdio.h, we have:
>
> #ifndef NO_OLDNAMES
> _CRTIMP FILE* __cdecl __MINGW_NOTHROW popen (const char*, const char*);
> _CRTIMP int __cdecl __MINGW_NOTHROW pclose (FILE*);
> #endif
>
> Is the redefinition not taking place with mingw32 ? ... or is it just that
> no warning is being produced ?
> (I'm currently looking at "__MINGW_NOTHROW" and wondering what it does.)
>
> Does anyone have info on what "NO_OLDNAMES" is about, and/or the
> ramifications of explicitly defining it ?

NO_OLDNAMES is an option to hide old API, which is deprecated by MS.
These are mainly POSIX function names.

> When building perl with mingw64, I'm getting lots of warnings about popen
> and pclose being redefined  - and I'd like a good way of getting rid of
> them. (I also get the same warnings when building perl modules, as popen and
> pclose are defined in perl's XSUB.h.)
>
> See below for the respective 'gcc -v' outputs.
>
> Cheers,
> Rob
>

Cheers,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to