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

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 ?".)

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 ?

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

For mingw64:
#############################
C:\_32\C>x86_64-w64-mingw32-gcc -v
Using built-in specs.
Target: x86_64-w64-mingw32
Configured with: 
../../../build/gcc/gcc/configure --target=x86_64-w64-mingw32 
--prefix=/c/buildbot/vista64-mingw32/mingw-x86-x86_64/build/build/root 
 --with-sysroot=/c/buildbot/vista64-mingw32/mingw-x86-x86_64/build/build/root 
--enable-languages=all,obj-c++ --enable-fully-dynamic-string 
--disable-multilibThread model: win32gcc version 4.5.0 20090819 (experimental) 
(GCC)#############################For 
mingw32:#############################C:\_32\C>gcc -vReading specs 
fromC:/home/rob/mingw_vista/i686-pc-mingw32/bin/../lib/gcc/i686-pc-mingw32/3.4.5/specsConfigured
 with:../gcc-3.4.5-20060117-1/configure --with-gcc --with-gnu-ld --with-gnu-as 
--host=i686-pc-mingw32 --target=i686-pc-mingw32 --prefix=/home/rob/mingw_vista 
--enable-threads=win32 --disable-nls --enable-languages=c,c++,f77 
--disable-win32-registry --disable-shared --enable-sjlj-exceptions --without-x 
--enable-interpreter --enable-hash-synchronization --disable-bootstrap 
--build=i686-pc-linux-gnuThread model: win32gcc version 3.4.5 (mingw 
special)#############################

------------------------------------------------------------------------------
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