Package: mingw32
Version: 4.2.1.dfsg-1
Severity: normal

Mingw32 libc does not like using errno as a function argument name, when 
stdlib.h is included.

Example:

#include <stdlib.h>

int foo(int errno)
{
 ...
}
....
foo(42);

after 
 
i586-mingw32-msvc-gcc test.c -o test

/ !!! complaining about integer-to-pointer cast !!! /

../test

It dies with segmentation fault.


After manually running i586-mingw32-msvc-cpp, I got the following:
....
int foo(int (*_errno()))
{
 ...
}

Of course this program dies with a segfault, because it gets a function pointer 
instead of an int!


Actually the problem is in stdlib.h: errno is a macro, as bug #162576 (of 
libc6-dev) says. In libc6-dev, the problem is solved, the libc6 version of 
stdlib.h does not include errno.h, so this error is avoided.

But mingw32 declares it's own errno to have MS compatibility in stdlib.h 
(actually, BOTH stdlib.h and errno.h declares errno)

My question is: does errno must be declared as a macro, and if it must, is 
there a possible solution to avoid this kind of error, without modifying my 
source?



-- System Information:
Debian Release: lenny
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.25wgj (SMP w/1 CPU core)
Locale: LANG=hu_HU.UTF-8, LC_CTYPE=hu_HU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages mingw32 depends on:
ii  libc6                 2.7-13             GNU C Library: Shared libraries
ii  mingw32-binutils      2.18.50-20080109-1 Minimalist GNU win32 (cross) binut
ii  mingw32-runtime       3.13-1             Minimalist GNU win32 (cross) runti

mingw32 recommends no packages.

Versions of packages mingw32 suggests:
pn  cpp-doc                       <none>     (no description available)
pn  gcc-doc                       <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to