Compilation Warnings

[email protected]
Newsgroups gmane.network.routing.click
Message-ID <CAFnufp3TEfhpzpOKNsWeNEMwn4N2yvDxmqk15MXyGReBOPT=iQ@mail.gmail.com>
Hi,

I have a patch to remove some warnings that I have when compiling the
Click Linux module

Cheers,
Matteo Croce


--- a/elements/grid/grid.hh	2012-02-29 10:17:49.719482716 +0100
+++ b/elements/grid/grid.hh	2012-03-14 16:18:02.314405272 +0100
@@ -59,7 +59,7 @@
 #else // CLICK_USERLEVEL
   String s() const {
     char buf[255];
-    snprintf(buf, 255, "%ld,%ld,%ld", lat_ms(), lon_ms(), h_mm());
+    snprintf(buf, 255, "%d,%d,%d", lat_ms(), lon_ms(), h_mm());
     return String(buf);
   }
 #endif
--- a/elements/linuxmodule/fromhost.cc	2012-02-29 10:17:49.735482716 +0100
+++ b/elements/linuxmodule/fromhost.cc	2012-03-15 12:54:46.363798349 +0100
@@ -282,7 +282,7 @@
         sin->sin_family = AF_INET;
         sin->sin_addr = _destaddr;
 # if HAVE_LINUX_INET_CTL_SOCK_CREATE
-	struct socket *sock = kmalloc(sizeof(struct socket), GFP_KERNEL);
+	struct socket *sock = (struct socket *)kmalloc(sizeof(struct
socket), GFP_KERNEL);
 	sock->sk = 0;
 	if (res >= 0 && (res = inet_ctl_sock_create(&sock->sk, AF_INET,
SOCK_RAW, IPPROTO_TCP, dev_net(_dev))) != 0) {
 	    errh->error("error %d creating control socket for device '%s'",
res, _devname.c_str());
@@ -291,11 +291,11 @@
 # endif
 	oldfs = get_fs();
 	set_fs(get_ds());
-        if (res >= 0 && (res = click_inet_ioctl(sock, _dev,
SIOCSIFADDR, &ifr)) < 0)
+        if (res >= 0 && (res = click_inet_ioctl(sock, _dev,
SIOCSIFADDR, (unsigned long)&ifr)) < 0)
             errh->error("error %d setting address for device '%s'",
res, _devname.c_str());

         sin->sin_addr = _destmask;
-        if (res >= 0 && (res = click_inet_ioctl(sock, _dev,
SIOCSIFNETMASK, &ifr)) < 0)
+        if (res >= 0 && (res = click_inet_ioctl(sock, _dev,
SIOCSIFNETMASK, (unsigned long)&ifr)) < 0)
             errh->error("error %d setting netmask for device '%s'",
res, _devname.c_str());
 	set_fs(oldfs);
 # if HAVE_LINUX_INET_CTL_SOCK_CREATE
@@ -315,10 +315,10 @@
 {
     struct ifreq ifr;
     strncpy(ifr.ifr_name, dev->name, IFNAMSIZ);
-    uint32_t flags = IFF_UP | IFF_RUNNING;
     int res = -EINVAL;

 #if HAVE_LINUX_DEV_IOCTL
+    uint32_t flags = IFF_UP | IFF_RUNNING;
     mm_segment_t oldfs = get_fs();
     set_fs(get_ds());

--- a/elements/linuxmodule/todevice.cc	2012-02-29 10:17:49.735482716 +0100
+++ b/elements/linuxmodule/todevice.cc	2012-03-15 12:46:53.939789480 +0100
@@ -121,7 +121,7 @@
 ToDevice::configure(Vector<String> &conf, ErrorHandler *errh)
 {
     _burst = 16;
-    int tx_queue = 0;
+    unsigned tx_queue = 0;
     if (AnyDevice::configure_keywords(conf, errh, false) < 0
 	|| (Args(conf, this, errh)
 	    .read_mp("DEVNAME", _devname)
@@ -143,7 +143,7 @@
 	dev_put(dev);
 	dev = 0;
 	if (!allow_nonexistent())
-	    return errh->error("device %<%s%> has only %d queues",
_devname.c_str(), _tx_queue);
+	    return errh->error("device %<%s%> has only %u queues",
_devname.c_str(), _tx_queue);
     }
 #endif
     set_device(dev, &to_device_map, 0);
@@ -508,7 +508,9 @@
 #endif
     ++_hard_start;

+#if HAVE_LINUX_POLLING
  enqueued:
+#endif
     if (ret != 0) {
         _q = p;
 	_q_expiry_j = click_jiffies() + queue_timeout;
--- a/elements/linuxmodule/todevice.hh	2012-02-29 10:17:49.735482716 +0100
+++ b/elements/linuxmodule/todevice.hh	2012-03-15 12:45:33.015787961 +0100
@@ -147,7 +147,7 @@
     };

 #if HAVE_NETDEV_GET_TX_QUEUE
-    int _tx_queue;
+    unsigned _tx_queue;
 #else
     enum { _tx_queue = 0 };
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.