PATCH 4 warning_off.diff some of these might be controversial but would eliminate 17 tons off warnings when compiling MFC/ATL and user code. I have found (the hard way) that GCC in some cases would produce none working code but will Just warn about it. Having thousands of warnings or turning warning off will eliminate the ability to catch these cases. I have found that most of the trivial warnings can be avoided with a few small tricks. here they are below. (for complete discussion of GCC's bad code please post me)
- include/msvcrt/mbstring.h This one will eliminate 1000 warnings in MFC and any using code The actual issue is definitely a mal-practice in the code of CString. But since MSVC does not care it was never fixed by MS . In effect it does nothing. ( I think code looks better, but that is subjective). It lets me a way to avoid these warnings when compiling MFC with -D_MBCS. (I did not currently managed to compile it with out it. And I did not even get to Unicode). This single patch would be very hard to maintain outside of wine. If any one has other suggestions I would be happy to hear them. for now it is the best I could do.
- include/msvcrt/stddef.h Lots of offsetof in MFC headers and code. GCC will automatically warn on use of this macro on c++ objects. Regardless if it is right or wrong to do so. (for a complete discussion of this topic just browse to www.gcc.org and search for "offsetof"). this patch will eliminate the warning. ( Maybe it is best to keep this patch separate)
? include/wine/winegccdef.h Index: include/msvcrt/mbstring.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/mbstring.h,v retrieving revision 1.4 diff -u -r1.4 mbstring.h --- include/msvcrt/mbstring.h 18 Jul 2003 22:57:15 -0000 1.4 +++ include/msvcrt/mbstring.h 10 Mar 2004 08:36:47 -0000 @@ -36,6 +36,12 @@ #define MSVCRT_SIZE_T_DEFINED #endif
+#ifdef MBCS_CHAR + typedef MBCS_CHAR mbs_char ; +#else + typedef unsigned char mbs_char ; +#endif + #ifndef MSVCRT_NLSCMP_DEFINED #define _NLSCMPERROR ((unsigned int)0x7fffffff) #define MSVCRT_NLSCMP_DEFINED @@ -64,66 +70,66 @@ unsigned int _mbbtombc(unsigned int); int _mbbtype(unsigned char,int); #define _mbccmp(_cpc1,_cpc2) _mbsncmp((_cpc1),(_cpc2),1) -void _mbccpy(unsigned char*,const unsigned char*); +void _mbccpy(mbs_char*,const mbs_char*); unsigned int _mbcjistojms(unsigned int); unsigned int _mbcjmstojis(unsigned int); -MSVCRT(size_t) _mbclen(const unsigned char*); +MSVCRT(size_t) _mbclen(const mbs_char*); unsigned int _mbctohira(unsigned int); unsigned int _mbctokata(unsigned int); unsigned int _mbctolower(unsigned int); unsigned int _mbctombb(unsigned int); unsigned int _mbctoupper(unsigned int); -int _mbsbtype(const unsigned char*,MSVCRT(size_t)); -unsigned char* _mbscat(unsigned char*,const unsigned char*); -unsigned char* _mbschr(const unsigned char*,unsigned int); -int _mbscmp(const unsigned char*,const unsigned char*); -int _mbscoll(const unsigned char*,const unsigned char*); -unsigned char* _mbscpy(unsigned char*,const unsigned char*); -MSVCRT(size_t) _mbscspn(const unsigned char*,const unsigned char*); -unsigned char* _mbsdec(const unsigned char*,const unsigned char*); -unsigned char* _mbsdup(const unsigned char*); -int _mbsicmp(const unsigned char*,const unsigned char*); -int _mbsicoll(const unsigned char*,const unsigned char*); -unsigned char* _mbsinc(const unsigned char*); -MSVCRT(size_t) _mbslen(const unsigned char*); -unsigned char* _mbslwr(unsigned char*); -unsigned char* _mbsnbcat(unsigned char*,const unsigned char*,MSVCRT(size_t)); -int _mbsnbcmp(const unsigned char*,const unsigned char*,MSVCRT(size_t)); -int _mbsnbcoll(const unsigned char*,const unsigned char*,MSVCRT(size_t)); -MSVCRT(size_t) _mbsnbcnt(const unsigned char*,MSVCRT(size_t)); -unsigned char* _mbsnbcpy(unsigned char*,const unsigned char* +int _mbsbtype(const mbs_char*,MSVCRT(size_t)); +mbs_char* _mbscat(mbs_char*,const mbs_char*); +mbs_char* _mbschr(const mbs_char*,unsigned int); +int _mbscmp(const mbs_char*,const mbs_char*); +int _mbscoll(const mbs_char*,const mbs_char*); +mbs_char* _mbscpy(mbs_char*,const mbs_char*); +MSVCRT(size_t) _mbscspn(const mbs_char*,const mbs_char*); +mbs_char* _mbsdec(const mbs_char*,const mbs_char*); +mbs_char* _mbsdup(const mbs_char*); +int _mbsicmp(const mbs_char*,const mbs_char*); +int _mbsicoll(const mbs_char*,const mbs_char*); +mbs_char* _mbsinc(const mbs_char*); +MSVCRT(size_t) _mbslen(const mbs_char*); +mbs_char* _mbslwr(mbs_char*); +mbs_char* _mbsnbcat(mbs_char*,const mbs_char*,MSVCRT(size_t)); +int _mbsnbcmp(const mbs_char*,const mbs_char*,MSVCRT(size_t)); +int _mbsnbcoll(const mbs_char*,const mbs_char*,MSVCRT(size_t)); +MSVCRT(size_t) _mbsnbcnt(const mbs_char*,MSVCRT(size_t)); +mbs_char* _mbsnbcpy(mbs_char*,const mbs_char* ,MSVCRT(size_t)); -int _mbsnbicmp(const unsigned char*,const unsigned char*,MSVCRT(size_t)); -int _mbsnbicoll(const unsigned char*,const unsigned char*,MSVCRT(size_t)); -unsigned char* _mbsnbset(unsigned char*,unsigned int,MSVCRT(size_t)) +int _mbsnbicmp(const mbs_char*,const mbs_char*,MSVCRT(size_t)); +int _mbsnbicoll(const mbs_char*,const mbs_char*,MSVCRT(size_t)); +mbs_char* _mbsnbset(mbs_char*,unsigned int,MSVCRT(size_t)) ; -unsigned char* _mbsncat(unsigned char*,const unsigned char*, +mbs_char* _mbsncat(mbs_char*,const mbs_char*, MSVCRT(size_t)); -MSVCRT(size_t) _mbsnccnt(const unsigned char*,MSVCRT(size_t)); -int _mbsncmp(const unsigned char*,const unsigned char*,MSVCRT(size_t)); -int _mbsncoll(const unsigned char*,const unsigned char*,MSVCRT(size_t)); -unsigned char* _mbsncpy(unsigned char*,const unsigned char*,MSVCRT(size_t)); -unsigned int _mbsnextc (const unsigned char*); -int _mbsnicmp(const unsigned char*,const unsigned char*,MSVCRT(size_t)); -int _mbsnicoll(const unsigned char*,const unsigned char*,MSVCRT(size_t)); -unsigned char* _mbsninc(const unsigned char*,MSVCRT(size_t)); -unsigned char* _mbsnset(unsigned char*,unsigned int,MSVCRT(size_t)); -unsigned char* _mbspbrk(const unsigned char*,const unsigned char*); -unsigned char* _mbsrchr(const unsigned char*,unsigned int); -unsigned char* _mbsrev(unsigned char*); -unsigned char* _mbsset(unsigned char*,unsigned int); -MSVCRT(size_t) _mbsspn(const unsigned char*,const unsigned char*); -unsigned char* _mbsspnp(const unsigned char*,const unsigned char*); -unsigned char* _mbsstr(const unsigned char*,const unsigned char*); -unsigned char* _mbstok(unsigned char*,const unsigned char*); -unsigned char* _mbsupr(unsigned char*); +MSVCRT(size_t) _mbsnccnt(const mbs_char*,MSVCRT(size_t)); +int _mbsncmp(const mbs_char*,const mbs_char*,MSVCRT(size_t)); +int _mbsncoll(const mbs_char*,const mbs_char*,MSVCRT(size_t)); +mbs_char* _mbsncpy(mbs_char*,const mbs_char*,MSVCRT(size_t)); +unsigned int _mbsnextc (const mbs_char*); +int _mbsnicmp(const mbs_char*,const mbs_char*,MSVCRT(size_t)); +int _mbsnicoll(const mbs_char*,const mbs_char*,MSVCRT(size_t)); +mbs_char* _mbsninc(const mbs_char*,MSVCRT(size_t)); +mbs_char* _mbsnset(mbs_char*,unsigned int,MSVCRT(size_t)); +mbs_char* _mbspbrk(const mbs_char*,const mbs_char*); +mbs_char* _mbsrchr(const mbs_char*,unsigned int); +mbs_char* _mbsrev(mbs_char*); +mbs_char* _mbsset(mbs_char*,unsigned int); +MSVCRT(size_t) _mbsspn(const mbs_char*,const mbs_char*); +mbs_char* _mbsspnp(const mbs_char*,const mbs_char*); +mbs_char* _mbsstr(const mbs_char*,const mbs_char*); +mbs_char* _mbstok(mbs_char*,const mbs_char*); +mbs_char* _mbsupr(mbs_char*);
#ifndef MSVCRT_MBLEADTRAIL_DEFINED #define MSVCRT_MBLEADTRAIL_DEFINED int _ismbblead(unsigned int); int _ismbbtrail(unsigned int); -int _ismbslead(const unsigned char*,const unsigned char*); -int _ismbstrail(const unsigned char*,const unsigned char*); +int _ismbslead(const mbs_char*,const mbs_char*); +int _ismbstrail(const mbs_char*,const mbs_char*); #endif /* MSVCRT_MBLEADTRAIL_DEFINED */
#ifdef __cplusplus Index: include/msvcrt/stddef.h =================================================================== RCS file: /home/wine/wine/include/msvcrt/stddef.h,v retrieving revision 1.7 diff -u -r1.7 stddef.h --- include/msvcrt/stddef.h 18 Jul 2003 22:57:15 -0000 1.7 +++ include/msvcrt/stddef.h 10 Mar 2004 08:36:47 -0000 @@ -56,7 +56,7 @@ #endif #endif
-#define offsetof(s,m) (size_t)&(((s*)NULL)->m) +#define offsetof(s,m) (((size_t)&(((s*)128)->m)) - 128 )
#ifdef __cplusplus