lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 29 Aug 2011 14:33:05 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Nick Bowler <nbowler@...iptictech.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Lin Ming <ming.m.lin@...el.com>, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, x86@...nel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH 1/2] mm: convert k{un}map_atomic(p, KM_type) to
 k{un}map_atomic(p)

On Fri, 2011-08-26 at 16:40 -0400, Nick Bowler wrote:
> > Extra marks will be awarded for
> > working out how to make unconverted code generate a compile warning ;)
> 
> It's possible to (ab)use the C preprocessor to accomplish this sort of
> thing.  For instance, consider the following:
> 
>   #include <stdio.h>
> 
>   int foo(int x)
>   {
>      return x;
>   }
> 
>   /* Deprecated; call foo instead. */
>   static inline int __attribute__((deprecated)) foo_unconverted(int x, int unused)
>   {
>      return foo(x);
>   }
> 
>   #define PASTE(a, b) a ## b
>   #define PASTE2(a, b) PASTE(a, b)
>   
>   #define NARG_(_9, _8, _7, _6, _5, _4, _3, _2, _1, n, ...) n
>   #define NARG(...) NARG_(__VA_ARGS__, 9, 8, 7, 6, 5, 4, 3, 2, 1, :)
> 
>   #define foo1(...) foo(__VA_ARGS__)
>   #define foo2(...) foo_unconverted(__VA_ARGS__)
>   #define foo(...) PASTE2(foo, NARG(__VA_ARGS__)(__VA_ARGS__))

Very neat ;-)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