diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-06 08:59:14 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-06 08:59:14 +0000 |
commit | 5a162b7ae6b7d344af6a033e922bc5e0e77eb6aa (patch) | |
tree | 56aca246b6ab6aeda938b1018391b7f1c5d7df72 /gcc/c-family/c-common.c | |
parent | f68b5712b23021c39d8c91b2c98130266b9504a3 (diff) | |
download | gcc-5a162b7ae6b7d344af6a033e922bc5e0e77eb6aa.tar.gz |
2010-10-06 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 165014
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@165017 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r-- | gcc/c-family/c-common.c | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 6ef3bf99542..ddac821e8c5 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -358,6 +358,7 @@ static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *); static tree handle_alloc_size_attribute (tree *, tree, tree, int, bool *); static tree handle_target_attribute (tree *, tree, tree, int, bool *); static tree handle_optimize_attribute (tree *, tree, tree, int, bool *); +static tree handle_no_split_stack_attribute (tree *, tree, tree, int, bool *); static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *); static void check_function_nonnull (tree, int, tree *); @@ -380,8 +381,13 @@ static int resort_field_decl_cmp (const void *, const void *); If -fno-asm is used, D_ASM is added to the mask. If -fno-gnu-keywords is used, D_EXT is added. If -fno-asm and C in C89 mode, D_EXT89 is added for both -fno-asm and -fno-gnu-keywords. - In C with -Wc++-compat, we warn if D_CXXWARN is set. */ + In C with -Wc++-compat, we warn if D_CXXWARN is set. + Note the complication of the D_CXX_OBJC keywords. These are + reserved words such as 'class'. In C++, 'class' is a reserved + word. In Objective-C++ it is too. In Objective-C, it is a + reserved word too, but only if it follows an '@' sign. +*/ const struct c_common_resword c_common_reswords[] = { { "_Bool", RID_BOOL, D_CONLY }, @@ -535,6 +541,8 @@ const struct c_common_resword c_common_reswords[] = { "selector", RID_AT_SELECTOR, D_OBJC }, { "finally", RID_AT_FINALLY, D_OBJC }, { "synchronized", RID_AT_SYNCHRONIZED, D_OBJC }, + { "optional", RID_AT_OPTIONAL, D_OBJC }, + { "required", RID_AT_REQUIRED, D_OBJC }, /* These are recognized only in protocol-qualifier context (see above) */ { "bycopy", RID_BYCOPY, D_OBJC }, @@ -661,6 +669,8 @@ const struct attribute_spec c_common_attribute_table[] = handle_target_attribute }, { "optimize", 1, -1, true, false, false, handle_optimize_attribute }, + { "no_split_stack", 0, 0, true, false, false, + handle_no_split_stack_attribute }, /* For internal use (marking of builtins and runtime functions) only. The name contains space to prevent its usage in source code. */ { "fn spec", 1, 1, false, true, true, @@ -7823,12 +7833,13 @@ handle_optimize_attribute (tree *node, tree name, tree args, tree old_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node); /* Save current options. */ - cl_optimization_save (&cur_opts); + cl_optimization_save (&cur_opts, &global_options); /* If we previously had some optimization options, use them as the default. */ if (old_opts) - cl_optimization_restore (TREE_OPTIMIZATION (old_opts)); + cl_optimization_restore (&global_options, + TREE_OPTIMIZATION (old_opts)); /* Parse options, and update the vector. */ parse_optimize_options (args, true); @@ -7836,7 +7847,33 @@ handle_optimize_attribute (tree *node, tree name, tree args, = build_optimization_node (); /* Restore current options. */ - cl_optimization_restore (&cur_opts); + cl_optimization_restore (&global_options, &cur_opts); + } + + return NULL_TREE; +} + +/* Handle a "no_split_stack" attribute. */ + +static tree +handle_no_split_stack_attribute (tree *node, tree name, + tree ARG_UNUSED (args), + int ARG_UNUSED (flags), + bool *no_add_attrs) +{ + tree decl = *node; + + if (TREE_CODE (decl) != FUNCTION_DECL) + { + error_at (DECL_SOURCE_LOCATION (decl), + "%qE attribute applies only to functions", name); + *no_add_attrs = true; + } + else if (DECL_INITIAL (decl)) + { + error_at (DECL_SOURCE_LOCATION (decl), + "can%'t set %qE attribute after definition", name); + *no_add_attrs = true; } return NULL_TREE; @@ -8277,7 +8314,7 @@ c_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level, int reason, { diagnostic_info diagnostic; diagnostic_t dlevel; - bool save_warn_system_headers = global_dc->warn_system_headers; + bool save_warn_system_headers = global_dc->dc_warn_system_headers; bool ret; switch (level) @@ -8285,7 +8322,7 @@ c_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level, int reason, case CPP_DL_WARNING_SYSHDR: if (flag_no_output) return false; - global_dc->warn_system_headers = 1; + global_dc->dc_warn_system_headers = 1; /* Fall through. */ case CPP_DL_WARNING: if (flag_no_output) @@ -8322,7 +8359,7 @@ c_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level, int reason, c_option_controlling_cpp_error (reason)); ret = report_diagnostic (&diagnostic); if (level == CPP_DL_WARNING_SYSHDR) - global_dc->warn_system_headers = save_warn_system_headers; + global_dc->dc_warn_system_headers = save_warn_system_headers; return ret; } |