+ kernelh-hide-__is_constexpr-from-sparse.patch added to -mm tree

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

 



The patch titled
     Subject: kernel.h: hide __is_constexpr() from sparse
has been added to the -mm tree.  Its filename is
     kernelh-hide-__is_constexpr-from-sparse.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/kernelh-hide-__is_constexpr-from-sparse.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/kernelh-hide-__is_constexpr-from-sparse.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Johannes Berg <johannes.berg@xxxxxxxxx>
Subject: kernel.h: hide __is_constexpr() from sparse

__is_constexpr() is a work of art, understandable only to the most
respected wizards of C.  Even sparse doesn't seem to belong to that group
and warns that there's an "expression using sizeof(void)".

Just hide the definition from sparse and pretend it's always true.

Link: http://lkml.kernel.org/r/20181109093534.15121-2-johannes@xxxxxxxxxxxxxxxx
Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/linux/kernel.h |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/include/linux/kernel.h~kernelh-hide-__is_constexpr-from-sparse
+++ a/include/linux/kernel.h
@@ -844,6 +844,7 @@ static inline void ftrace_dump(enum ftra
 #define __typecheck(x, y) \
 		(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
 
+#ifndef __CHECKER__
 /*
  * This returns a constant expression while determining if an argument is
  * a constant expression, most importantly without evaluating the argument.
@@ -851,6 +852,13 @@ static inline void ftrace_dump(enum ftra
  */
 #define __is_constexpr(x) \
 	(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
+#else
+/*
+ * We don't really care about the check when running sparse and the
+ * above expression causes a warning due to sizeof(void).
+ */
+#define __is_constexpr(x) 1
+#endif
 
 #define __no_side_effects(x, y) \
 		(__is_constexpr(x) && __is_constexpr(y))
_

Patches currently in -mm which might be from johannes.berg@xxxxxxxxx are

compiler-gcc-hide-compiler_has_generic_builtin_overflow-from-sparse.patch
kernelh-hide-__is_constexpr-from-sparse.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux