kernel/trace/trace_output.c:1331:2: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
kernel/trace/trace.h:409:3: note: expanded from macro 'trace_assign_type'
IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \
^
kernel/trace/trace.h:371:14: note: expanded from macro 'IF_ASSIGN'
WARN_ON(id && (entry)->type != id); \
^
264 warnings generated.
Should be fixed with:
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 26b0a08f3c7d..f801d154ff6a 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -365,11 +365,11 @@ static inline struct trace_array *top_trace_array(void)
__builtin_types_compatible_p(typeof(var), type *)
#undef IF_ASSIGN
-#define IF_ASSIGN(var, entry, etype, id) \
- if (FTRACE_CMP_TYPE(var, etype)) { \
- var = (typeof(var))(entry); \
- WARN_ON(id && (entry)->type != id); \
- break; \
+#define IF_ASSIGN(var, entry, etype, id) \
+ if (FTRACE_CMP_TYPE(var, etype)) { \
+ var = (typeof(var))(entry); \
+ WARN_ON(id != 0 && (entry)->type != id); \
+ break; \
}
/* Will cause compile errors if type is not found. */
Wonder why GCC doesn't warn about this though.
My bad, I was looking at old GCC's implementation of this warning :D
I still see this warning after https://reviews.llvm.org/rL372708, is that intentional?
Yeah, gcc does not warn in this case, but g++ does.. probably just gcc's bug.
Aaron Ballman: "I think it's just a bug in GCC (they use separate frontends for C and C++, so these sort of differences crop up sometimes). I think this should be safe to diagnose the same in C and C++."
(https://reviews.llvm.org/D63082#1603952)
I will prepare that patch then.
Thanks
Patch sent: https://lore.kernel.org/lkml/[email protected]/
My patch made it into -next: https://git.kernel.org/next/linux-next/c/968e5170939662341242812b9c82ef51cf140a33
Merged into mainline: https://git.kernel.org/torvalds/c/968e5170939662341242812b9c82ef51cf140a33
Most helpful comment
My patch made it into -next: https://git.kernel.org/next/linux-next/c/968e5170939662341242812b9c82ef51cf140a33