summaryrefslogtreecommitdiff
path: root/gcc/vec.h
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-10 15:40:34 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-10 15:40:34 +0000
commit70d084dd57d253ff12430402490318f1366d93b8 (patch)
treeab09cad2f5bd98719ee66798ec564bd0f5745126 /gcc/vec.h
parent49f816eb342a8f9c387daf358782d8f587386aac (diff)
downloadgcc-70d084dd57d253ff12430402490318f1366d93b8.tar.gz
* vec.h (VEC_BASE): If base is at offset 0 in the structure,
use &(P)->base even if P is NULL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181258 138bc75d-0d04-0410-961f-82ee72b054a4
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 789e8e2d4df..d47795879f1 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) \