diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-01 15:12:23 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-01 15:12:23 +0000 |
commit | 43bf5d72a08229da09c59460922275147fe59e48 (patch) | |
tree | bfb9b2da79e35521eae05ac845e476d726baa281 /gcc/ginclude | |
parent | 825f1d8bb31e4a398ca99ca16f90de14e6f06703 (diff) | |
download | gcc-43bf5d72a08229da09c59460922275147fe59e48.tar.gz |
* c-parse.in (OFFSETOF, offsetof_member_designator): New.
(primary): Handle offsetof. Add error productions for faux functions.
Move component_ref objc checking to build_component_ref.
(reswords): Add offsetof.
(rid_to_yy): Add offsetof.
* c-tree.h (build_offsetof): Declare.
* c-common.h (objc_is_public): Declare.
* c-typeck.c (build_component_ref): Check objc_is_public.
(build_offsetof): New.
* stub-objc.c (objc_is_public): New.
* objc/objc-act.c, objc/objc-act.h (objc_is_public): Rename
from is_public.
* ginclude/stddef.h (offsetof): Use __builtin_offsetof.
* doc/extend.texi (Offsetof): Move from C++ section to C section
and rewrite for __builtin_offsetof.
cp/
* lex.c (reswords): Rename "__offsetof" to "__builtin_offsetof".
* parser.c (struct cp_parser): Remove in_offsetof.
(cp_parser_new): Don't set it.
(cp_parser_unary_expression): Don't check it.
(cp_parser_postfix_open_square_expression): Split out from ...
(cp_parser_postfix_expression): ... here.
(cp_parser_postfix_dot_deref_expression): Likewise.
(cp_parser_builtin_offsetof): New.
(cp_parser_primary_expression): Use it.
testsuite/
* g++.dg/template/dependent-expr4.C: Use __builtin_offsetof.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82549 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ginclude')
-rw-r--r-- | gcc/ginclude/stddef.h | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h index 1bb3e90bc9b..3b49aeb5180 100644 --- a/gcc/ginclude/stddef.h +++ b/gcc/ginclude/stddef.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002, 2004 + Free Software Foundation, Inc. This file is part of GCC. @@ -410,16 +411,8 @@ typedef __WINT_TYPE__ wint_t; #ifdef _STDDEF_H /* Offset of member MEMBER in a struct of type TYPE. */ -#ifndef __cplusplus -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#else -/* The cast to "char &" below avoids problems with user-defined - "operator &", which can appear in a POD type. */ -#define offsetof(TYPE, MEMBER) \ - (__offsetof__ (reinterpret_cast <size_t> \ - (&reinterpret_cast <char &> \ - (static_cast<TYPE *> (0)->MEMBER)))) -#endif /* C++ */ +#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) + #endif /* _STDDEF_H was defined this time */ #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ |