From: SF/projects/mingw n. l. <min...@li...> - 2012-10-23 17:10:35
|
Bugs item #3022047, was opened at 2010-06-27 10:13 Message generated for change (Comment added) made by earnie You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3022047&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: WSL (Windows System Libraries) >Group: Aged issue >Status: Pending >Resolution: None Priority: 5 Private: No Submitted By: Ramiro Polla (caldo_de_cana) Assigned to: Nobody/Anonymous (nobody) Summary: str[n]casecmp not declared under __STRICT_ANSI__ Initial Comment: $ cat strings.c #include <strings.h> void foo(void) { strcasecmp(NULL, NULL); strncasecmp(NULL, NULL, 0); } $ i686-mingw32-gcc -o strings.o -c strings.c -std=c99 -Werror=implicit-function-declaration strings.c: In function 'foo': strings.c:5: error: implicit declaration of function 'strcasecmp' strings.c:6: error: implicit declaration of function 'strncasecmp' $ cat strcasecmp.diff --- /usr/i686-mingw32/include/string.h.orig 2010-06-27 13:46:10.000000000 -0300 +++ /usr/i686-mingw32/include/string.h 2010-06-27 14:01:04.000000000 -0300 @@ -116,6 +116,9 @@ #endif /* _UWIN */ #endif /* _NO_OLDNAMES */ +#else +int __cdecl __MINGW_NOTHROW strcasecmp (const char*, const char *); +int __cdecl __MINGW_NOTHROW strncasecmp (const char *, const char *, size_t); #endif /* Not __STRICT_ANSI__ */ #ifndef _WSTRING_DEFINED $ sudo patch -p0 < strcasecmp.diff patching file /usr/i686-mingw32/include/string.h $ i686-mingw32-gcc -o strings.o -c strings.c -std=c99 -Werror=implicit-function-declaration $ ---------------------------------------------------------------------- >Comment By: Earnie Boyd (earnie) Date: 2012-10-23 10:10 Message: Decide what to do with this. Strings.h is provided for compilability and simply includes string.h. I need a good C99 reference. ---------------------------------------------------------------------- Comment By: Ratio (ratio2) Date: 2011-02-09 07:27 Message: -std=c99 define __STRICT_ANSI__ macro and disable strcasecmp build-in gcc function __STRICT_ANSI__ macro can/must remove strcasecmp from string.h but not need remove strcasecmp from strings.h, because header is not part of c standard library strings.h header is part of POSIX and external for compiler in c99 mode because in c99 mode compiler don't know about strcasecmp, we can safely use it outside standard c99 headers "strcasecmp is defined in strings.h, which is not part of C99. So -std=c99 vs. -std=gnu99 shouldn't have any affect." http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-July/092878.html ---------------------------------------------------------------------- Comment By: Ramiro Polla (caldo_de_cana) Date: 2010-08-20 14:52 Message: Sorry, I have not found documentation linking it to C99. This assumption was based on comments from other people. I have found it defined in POSIX[1]. It is defined under _BSD_SOURCE on glibc and _POSIX_C_SOURCE on macosx. I know Windows doesn't supply POSIX functionality but this function is already being provided by mingw, it would be nice to have its definition as well. [1] http://www.opengroup.org/onlinepubs/9699919799/functions/strcasecmp.html ---------------------------------------------------------------------- Comment By: Earnie Boyd (earnie) Date: 2010-07-12 04:57 Message: You will need to point me to the documentation that says this is part of C99. ---------------------------------------------------------------------- Comment By: Ramiro Polla (caldo_de_cana) Date: 2010-07-08 08:57 Message: Hi Earnie, As you might have noticed on my last reply, I have already acknowledged that checking for ansi is the wrong way to go. This function is actually part of c99, just like gettimeofday(), which you already support (even under -ansi, which is probably a bug). The check should probably go under "__STDC_VERSION__ >= 199901L" (which you also already have in a few places). ---------------------------------------------------------------------- Comment By: Earnie Boyd (earnie) Date: 2010-07-06 14:33 Message: Windows doesn't supply POSIX functionality and therefore __STRICT_ANSI__ is still incorrect if you want these functions; so, no, there is no feature request that would be accepted. ---------------------------------------------------------------------- Comment By: Ramiro Polla (caldo_de_cana) Date: 2010-07-06 10:43 Message: Sorry, I got the wrong standard... 'man strcasecmp' says 4.4BSD, POSIX.1-2001. It should be available under some other ifdef then. (Is it possible to change the bug title? I couldn't figure out how. should I open a feature request?) ---------------------------------------------------------------------- Comment By: Earnie Boyd (earnie) Date: 2010-07-06 08:43 Message: strcasecmp and strncasecmp are not ANSI required. Therefore of course __STRICT_ANSI__ is going to exclude them. The fix therefore is to not use __STRICT_ANSI__ if you want to use these functions. ---------------------------------------------------------------------- Comment By: Christophe PARIS (toffparis) Date: 2010-07-03 12:26 Message: Thanks for the fix. I'm having the same problem here trying to cross-compile ffmpeg. hope it will be officially fixed soon. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3022047&group_id=2435 |