[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: '-Wunused-param' in kernel compiles?



[Sorry for breaking threading, but I just copy&pasted this from web archive as I'm
not subscribed to fedora-devel-list]

On Tue, 2006-04-04 at 19:14 -0700, Tom London wrote:
The last few kernels appear to be compiled with '-Wunused-param'.  That right?

Is this a 'going forward' feature?

Appears to break vmware.

I'm not sure that -Wunused-param is what broke VMware.  I just tried to
configure VMware server beta 2 (build 22874) with kernel
2.6.16-1.2118_FC6 and found this error buried in the output:

        In file included from /tmp/vmware-config0/vmmon-only/linux/driver.h:20,
                         from /tmp/vmware-config0/vmmon-only/linux/driver.c:49:
        /tmp/vmware-config0/vmmon-only/./include/compat_wait.h: At top level:
        /tmp/vmware-config0/vmmon-only/./include/compat_wait.h:60: error: conflicting types for ‘poll_initwait’
        include/linux/poll.h:62: error: previous declaration of ‘poll_initwait’ was here

It wouldn't surprise me if the Linux kernel developers changed an API
that broke VMware.

Yes, it is broken due to -Wunused-param.  We attempt to compile (vmmon-only/autoconf/epoll.c)
(Hm, I see a problem that we are using return in function returning void, but as gcc allows
this...)

#include <linux/poll.h>

void poll_test(void) {
   struct poll_wqueues test;
   return poll_initwait(&test);
}

and if this builds without warning it means that poll_initwait() takes 'struct poll_wqueues*'
as its argument.  If it emits warning (that poll_wqueues pointer had to be converted to
poll_table pointer) then code decides that this is pre-epoll kernel.  And with current 2.6.16-1.2118
this test fails as even in correct case linux/poll.h emits warnings...

We can probably rewrite this test in the way compat_wait.h uses to reverify it (redeclare
prototype in a form we expect, we added this later as if pre-epoll code is built with epoll
kernel it emits just warning during build, but crashes at runtime), but there are other
tests (one testing type of last argument of nopage vma handler) which I do not know how
to rewrite without using -Werror:

#include <linux/mm.h>

static struct page *LinuxDriverNoPage(struct vm_area_struct *vma, unsigned long address, int *type) {
  (void)vma;
  (void)address;
  *type = VM_FAULT_MINOR;
  return NULL;
}

struct vm_operations_Struct vmuser_mops = {
   .nopage = LinuxDriverNoPage
};

If you can tell me how to rewrite this detection without relying on -Werror, then we can probably
stop doing that.
								Petr





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]