some ideas for new janitorial projects
Francois Gouget
fgouget at free.fr
Wed May 19 06:44:31 CDT 2004
Here are a couple extra suggestions:
* Add -Wwrite-strings
There has already been quite some work on this but I believe it's not
finished yet. I'm not 100% sure of the status though.
* Patch ou min/max macros to catch signed/unsigned comparisons.
This generates a lot of warnings. Ideally they should be fixed
without using casts but it may not always be possible.
(the modified min/max macros where borrowed from a Linux kernel patch)
Index: include/minmax.h
===================================================================
RCS file: /var/cvs/wine/include/minmax.h,v
retrieving revision 1.2
diff -u -r1.2 minmax.h
--- a/include/minmax.h 10 Mar 2002 00:02:34 -0000 1.2
+++ b/include/minmax.h 18 Oct 2003 11:34:30 -0000
@@ -21,11 +21,34 @@
#ifndef __WINE_MINMAX_H
#define __WINE_MINMAX_H
+#if (defined(WINE_MINMAX) || defined(__WINESRC__)) && defined(__GNUC__)
+#ifndef max
+#define max(x,y) \
+ ({ const typeof(x) _x = x; \
+ const typeof(y) _y = y; \
+ \
+ (void) (&_x == &_y); \
+ \
+ (typeof(x))(_x > _y ? _x : _y); \
+ })
+#endif
+#ifndef min
+#define min(x,y) \
+ ({ const typeof(x) _x = x; \
+ const typeof(y) _y = y; \
+ \
+ (void) (&_x == &_y); \
+ \
+ (typeof(x))(_x < _y ? _x : _y); \
+ })
+#endif
+#else
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
+#endif
#endif /* __WINE_MINMAX_H */
Index: include/windef.h
===================================================================
RCS file: /var/cvs/wine/include/windef.h,v
retrieving revision 1.89
diff -u -r1.89 windef.h
--- a/include/windef.h 24 Sep 2003 05:26:00 -0000 1.89
+++ b/include/windef.h 11 Oct 2003 11:02:29 -0000
@@ -272,12 +272,37 @@
/* min and max macros */
#ifndef NOMINMAX
+
+#if (defined(WINE_MINMAX) || defined(__WINESRC__)) && defined(__GNUC__)
+#ifndef max
+#define max(x,y) \
+ ({ const typeof(x) _x = x; \
+ const typeof(y) _y = y; \
+ \
+ (void) (&_x == &_y); \
+ \
+ (typeof(x))(_x > _y ? _x : _y); \
+ })
+#endif
+#ifndef min
+#define min(x,y) \
+ ({ const typeof(x) _x = x; \
+ const typeof(y) _y = y; \
+ \
+ (void) (&_x == &_y); \
+ \
+ (typeof(x))(_x < _y ? _x : _y); \
+ })
+#endif
+#else
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
+#endif
+
#endif /* NOMINMAX */
#ifdef MAX_PATH /* Work-around for Mingw */
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
"Utilisateur" (nom commun) :
Mot utilis\xE9 par les informaticiens en lieu et place d'"idiot".
More information about the wine-devel
mailing list