Re: Casting away noderef and address spaces?

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

 



On Tuesday 23 December 2008 07:27:50 Al Viro wrote:
> The right solution is
> 	(*(typeof(v) __attribute__((address_space(0), force)) *)(&v))
> 
> Cast there will take a pointer to type of V and force-cast it to pointer to
> unqualified type of V.  *(cast)&v will do the obvious thing.  Will trim
> both the AS and noderef.

Thanks Al, that worked, but seems to tickle another bug (sparse 0.4.1, Ubuntu).

rusty@vivaldi:/tmp$ sparse foo.c
foo.c:11:20: warning: incorrect type in assignment (invalid types)
foo.c:11:20:    expected unknown type 11<noident>
foo.c:11:20:    got int

Here's my sample program now:

#define __percpu __attribute__((noderef, address_space(3)))

/* Turn v back into a normal var. */
#define convert(v) \
        (*(typeof(v) __attribute__((address_space(0), force)) *)(&v))

int main(int argc, char *argv)
{
        unsigned int __percpu x;

        convert(x) = 0;
        return 0;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux