[hackers] [wmii] Fixed warnings/errors on linux.

From: Kris Maglione <jg_AT_suckless.org>
Date: Mon Jan 21 08:36:27 2008

changeset: 2245:5c70ed7d56d3
user: Kris Maglione <jg_AT_suckless.org>
date: Sun Jan 20 19:10:40 2008 -0500
summary: Fixed warnings/errors on linux.

diff -r 738d2c808f75 -r 5c70ed7d56d3 Makefile
--- a/Makefile Sun Jan 20 18:29:04 2008 -0500
+++ b/Makefile Sun Jan 20 19:10:40 2008 -0500
@@ -18,11 +18,12 @@ config:
         ROOT="${ROOT}" ${ROOT}/util/genconfig
 
 deb-dep:
- apt-get -qq install build-essential debhelper libxext-dev x11proto-xext-dev libx11-dev
+ apt-get -qq install build-essential debhelper libxext-dev x11proto-xext-dev libx11-dev libxrandr-dev
 
 deb:
         dpkg-buildpackage -rfakeroot
 
 include ${ROOT}/mk/dir.mk
 INSTDIRS = ${PDIRS}
+.PHONY: config
 
diff -r 738d2c808f75 -r 5c70ed7d56d3 cmd/wmii/area.c
--- a/cmd/wmii/area.c Sun Jan 20 18:29:04 2008 -0500
+++ b/cmd/wmii/area.c Sun Jan 20 19:10:40 2008 -0500
@@ -4,7 +4,7 @@
 #include "dat.h"
 #include <assert.h>
 #include <math.h>
-#include <sys/limits.h>
+#include <limits.h>
 #include "fns.h"
 
 Client*
diff -r 738d2c808f75 -r 5c70ed7d56d3 cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Sun Jan 20 18:29:04 2008 -0500
+++ b/cmd/wmii/bar.c Sun Jan 20 19:10:40 2008 -0500
@@ -120,6 +120,7 @@ bar_draw(WMScreen *s) {
                                 b->smaller = *pb;
                                 *pb = b;
                         }
