aboutsummaryrefslogtreecommitdiff
path: root/gcc/vec.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-11-10 16:40:34 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-11-10 16:40:34 +0100
commitc8bf99b4e84b9b0783aca23ecc85425cb3569f16 (patch)
treeab09cad2f5bd98719ee66798ec564bd0f5745126 /gcc/vec.h
parent03989f55955ddb1f82ce79a7c2251039d0ba5d0e (diff)
downloadgcc-c8bf99b4e84b9b0783aca23ecc85425cb3569f16.zip
gcc-c8bf99b4e84b9b0783aca23ecc85425cb3569f16.tar.gz
gcc-c8bf99b4e84b9b0783aca23ecc85425cb3569f16.tar.bz2
vec.h (VEC_BASE): If base is at offset 0 in the structure, use &(P)->base even if P is NULL.
* vec.h (VEC_BASE): If base is at offset 0 in the structure, use &(P)->base even if P is NULL. From-SVN: r181258
Diffstat (limited to 'gcc/vec.h')
-rw-r--r--gcc/vec.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/vec.h b/gcc/vec.h
index 789e8e2..d477958 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -549,7 +549,12 @@ typedef struct VEC(T,A) \
} VEC(T,A)
/* Convert to base type. */
+#if GCC_VERSION >= 4000
+#define VEC_BASE(P) \
+ ((offsetof (__typeof (*P), base) == 0 || (P)) ? &(P)->base : 0)
+#else
#define VEC_BASE(P) ((P) ? &(P)->base : 0)
+#endif
/* Vector of integer-like object. */
#define DEF_VEC_I(T) \