"any()"}
-doc_end
+#
+# Series 11
+#
+
+-doc_begin="This construct is used to check if the type is scalar, and for this purpose the use of 0 as a null pointer constant is deliberate."
+-config=MC3R1.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
+}
+-doc_end
+
#
# Series 13
#
If no bits are set, 0 is returned.
- Tagged as `safe` for ECLAIR.
+ * - R11.9
+ - __ACCESS_ONCE uses an integer, which happens to be zero, as a
+ compile time check. The typecheck uses a cast. The usage of zero or other
+ integers for this purpose is allowed.
+ - Tagged as `deliberate` for ECLAIR.
+
* - R13.5
- All developers and reviewers can be safely assumed to be well aware of
the short-circuit evaluation strategy for logical operators.
#define offsetof(a,b) __builtin_offsetof(a,b)
-/**
- * sizeof_field(TYPE, MEMBER)
- *
- * @TYPE: The structure containing the field of interest
- * @MEMBER: The field to return the size of
- */
-#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
-
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
#define alignof __alignof__
#endif
*
*/
#define container_of(ptr, type, member) ({ \
- typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ typeof_field(type, member) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
/*
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]) + __must_be_array(x))
+/**
+ * typeof_field(type, member)
+ *
+ * @type: The structure containing the field of interest
+ * @member: The field whose type is returned
+ */
+#define typeof_field(type, member) typeof(((type *)NULL)->member)
+
+/**
+ * sizeof_field(type, member)
+ *
+ * @type: The structure containing the field of interest
+ * @member: The field to return the size of
+ */
+#define sizeof_field(type, member) sizeof(((type *)NULL)->member)
+
#endif /* __ASSEMBLY__ */
#endif /* __MACROS_H__ */