+ SET(shrink);
                 for(tb = largest; tb; tb = tb->smaller) {
                         width -= Dx(tb->r);
                         tw += Dx(tb->r);
@@ -128,7 +129,6 @@ bar_draw(WMScreen *s) {
                                 if(Dx(tb->r) * shrink >= Dx(tb->smaller->r))
                                         break;
                 }
- SET(shrink);
                 if(tb)
                         for(b = largest; b != tb->smaller; b = b->smaller)
                                 b->r.max.x *= shrink;
diff -r 738d2c808f75 -r 5c70ed7d56d3 cmd/wmii/ewmh.c
--- a/cmd/wmii/ewmh.c Sun Jan 20 18:29:04 2008 -0500
+++ b/cmd/wmii/ewmh.c Sun Jan 20 19:10:40 2008 -0500
@@ -3,7 +3,7 @@
  */
 #include "dat.h"
 #include <assert.h>
-#include <sys/limits.h>
+#include <limits.h>
 #include "fns.h"
 
 Window *ewmhwin;
diff -r 738d2c808f75 -r 5c70ed7d56d3 cmd/wmii/float.c
--- a/cmd/wmii/float.c Sun Jan 20 18:29:04 2008 -0500
+++ b/cmd/wmii/float.c Sun Jan 20 19:10:40 2008 -0500
@@ -2,7 +2,7 @@
  * See LICENSE file for license details.
  */
 #include "dat.h"
-#include <sys/limits.h>
+#include <limits.h>
 #include "fns.h"
 
 static void float_placeframe(Frame*);
@@ -123,6 +123,7 @@ float_placeframe(Frame *f) {
                 vp2 = vptemp;
         }
 
+ p = ZP; /* SET(p) */
         if(vp->n == 0) {
                 p.x = random() % max(0, Dx(a->r) - dim.x);
                 p.y = random() % max(0, Dy(a->r) - dim.y);
diff -r 738d2c808f75 -r 5c70ed7d56d3 cmd/wmii/key.c
--- a/cmd/wmii/key.c Sun Jan 20 18:29:04 2008 -0500
+++ b/cmd/wmii/key.c Sun Jan 20 19:10:40 2008 -0500
@@ -169,7 +169,8 @@ match_keys(Key *k, ulong mod, KeyCode ke
 match_keys(Key *k, ulong mod, KeyCode keycode, bool seq) {
         Key *ret = nil, *next;
 
- for(next = k->tnext; k; (k=next) && (next=k->tnext)) {
+ /* I *hate* GCC 4. */
+ for(next = k->tnext; k; (void)((k=next) && (next=k->tnext))) {
                 if(seq)
                         k = k->next;
                 if(k && (k->mod == mod) && (k->key == keycode)) {
diff -r 738d2c808f75 -r 5c70ed7d56d3 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Sun Jan 20 18:29:04 2008 -0500
+++ b/cmd/wmii/mouse.c Sun Jan 20 19:10:40 2008 -0500
@@ -719,6 +719,9 @@ mouse_resize(Client *c, bool grabbox, Al
         hr = subpt(frect.max, frect.min);
         hr = divpt(hr, Pt(2, 2));
 
+ SET(hrx);
+ SET(hry);
+
         if(align != Center) {
                 d = hr;
                 if(align&North) d.y -= hr.y;
@@ -757,8 +760,6 @@ mouse_resize(Client *c, bool grabbox, Al
                         d.y = ev.xmotion.y_root;
 
                         if(align == Center && !grabbox) {
- SET(hrx);
- SET(hry);
                                 d.x = (d.x * hrx) - pt.x;
                                 d.y = (d.y * hry) - pt.y;
                         }else
diff -r 738d2c808f75 -r 5c70ed7d56d3 include/util.h
--- a/include/util.h Sun Jan 20 18:29:04 2008 -0500
+++ b/include/util.h Sun Jan 20 19:10:40 2008 -0500
@@ -76,5 +76,6 @@ _used(long a, ...) {
 # undef USED
 # undef SET
 # define USED(...) _used((long)__VA_ARGS__)
-# define SET(x) USED(&x)
+# define SET(x) (x = 0)
+/* # define SET(x) USED(&x) GCC 4 is 'too smart' for this. */
 #endif
diff -r 738d2c808f75 -r 5c70ed7d56d3 mk/hdr.mk
--- a/mk/hdr.mk Sun Jan 20 18:29:04 2008 -0500
+++ b/mk/hdr.mk Sun Jan 20 19:10:40 2008 -0500
@@ -77,8 +77,9 @@ depend: cleandep
 depend: cleandep
 
 FILTER = cat
-COMPILE= CC="$(CC)" CFLAGS="$(CFLAGS)" $(ROOT)/util/compile
-COMPILEPIC= CC="$(CC)" CFLAGS="$(CFLAGS) $(SOCFLAGS)" $(ROOT)/util/compile
+EXCFLAGS = -I$$(echo $(INCPATH)|sed 's/:/ -I/g') -D_XOPEN_SOURCE=600
+COMPILE= CC="$(CC)" CFLAGS="$(EXCFLAGS) $(CFLAGS)" $(ROOT)/util/compile
+COMPILEPIC= CC="$(CC)" CFLAGS="$(EXCFLAGS) $(CFLAGS) $(SOCFLAGS)" $(ROOT)/util/compile
 LINK= LD="$(LD)" LDFLAGS="$(LDFLAGS)" $(ROOT)/util/link
 LINKSO= LD="$(LD)" LDFLAGS="$(SOLDFLAGS)" $(ROOT)/util/link
 CLEANNAME=$(ROOT)/util/cleanname
@@ -91,6 +92,5 @@ MKCFG!=${MKCFGSH}
 MKCFG!=${MKCFGSH}
 include $(MKCFG)
 
-CFLAGS += -I$$(echo $(INCPATH)|sed 's/:/ -I/g')
 include $(ROOT)/mk/common.mk
 
diff -r 738d2c808f75 -r 5c70ed7d56d3 util/link
--- a/util/link Sun Jan 20 18:29:04 2008 -0500
+++ b/util/link Sun Jan 20 19:10:40 2008 -0500
@@ -26,7 +26,7 @@ status=$?
 status=$?
 
 sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . |
-egrep -v 'is almost always misused|is dangerous, better use'
+egrep -v 'is almost always misused|is dangerous, better use|in statically linked applications requires at runtime'
 rm -f $xtmp
 
 exit $status
Received on Mon Jan 21 2008 - 08:36:27 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:04 UTC