use xmalloc_atomic for many pointerless objects
[bpt/emacs.git] / src / conf_post.h
index 123f480..a995acf 100644 (file)
@@ -225,6 +225,20 @@ extern void _DebPrint (const char *fmt, ...);
 
 #define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
 
+#if 3 <= __GNUC__
+# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+#else
+# define ATTRIBUTE_MALLOC
+#endif
+
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
+#else
+# define ATTRIBUTE_ALLOC_SIZE(args)
+#endif
+
+#define ATTRIBUTE_MALLOC_SIZE(args) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE (args)
+
 /* Work around GCC bug 59600: when a function is inlined, the inlined
    code may have its addresses sanitized even if the function has the
    no_sanitize_address attribute.  This bug is fixed in GCC 4.9.0 and
@@ -295,10 +309,12 @@ extern void _DebPrint (const char *fmt, ...);
 /* To use the struct hack with N elements, declare the struct like this:
      struct s { ...; t name[FLEXIBLE_ARRAY_MEMBER]; };
    and allocate (offsetof (struct s, name) + N * sizeof (t)) bytes.
-
-   This macro used to expand to something different on pre-C99 compilers.
-   FIXME: Remove it, and remove all uses.  */
-#define FLEXIBLE_ARRAY_MEMBER
+   IBM xlc 12.1 claims to do C99 but mishandles flexible array members.  */
+#ifdef __IBMC__
+# define FLEXIBLE_ARRAY_MEMBER 1
+#else
+# define FLEXIBLE_ARRAY_MEMBER
+#endif
 
 /* Use this to suppress gcc's `...may be used before initialized' warnings. */
 #ifdef lint