summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorzlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-25 01:26:01 +0000
committerzlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-25 01:26:01 +0000
commitc17b85eafa482aa4b14b5c81bac7a471e41393c7 (patch)
tree1052b4d25cc404c17e6402e22b8183026f4d4263 /gcc/c-decl.c
parent8024827507976fce5cbedb575703ee4aa1f12809 (diff)
downloadgcc-c17b85eafa482aa4b14b5c81bac7a471e41393c7.tar.gz
2003-09-24 Ziemowit Laski <zlaski@apple.com>
MERGE OF objc-improvements-branch into MAINLINE. See 'gcc/ChangeLog' and 'gcc/testsuite/ChangeLog' for the gory details. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71748 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c47
1 files changed, 39 insertions, 8 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index db35f9a9ea9..bb1c4b06462 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -410,6 +410,39 @@ pop_scope (void)
scope_freelist = scope;
}
+/* The Objective-C front-end often needs to determine the current scope. */
+
+void *
+get_current_scope (void)
+{
+ return current_scope;
+}
+
+/* The following function is used only by Objective-C. It needs to live here
+ because it accesses the innards of c_scope. */
+
+void
+objc_mark_locals_volatile (void *enclosing_blk)
+{
+ struct c_scope *scope;
+
+ for (scope = current_scope;
+ scope && scope != enclosing_blk;
+ scope = scope->outer)
+ {
+ tree decl;
+
+ for (decl = scope->names; decl; decl = TREE_CHAIN (decl))
+ {
+ DECL_REGISTER (decl) = 0;
+ TREE_THIS_VOLATILE (decl) = 1;
+ }
+ /* Do not climb up past the current function. */
+ if (scope->function_body)
+ break;
+ }
+}
+
/* Nonzero if we are currently in the global scope. */
int
@@ -2718,6 +2751,11 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
if (init)
store_init_value (decl, init);
+ if (c_dialect_objc () && (TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == FUNCTION_DECL
+ || TREE_CODE (decl) == FIELD_DECL))
+ objc_check_decl (decl);
+
/* Deduce size of array from initialization, if not already known */
if (TREE_CODE (type) == ARRAY_TYPE
&& TYPE_DOMAIN (type) == 0
@@ -2909,12 +2947,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
mark_referenced (DECL_ASSEMBLER_NAME (decl));
if (TREE_CODE (decl) == TYPE_DECL)
- {
- /* This is a no-op in c-lang.c or something real in objc-act.c. */
- if (c_dialect_objc ())
- objc_check_decl (decl);
- rest_of_decl_compilation (decl, NULL, DECL_FILE_SCOPE_P (decl), 0);
- }
+ rest_of_decl_compilation (decl, NULL, DECL_FILE_SCOPE_P (decl), 0);
/* At the end of a declaration, throw away any variable type sizes
of types defined inside that declaration. There is no use
@@ -4778,8 +4811,6 @@ grokfield (tree declarator, tree declspecs, tree width)
finish_decl (value, NULL_TREE, NULL_TREE);
DECL_INITIAL (value) = width;
- if (c_dialect_objc ())
- objc_check_decl (value);
return value;
}