summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/gcc/ChangeLog.apple51
-rw-r--r--contrib/gcc/c-common.c80
-rw-r--r--contrib/gcc/c-decl.c53
-rw-r--r--contrib/gcc/c-parser.c57
-rw-r--r--contrib/gcc/c-tree.h9
-rw-r--r--contrib/gcc/c-typeck.c31
-rw-r--r--contrib/gcc/cp/ChangeLog.apple31
-rw-r--r--contrib/gcc/cp/cp-gimplify.c26
-rw-r--r--contrib/gcc/cp/cp-tree.def19
-rw-r--r--contrib/gcc/cp/cp-tree.h29
-rw-r--r--contrib/gcc/cp/decl.c50
-rw-r--r--contrib/gcc/cp/dump.c9
-rw-r--r--contrib/gcc/cp/init.c4
-rw-r--r--contrib/gcc/cp/parser.c35
-rw-r--r--contrib/gcc/cp/pt.c17
-rw-r--r--contrib/gcc/cp/semantics.c28
-rw-r--r--contrib/gcc/doc/extend.texi118
-rw-r--r--contrib/gcc/dwarf2out.c3
-rw-r--r--contrib/gcc/emit-rtl.c4
-rw-r--r--contrib/gcc/final.c147
-rw-r--r--contrib/gcc/print-rtl.c5
-rw-r--r--contrib/gcc/print-tree.c4
-rw-r--r--contrib/gcc/rtl.def8
-rw-r--r--contrib/gcc/rtl.h9
-rw-r--r--contrib/gcc/stmt.c19
-rw-r--r--contrib/gcc/toplev.c40
-rw-r--r--contrib/gcc/toplev.h2
-rw-r--r--contrib/gcc/tree-cfg.c13
-rw-r--r--contrib/gcc/tree.h15
29 files changed, 755 insertions, 161 deletions
diff --git a/contrib/gcc/ChangeLog.apple b/contrib/gcc/ChangeLog.apple
new file mode 100644
index 0000000..b2004ee
--- /dev/null
+++ b/contrib/gcc/ChangeLog.apple
@@ -0,0 +1,51 @@
+006-02-15 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4445586
+ * c-common.def (DO_STMT): Takes an extra argument.
+
+/* APPLE LOCAL merge marger */
+/* Stuff under is in fsf mainline, but not in the 4.2 branch */
+
+2007-08-02 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 3274130, 5295549
+ * c-parser.c (c_parser_while_statement): Handle attributes.
+ (c_parser_do_statement): Handle attributes.
+ (c_parser_for_statement): Handle attributes.
+ * c-common.c (handle_unused_attribute): Warn if a statement
+ is marked as unused.
+ * c-tree.h (c_finish_loop): Add extra parameter.
+ * c-typeck.c (c_finish_loop): Handle attributes.
+ * doc/extend.texi (Attribute Syntax): Document statement attributes.
+ (Label Attributes): Explain how they apply to statements.
+ * tree-cfg.c (cleanup_dead_labels): Preserve labels with
+ user-specified alignment or attributes.
+ * stmt.c (expand_label): Update and correct documentation.
+
+ * c-common.c (handle_aligned_attribute): Handle LABEL_DECL.
+ * rtl.def (CODE_LABEL): Add 8th operand.
+ * rtl.h (LABEL_ALIGN_LOG): New.
+ (LABEL_MAX_SKIP): New.
+ (SET_LABEL_ALIGN): New.
+ * emit-rtl.c (gen_label_rtx): Adjust.
+ * print-rtl.c (print_rtx): Print LABEL_ALIGN_LOG.
+ * stmt.c (label_rtx): Set CODE_LABEL's alignment from DECL_ALIGN.
+ (expand_label): Update documentation.
+ * final.c (struct label_alignment): Delete.
+ (label_align): Delete.
+ (min_labelno): Delete.
+ (max_labelno): Delete.
+ (LABEL_TO_ALIGNMENT): Delete.
+ (LABEL_TO_MAX_SKIP): Delete.
+ (label_to_alignment): Adjust for LABEL_ALIGN_LOG.
+ (align_fuzz): Likewise.
+ (compute_alignments): Likewise.
+ (shorten_branches): Remove code to set up label_align.
+ Adjust for LABEL_ALIGN_LOG.
+ (final_scan_insn): Adjust for LABEL_ALIGN_LOG.
+ * doc/extend.texi (C Extensions): Add 'Label Attributes' to menu.
+ (Attribute Syntax): Move label content to Label Attributes.
+ (Function Attributes): Mention label attributes.
+ (Variable Attributes): Mention label attributes.
+ (Type Attributes): Mention label attributes.
+ (Label Attributes): New.
diff --git a/contrib/gcc/c-common.c b/contrib/gcc/c-common.c
index b1fa91d..f9b06f4 100644
--- a/contrib/gcc/c-common.c
+++ b/contrib/gcc/c-common.c
@@ -541,6 +541,9 @@ static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
static tree handle_deprecated_attribute (tree *, tree, tree, int,
bool *);
+/* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */
+static tree handle_unavailable_attribute (tree *, tree, tree, int, bool *);
+/* APPLE LOCAL end "unavailable" attribute --ilr */
static tree handle_vector_size_attribute (tree *, tree, tree, int,
bool *);
static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
@@ -626,6 +629,10 @@ const struct attribute_spec c_common_attribute_table[] =
handle_novops_attribute },
{ "deprecated", 0, 0, false, false, false,
handle_deprecated_attribute },
+ /* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */
+ { "unavailable", 0, 0, false, false, false,
+ handle_unavailable_attribute },
+ /* APPLE LOCAL end "unavailable" attribute --ilr */
{ "vector_size", 1, 1, false, true, false,
handle_vector_size_attribute },
{ "visibility", 1, 1, false, false, false,
@@ -4394,7 +4401,10 @@ handle_unused_attribute (tree *node, tree name, tree ARG_UNUSED (args),
if (TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == FUNCTION_DECL
- || TREE_CODE (decl) == LABEL_DECL
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ || (TREE_CODE (decl) == LABEL_DECL
+ && ! DECL_ARTIFICIAL (decl))
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
|| TREE_CODE (decl) == TYPE_DECL)
TREE_USED (decl) = 1;
else
@@ -4842,7 +4852,10 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
TYPE_USER_ALIGN (*type) = 1;
}
else if (! VAR_OR_FUNCTION_DECL_P (decl)
- && TREE_CODE (decl) != FIELD_DECL)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ && TREE_CODE (decl) != FIELD_DECL
+ && TREE_CODE (decl) != LABEL_DECL)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
{
error ("alignment may not be specified for %q+D", decl);
*no_add_attrs = true;
@@ -5345,6 +5358,69 @@ handle_deprecated_attribute (tree *node, tree name,
return NULL_TREE;
}
+/* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) --ilr */
+/* Handle a "unavailable" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_unavailable_attribute (tree *node, tree name,
+ tree args ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED,
+ bool *no_add_attrs)
+{
+ tree type = NULL_TREE;
+ int warn = 0;
+ const char *what = NULL;
+
+ if (DECL_P (*node))
+ {
+ tree decl = *node;
+ type = TREE_TYPE (decl);
+
+ if (TREE_CODE (decl) == TYPE_DECL
+ || TREE_CODE (decl) == PARM_DECL
+ || TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == FUNCTION_DECL
+ || TREE_CODE (decl) == FIELD_DECL)
+ /* Removed radar 3803157 - objc attribute */
+ {
+ TREE_UNAVAILABLE (decl) = 1;
+ }
+ else
+ warn = 1;
+ }
+ else if (TYPE_P (*node))
+ {
+ if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
+ *node = build_variant_type_copy (*node);
+ TREE_UNAVAILABLE (*node) = 1;
+ type = *node;
+ }
+ else
+ warn = 1;
+
+ if (warn)
+ {
+ *no_add_attrs = true;
+ if (type && TYPE_NAME (type))
+ {
+ if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
+ what = IDENTIFIER_POINTER (TYPE_NAME (*node));
+ else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (type)))
+ what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+ }
+ if (what)
+ warning (0, "`%s' attribute ignored for `%s'",
+ IDENTIFIER_POINTER (name), what);
+ else
+ warning (0, "`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ }
+
+ return NULL_TREE;
+}
+/* APPLE LOCAL end "unavailable" attribute --ilr */
+
/* Handle a "vector_size" attribute; arguments as in
struct attribute_spec.handler. */
diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c
index 3cdd69b..7b3833c 100644
--- a/contrib/gcc/c-decl.c
+++ b/contrib/gcc/c-decl.c
@@ -453,10 +453,17 @@ add_stmt (tree t)
with __attribute__((deprecated)). An object declared as
__attribute__((deprecated)) suppresses warnings of uses of other
deprecated items. */
+/* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+/* Also add an __attribute__((unavailable)). An object declared as
+ __attribute__((unavailable)) suppresses any reports of being
+ declared with unavailable or deprecated items. */
+/* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
enum deprecated_states {
DEPRECATED_NORMAL,
DEPRECATED_SUPPRESS
+ /* APPLE LOCAL "unavailable" attribute (radar 2809697) */
+ , DEPRECATED_UNAVAILABLE_SUPPRESS
};
static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
@@ -1709,6 +1716,12 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
if (TREE_DEPRECATED (newdecl))
TREE_DEPRECATED (olddecl) = 1;
+ /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+ /* Merge unavailableness. */
+ if (TREE_UNAVAILABLE (newdecl))
+ TREE_UNAVAILABLE (olddecl) = 1;
+ /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
+
/* Keep source location of definition rather than declaration and of
prototype rather than non-prototype unless that prototype is
built-in. */
@@ -3222,8 +3235,36 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
/* An object declared as __attribute__((deprecated)) suppresses
warnings of uses of other deprecated items. */
+ /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+ /* An object declared as __attribute__((unavailable)) suppresses
+ any reports of being declared with unavailable or deprecated
+ items. An object declared as __attribute__((deprecated))
+ suppresses warnings of uses of other deprecated items. */
+#ifdef A_LESS_INEFFICENT_WAY /* which I really don't want to do! */
if (lookup_attribute ("deprecated", attributes))
deprecated_state = DEPRECATED_SUPPRESS;
+ else if (lookup_attribute ("unavailable", attributes))
+ deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
+#else /* a more efficient way doing what lookup_attribute would do */
+ tree a;
+
+ for (a = attributes; a; a = TREE_CHAIN (a))
+ {
+ tree name = TREE_PURPOSE (a);
+ if (TREE_CODE (name) == IDENTIFIER_NODE)
+ if (is_attribute_p ("deprecated", name))
+ {
+ deprecated_state = DEPRECATED_SUPPRESS;
+ break;
+ }
+ if (is_attribute_p ("unavailable", name))
+ {
+ deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
+ break;
+ }
+ }
+#endif
+ /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
decl = grokdeclarator (declarator, declspecs,
NORMAL, initialized, NULL);
@@ -4087,6 +4128,11 @@ grokdeclarator (const struct c_declarator *declarator,
/* If this looks like a function definition, make it one,
even if it occurs where parms are expected.
Then store_parm_decls will reject it and not use it as a parm. */
+ /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+ if (declspecs->unavailable_p)
+ error_unavailable_use (declspecs->type);
+ else
+ /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
if (decl_context == NORMAL && !funcdef_flag && current_scope->parm_flag)
decl_context = PARM;
@@ -7267,6 +7313,8 @@ build_null_declspecs (void)
ret->tag_defined_p = false;
ret->explicit_signed_p = false;
ret->deprecated_p = false;
+ /* APPLE LOCAL "unavailable" attribute (radar 2809697) */
+ ret->unavailable_p = false;
ret->default_int_p = false;
ret->long_p = false;
ret->long_long_p = false;
@@ -7330,6 +7378,11 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
if (TREE_DEPRECATED (type))
specs->deprecated_p = true;
+ /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+ if (TREE_UNAVAILABLE (type))
+ specs->unavailable_p = true;
+ /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
+
/* Handle type specifier keywords. */
if (TREE_CODE (type) == IDENTIFIER_NODE && C_IS_RESERVED_WORD (type))
{
diff --git a/contrib/gcc/c-parser.c b/contrib/gcc/c-parser.c
index c6be639..a8c8a1e 100644
--- a/contrib/gcc/c-parser.c
+++ b/contrib/gcc/c-parser.c
@@ -3940,16 +3940,25 @@ c_parser_switch_statement (c_parser *parser)
/* Parse a while statement (C90 6.6.5, C99 6.8.5).
while-statement:
- while (expression) statement
+ APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+ while attributes (expression) statement
+
+ The use of attributes is a GNU extension.
+ APPLE LOCAL end for-fsf-4_4 3274130 5295549
*/
static void
c_parser_while_statement (c_parser *parser)
{
- tree block, cond, body, save_break, save_cont;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tree block, cond, body, save_break, save_cont, attrs;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
location_t loc;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_WHILE));
c_parser_consume_token (parser);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ attrs = c_parser_attributes (parser);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
block = c_begin_compound_stmt (flag_isoc99);
loc = c_parser_peek_token (parser)->location;
cond = c_parser_paren_condition (parser);
@@ -3958,7 +3967,10 @@ c_parser_while_statement (c_parser *parser)
save_cont = c_cont_label;
c_cont_label = NULL_TREE;
body = c_parser_c99_block_statement (parser);
- c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, true);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, attrs,
+ true);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
add_stmt (c_end_compound_stmt (block, flag_isoc99));
c_break_label = save_break;
c_cont_label = save_cont;
@@ -3967,16 +3979,25 @@ c_parser_while_statement (c_parser *parser)
/* Parse a do statement (C90 6.6.5, C99 6.8.5).
do-statement:
- do statement while ( expression ) ;
+ APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+ do attributes statement while ( expression ) ;
+
+ The use of attributes is a GNU extension.
+ APPLE LOCAL end for-fsf-4_4 3274130 5295549
*/
static void
c_parser_do_statement (c_parser *parser)
{
- tree block, cond, body, save_break, save_cont, new_break, new_cont;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tree block, cond, body, save_break, save_cont, new_break, new_cont, attrs;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
location_t loc;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_DO));
c_parser_consume_token (parser);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ attrs = c_parser_attributes (parser);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
block = c_begin_compound_stmt (flag_isoc99);
loc = c_parser_peek_token (parser)->location;
save_break = c_break_label;
@@ -3992,18 +4013,26 @@ c_parser_do_statement (c_parser *parser)
cond = c_parser_paren_condition (parser);
if (!c_parser_require (parser, CPP_SEMICOLON, "expected %<;%>"))
c_parser_skip_to_end_of_block_or_statement (parser);
- c_finish_loop (loc, cond, NULL, body, new_break, new_cont, false);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ c_finish_loop (loc, cond, NULL, body, new_break, new_cont, attrs, false);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
add_stmt (c_end_compound_stmt (block, flag_isoc99));
}
/* Parse a for statement (C90 6.6.5, C99 6.8.5).
for-statement:
- for ( expression[opt] ; expression[opt] ; expression[opt] ) statement
- for ( nested-declaration expression[opt] ; expression[opt] ) statement
+ APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+ for attributes ( expression[opt] ; expression[opt] ; expression[opt] ) \
+ statement
+ for attributes ( nested-declaration expression[opt] ; expression[opt] ) \
+ statement
The form with a declaration is new in C99.
+ The use of attributes is a GNU extension.
+
+ APPLE LOCAL end for-fsf-4_4 3274130 5295549
??? In accordance with the old parser, the declaration may be a
nested function, which is then rejected in check_for_loop_decls,
but does it make any sense for this to be included in the grammar?
@@ -4015,11 +4044,16 @@ c_parser_do_statement (c_parser *parser)
static void
c_parser_for_statement (c_parser *parser)
{
- tree block, cond, incr, save_break, save_cont, body;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tree block, cond, incr, save_break, save_cont, body, attrs;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
location_t loc;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_FOR));
loc = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ attrs = c_parser_attributes (parser);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
block = c_begin_compound_stmt (flag_isoc99);
if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
{
@@ -4094,7 +4128,10 @@ c_parser_for_statement (c_parser *parser)
save_cont = c_cont_label;
c_cont_label = NULL_TREE;
body = c_parser_c99_block_statement (parser);
- c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, true);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, attrs,
+ true);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
add_stmt (c_end_compound_stmt (block, flag_isoc99));
c_break_label = save_break;
c_cont_label = save_cont;
diff --git a/contrib/gcc/c-tree.h b/contrib/gcc/c-tree.h
index 7e2c81f..af2e798 100644
--- a/contrib/gcc/c-tree.h
+++ b/contrib/gcc/c-tree.h
@@ -257,6 +257,10 @@ struct c_declspecs {
BOOL_BITFIELD explicit_signed_p : 1;
/* Whether the specifiers include a deprecated typedef. */
BOOL_BITFIELD deprecated_p : 1;
+ /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+ /* Whether the specifiers include a unavailable typedef. */
+ BOOL_BITFIELD unavailable_p : 1;
+ /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
/* Whether the type defaulted to "int" because there were no type
specifiers. */
BOOL_BITFIELD default_int_p;
@@ -573,7 +577,10 @@ extern int c_types_compatible_p (tree, tree);
extern tree c_begin_compound_stmt (bool);
extern tree c_end_compound_stmt (tree, bool);
extern void c_finish_if_stmt (location_t, tree, tree, tree, bool);
-extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, bool);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, tree,
+ bool);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
extern tree c_begin_stmt_expr (void);
extern tree c_finish_stmt_expr (tree);
extern tree c_process_expr_stmt (tree);
diff --git a/contrib/gcc/c-typeck.c b/contrib/gcc/c-typeck.c
index cd30cd1..c60aa26 100644
--- a/contrib/gcc/c-typeck.c
+++ b/contrib/gcc/c-typeck.c
@@ -1849,6 +1849,11 @@ build_component_ref (tree datum, tree component)
if (TREE_DEPRECATED (subdatum))
warn_deprecated_use (subdatum);
+ /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+ if (TREE_UNAVAILABLE (subdatum))
+ error_unavailable_use (subdatum);
+ /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
+
datum = ref;
field = TREE_CHAIN (field);
@@ -2090,6 +2095,11 @@ build_external_ref (tree id, int fun, location_t loc)
if (TREE_DEPRECATED (ref))
warn_deprecated_use (ref);
+ /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+ if (TREE_UNAVAILABLE (ref))
+ error_unavailable_use (ref);
+ /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
+
if (!skip_evaluation)
assemble_external (ref);
TREE_USED (ref) = 1;
@@ -7247,15 +7257,22 @@ c_finish_if_stmt (location_t if_locus, tree cond, tree then_block,
add_stmt (stmt);
}
-/* Emit a general-purpose loop construct. START_LOCUS is the location of
- the beginning of the loop. COND is the loop condition. COND_IS_FIRST
- is false for DO loops. INCR is the FOR increment expression. BODY is
- the statement controlled by the loop. BLAB is the break label. CLAB is
- the continue label. Everything is allowed to be NULL. */
-
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* Emit a general-purpose loop construct. START_LOCUS is the location
+ of the beginning of the loop. COND is the loop condition.
+ COND_IS_FIRST is false for DO loops. INCR is the FOR increment
+ expression. BODY is the statement controlled by the loop. BLAB is
+ the break label. CLAB is the continue label. ATTRS is the
+ attributes associated with the loop, which at present are
+ associated with the topmost label. Everything is allowed to be
+ NULL. */
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
void
c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
- tree blab, tree clab, bool cond_is_first)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tree blab, tree clab, tree attrs, bool cond_is_first)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
{
tree entry = NULL, exit = NULL, t;
diff --git a/contrib/gcc/cp/ChangeLog.apple b/contrib/gcc/cp/ChangeLog.apple
new file mode 100644
index 0000000..a3eb812
--- /dev/null
+++ b/contrib/gcc/cp/ChangeLog.apple
@@ -0,0 +1,31 @@
+2006-02-15 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4445586
+ * semantics.c (begin_do_stmt): DO_STMT nodes take an
+ extra argument to build.
+
+ # APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+2007-08-03 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 5295549
+ * parser.c (cp_parser_iteration_statement): Handle attributes.
+ * semantics.c (begin_for_stmt): Put attributes in built tree.
+ (begin_while_stmt): Put attributes in built tree.
+ (begin_do_stmt): Put attributes in built tree.
+ * pt.c (tsubst_expr): Handle attributes for FOR_STMT, WHILE_STMT,
+ DO_STMT.
+ * cp-gimplify.c (gimplify_cp_loop): Handle attributes.
+ (gimplify_for_stmt): Pass attributes to gimplify_cp_loop.
+ (gimplify_while_stmt): Pass attributes to gimplify_cp_loop.
+ (gimplify_do_stmt): Pass attributes to gimplify_cp_loop.
+ * dump.c (cp_dump_tree): Dump attributes for FOR_STMT, WHILE_STMT,
+ DO_STMT.
+ * cp-tree.h (begin_while_stmt): Update prototype.
+ (begin_do_stmt): Likewise.
+ (begin_for_stmt): Likewise.
+ * cp-tree.def (FOR_STMT): Add extra parameter.
+ (WHILE_STMT): Likewise.
+ (DO_STMT): Likewise.
+ * init.c (build_vec_init): Update for change to begin_for_stmt.
+
+ # APPLE LOCAL end for-fsf-4_4 3274130 5295549
diff --git a/contrib/gcc/cp/cp-gimplify.c b/contrib/gcc/cp/cp-gimplify.c
index 2be5857..08d4ca0 100644
--- a/contrib/gcc/cp/cp-gimplify.c
+++ b/contrib/gcc/cp/cp-gimplify.c
@@ -188,7 +188,10 @@ gimplify_if_stmt (tree *stmt_p)
loop body as in do-while loops. */
static tree
-gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+gimplify_cp_loop (tree cond, tree body, tree incr, tree attrs,
+ bool cond_is_first, tree inner_foreach)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
{
tree top, entry, exit, cont_block, break_block, stmt_list, t;
location_t stmt_locus;
@@ -223,6 +226,12 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first)
out of the loop, or to the top of it. If there's no exit condition,
then we just build a jump back to the top. */
exit = build_and_jump (&LABEL_EXPR_LABEL (top));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+
+ /* Add the attributes to the 'top' label. */
+ decl_attributes (&LABEL_EXPR_LABEL (top), attrs, 0);
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
if (cond && !integer_nonzerop (cond))
{
t = build_bc_goto (bc_break);
@@ -270,8 +279,11 @@ gimplify_for_stmt (tree *stmt_p, tree *pre_p)
if (FOR_INIT_STMT (stmt))
gimplify_and_add (FOR_INIT_STMT (stmt), pre_p);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
*stmt_p = gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt),
- FOR_EXPR (stmt), 1);
+ FOR_EXPR (stmt), FOR_ATTRIBUTES (stmt), 1,
+ NULL_TREE);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
/* Gimplify a WHILE_STMT node. */
@@ -280,8 +292,11 @@ static void
gimplify_while_stmt (tree *stmt_p)
{
tree stmt = *stmt_p;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
*stmt_p = gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt),
- NULL_TREE, 1);
+ NULL_TREE, WHILE_ATTRIBUTES (stmt), 1,
+ NULL_TREE);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
/* Gimplify a DO_STMT node. */
@@ -290,8 +305,11 @@ static void
gimplify_do_stmt (tree *stmt_p)
{
tree stmt = *stmt_p;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
*stmt_p = gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt),
- NULL_TREE, 0);
+ NULL_TREE, DO_ATTRIBUTES (stmt), 0,
+ DO_FOREACH (stmt));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
/* Genericize a SWITCH_STMT by turning it into a SWITCH_EXPR. */
diff --git a/contrib/gcc/cp/cp-tree.def b/contrib/gcc/cp/cp-tree.def
index 55ef21e..5915fb6 100644
--- a/contrib/gcc/cp/cp-tree.def
+++ b/contrib/gcc/cp/cp-tree.def
@@ -281,18 +281,23 @@ DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", tcc_statement, 3)
and COND_EXPR for the benefit of templates. */
DEFTREECODE (IF_STMT, "if_stmt", tcc_statement, 3)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
/* Used to represent a `for' statement. The operands are
- FOR_INIT_STMT, FOR_COND, FOR_EXPR, and FOR_BODY, respectively. */
-DEFTREECODE (FOR_STMT, "for_stmt", tcc_statement, 4)
+ FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY and FOR_ATTRIBUTES
+ respectively. */
+DEFTREECODE (FOR_STMT, "for_stmt", tcc_statement, 5)
/* Used to represent a 'while' statement. The operands are WHILE_COND
- and WHILE_BODY, respectively. */
-DEFTREECODE (WHILE_STMT, "while_stmt", tcc_statement, 2)
+ WHILE_BODY, and WHILE_ATTRIBUTES respectively. */
+DEFTREECODE (WHILE_STMT, "while_stmt", tcc_statement, 3)
-/* Used to represent a 'do' statement. The operands are DO_BODY and
- DO_COND, respectively. */
-DEFTREECODE (DO_STMT, "do_stmt", tcc_statement, 2)
+/* APPLE LOCAL begin radar 4445586 */
+/* Used to represent a 'do' statement. The operands are DO_BODY,
+ DO_COND, DO_ATTRIBUTES, and DO_FOREACH respectively. */
+DEFTREECODE (DO_STMT, "do_stmt", tcc_statement, 4)
+/* APPLE LOCAL end radar 4445586 */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* Used to represent a 'break' statement. */
DEFTREECODE (BREAK_STMT, "break_stmt", tcc_statement, 0)
diff --git a/contrib/gcc/cp/cp-tree.h b/contrib/gcc/cp/cp-tree.h
index 0b30f38..6593832 100644
--- a/contrib/gcc/cp/cp-tree.h
+++ b/contrib/gcc/cp/cp-tree.h
@@ -3080,12 +3080,24 @@ extern void decl_shadowed_for_var_insert (tree, tree);
while statement and the body of the while statement, respectively. */
#define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
#define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+#define WHILE_ATTRIBUTES(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 2)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* DO_STMT accessors. These give access to the condition of the do
statement and the body of the do statement, respectively. */
#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
-
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+#define DO_ATTRIBUTES(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 2)
+/* APPLE LOCAL begin C* language */
+/* Used as a flag to indicate synthesized inner do-while loop of a
+ foreach statement. Used for generation of break/continue statement
+ of the loop. */
+#define DO_FOREACH(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 3)
+/* APPLE LOCAL end C* language */
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* FOR_STMT accessors. These give access to the init statement,
condition, update expression, and body of the for statement,
respectively. */
@@ -3093,7 +3105,10 @@ extern void decl_shadowed_for_var_insert (tree, tree);
#define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+#define FOR_ATTRIBUTES(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 4)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
@@ -4258,14 +4273,20 @@ extern tree finish_then_clause (tree);
extern void begin_else_clause (tree);
extern void finish_else_clause (tree);
extern void finish_if_stmt (tree);
-extern tree begin_while_stmt (void);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+extern tree begin_while_stmt (tree);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
extern void finish_while_stmt_cond (tree, tree);
extern void finish_while_stmt (tree);
-extern tree begin_do_stmt (void);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+extern tree begin_do_stmt (tree);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
extern void finish_do_body (tree);
extern void finish_do_stmt (tree, tree);
extern tree finish_return_stmt (tree);
-extern tree begin_for_stmt (void);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+extern tree begin_for_stmt (tree);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
extern void finish_for_init_stmt (tree);
extern void finish_for_cond (tree, tree);
extern void finish_for_expr (tree, tree);
diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c
index 40dbaba..8777f4b 100644
--- a/contrib/gcc/cp/decl.c
+++ b/contrib/gcc/cp/decl.c
@@ -232,10 +232,17 @@ int function_depth;
with __attribute__((deprecated)). An object declared as
__attribute__((deprecated)) suppresses warnings of uses of other
deprecated items. */
+/* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+/* An object declared as __attribute__((unavailable)) suppresses
+ any reports of being declared with unavailable or deprecated
+ items. */
+/* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
enum deprecated_states {
DEPRECATED_NORMAL,
DEPRECATED_SUPPRESS
+ /* APPLE LOCAL "unavailable" attribute (radar 2809697) */
+ , DEPRECATED_UNAVAILABLE_SUPPRESS
};
static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
@@ -3836,14 +3843,40 @@ start_decl (const cp_declarator *declarator,
tree decl;
tree type, tem;
tree context;
+ /* APPLE LOCAL "unavailable" attribute (radar 2809697) */
+ tree a;
bool was_public;
*pushed_scope_p = NULL_TREE;
- /* An object declared as __attribute__((deprecated)) suppresses
- warnings of uses of other deprecated items. */
+ /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
+ /* An object declared as __attribute__((unavailable)) suppresses
+ any reports of being declared with unavailable or deprecated
+ items. An object declared as __attribute__((deprecated))
+ suppresses warnings of uses of other deprecated items. */
+#ifdef A_LESS_INEFFICENT_WAY /* which I really don't want to do! */
if (lookup_attribute ("deprecated", attributes))
deprecated_state = DEPRECATED_SUPPRESS;
+ else if (lookup_attribute ("unavailable", attributes))
+ deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
+#else /* a more efficient way doing what lookup_attribute would do */
+ for (a = attributes; a; a = TREE_CHAIN (a))
+ {
+ tree name = TREE_PURPOSE (a);
+ if (TREE_CODE (name) == IDENTIFIER_NODE)
+ if (is_attribute_p ("deprecated", name))
+ {
+ deprecated_state = DEPRECATED_SUPPRESS;
+ break;
+ }
+ if (is_attribute_p ("unavailable", name))
+ {
+ deprecated_state = DEPRECATED_UNAVAILABLE_SUPPRESS;
+ break;
+ }
+ }
+#endif
+ /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
attributes = chainon (attributes, prefix_attributes);
@@ -7274,6 +7307,19 @@ grokdeclarator (const cp_declarator *declarator,
type = NULL_TREE;
type_was_error_mark_node = true;
}
+
+ /* APPLE LOCAL begin unavailable attribute (radar 2809697) --bowdidge */
+ /* If the entire declaration is itself tagged as unavailable then
+ suppress reports of unavailable/deprecated items. If the
+ entire declaration is tagged as only deprecated we still
+ report unavailable uses. */
+ if (type && TREE_DEPRECATED (type) && TREE_UNAVAILABLE (type))
+ {
+ if (deprecated_state != DEPRECATED_UNAVAILABLE_SUPPRESS)
+ warn_deprecated_use (type);
+ }
+ else
+ /* APPLE LOCAL end unavailable attribute (radar 2809697) --bowdidge */
/* If the entire declaration is itself tagged as deprecated then
suppress reports of deprecated items. */
if (type && TREE_DEPRECATED (type)
diff --git a/contrib/gcc/cp/dump.c b/contrib/gcc/cp/dump.c
index c63cfe2..b4253f3 100644
--- a/contrib/gcc/cp/dump.c
+++ b/contrib/gcc/cp/dump.c
@@ -433,6 +433,9 @@ cp_dump_tree (void* dump_info, tree t)
dump_stmt (di, t);
dump_child ("body", DO_BODY (t));
dump_child ("cond", DO_COND (t));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ dump_child ("attrs", DO_ATTRIBUTES (t));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
break;
case FOR_STMT:
@@ -441,6 +444,9 @@ cp_dump_tree (void* dump_info, tree t)
dump_child ("cond", FOR_COND (t));
dump_child ("expr", FOR_EXPR (t));
dump_child ("body", FOR_BODY (t));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ dump_child ("attrs", FOR_ATTRIBUTES (t));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
break;
case SWITCH_STMT:
@@ -453,6 +459,9 @@ cp_dump_tree (void* dump_info, tree t)
dump_stmt (di, t);
dump_child ("cond", WHILE_COND (t));
dump_child ("body", WHILE_BODY (t));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ dump_child ("attrs", WHILE_ATTRIBUTES (t));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
break;
case STMT_EXPR:
diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c
index 70bc764..fbdd609 100644
--- a/contrib/gcc/cp/init.c
+++ b/contrib/gcc/cp/init.c
@@ -2563,7 +2563,9 @@ build_vec_init (tree base, tree maxindex, tree init,
tree elt_init;
tree to;
- for_stmt = begin_for_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ for_stmt = begin_for_stmt (NULL_TREE);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
finish_for_init_stmt (for_stmt);
finish_for_cond (build2 (NE_EXPR, boolean_type_node, iterator,
build_int_cst (TREE_TYPE (iterator), -1)),
diff --git a/contrib/gcc/cp/parser.c b/contrib/gcc/cp/parser.c
index a021d5b..94f9078 100644
--- a/contrib/gcc/cp/parser.c
+++ b/contrib/gcc/cp/parser.c
@@ -6787,6 +6787,16 @@ cp_parser_condition (cp_parser* parser)
for ( for-init-statement condition [opt] ; expression [opt] )
statement
+ APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+ GNU extension:
+
+ while attributes [opt] ( condition ) statement
+ do attributes [opt] statement while ( expression ) ;
+ for attributes [opt]
+ ( for-init-statement condition [opt] ; expression [opt] )
+ statement
+
+ APPLE LOCAL end for-fsf-4_4 3274130 5295549
Returns the new WHILE_STMT, DO_STMT, or FOR_STMT. */
static tree
@@ -6794,10 +6804,14 @@ cp_parser_iteration_statement (cp_parser* parser)
{
cp_token *token;
enum rid keyword;
- tree statement;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tree statement, attributes;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
unsigned char in_statement;
- /* Peek at the next token. */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ /* Get the keyword at the start of the loop. */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
token = cp_parser_require (parser, CPP_KEYWORD, "iteration-statement");
if (!token)
return error_mark_node;
@@ -6806,6 +6820,11 @@ cp_parser_iteration_statement (cp_parser* parser)
statement. */
in_statement = parser->in_statement;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ /* Parse the attributes, if any. */
+ attributes = cp_parser_attributes_opt (parser);
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* See what kind of keyword it is. */
keyword = token->keyword;
switch (keyword)
@@ -6815,7 +6834,9 @@ cp_parser_iteration_statement (cp_parser* parser)
tree condition;
/* Begin the while-statement. */
- statement = begin_while_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ statement = begin_while_stmt (attributes);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* Look for the `('. */
cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
/* Parse the condition. */
@@ -6837,7 +6858,9 @@ cp_parser_iteration_statement (cp_parser* parser)
tree expression;
/* Begin the do-statement. */
- statement = begin_do_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ statement = begin_do_stmt (attributes);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* Parse the body of the do-statement. */
parser->in_statement = IN_ITERATION_STMT;
cp_parser_implicitly_scoped_statement (parser, NULL);
@@ -6864,7 +6887,9 @@ cp_parser_iteration_statement (cp_parser* parser)
tree expression = NULL_TREE;
/* Begin the for-statement. */
- statement = begin_for_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ statement = begin_for_stmt (attributes);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* Look for the `('. */
cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
/* Parse the initialization. */
diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c
index 1a5c20f..008f8f9 100644
--- a/contrib/gcc/cp/pt.c
+++ b/contrib/gcc/cp/pt.c
@@ -8593,8 +8593,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
}
case FOR_STMT:
- stmt = begin_for_stmt ();
- RECUR (FOR_INIT_STMT (t));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tmp = RECUR (FOR_ATTRIBUTES (t));
+ stmt = begin_for_stmt (tmp);
+ RECUR (FOR_INIT_STMT (t));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
finish_for_init_stmt (stmt);
tmp = RECUR (FOR_COND (t));
finish_for_cond (tmp, stmt);
@@ -8605,7 +8608,10 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
break;
case WHILE_STMT:
- stmt = begin_while_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tmp = RECUR (WHILE_ATTRIBUTES (t));
+ stmt = begin_while_stmt (tmp);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
tmp = RECUR (WHILE_COND (t));
finish_while_stmt_cond (tmp, stmt);
RECUR (WHILE_BODY (t));
@@ -8613,7 +8619,10 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
break;
case DO_STMT:
- stmt = begin_do_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tmp = RECUR (DO_ATTRIBUTES (t));
+ stmt = begin_do_stmt (tmp);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
RECUR (DO_BODY (t));
finish_do_body (stmt);
tmp = RECUR (DO_COND (t));
diff --git a/contrib/gcc/cp/semantics.c b/contrib/gcc/cp/semantics.c
index 547859b..c234e25 100644
--- a/contrib/gcc/cp/semantics.c
+++ b/contrib/gcc/cp/semantics.c
@@ -704,10 +704,14 @@ finish_if_stmt (tree if_stmt)
appropriate. */
tree
-begin_while_stmt (void)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+begin_while_stmt (tree attribs)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
{
tree r;
- r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE, attribs);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
add_stmt (r);
WHILE_BODY (r) = do_pushlevel (sk_block);
begin_cond (&WHILE_COND (r));
@@ -737,9 +741,14 @@ finish_while_stmt (tree while_stmt)
appropriate. */
tree
-begin_do_stmt (void)
-{
- tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+begin_do_stmt (tree attribs)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
+{
+ /* APPLE LOCAL radar 4445586 */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE, attribs, NULL_TREE);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
add_stmt (r);
DO_BODY (r) = push_stmt_list ();
return r;
@@ -803,12 +812,17 @@ finish_return_stmt (tree expr)
/* Begin a for-statement. Returns a new FOR_STMT if appropriate. */
tree
-begin_for_stmt (void)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+begin_for_stmt (tree attribs)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
{
tree r;
r = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
- NULL_TREE, NULL_TREE);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ NULL_TREE, NULL_TREE, attribs);
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
if (flag_new_for_scope > 0)
TREE_CHAIN (r) = do_pushlevel (sk_for);
diff --git a/contrib/gcc/doc/extend.texi b/contrib/gcc/doc/extend.texi
index c6bd57d..db6f1bd 100644
--- a/contrib/gcc/doc/extend.texi
+++ b/contrib/gcc/doc/extend.texi
@@ -58,6 +58,9 @@ extensions, accepted by GCC in C89 mode and in C++.
* Character Escapes:: @samp{\e} stands for the character @key{ESC}.
* Variable Attributes:: Specifying attributes of variables.
* Type Attributes:: Specifying attributes of types.
+@c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+* Label Attributes:: Specifying attributes of labels and statements.
+@c APPLE LOCAL end for-fsf-4_4 3274130 5295549
* Alignment:: Inquiring about the alignment of a type or variable.
* Inline:: Defining inline functions (as fast as macros).
* Extended Asm:: Assembler instructions with C expressions as operands.
@@ -1587,8 +1590,11 @@ attributes are currently defined for functions on all targets:
@code{gnu_inline} and @code{externally_visible}. Several other
attributes are defined for functions on particular target systems. Other
attributes, including @code{section} are supported for variables declarations
-(@pxref{Variable Attributes}) and for types (@pxref{Type Attributes}).
+@c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+(@pxref{Variable Attributes}), for types (@pxref{Type Attributes}),
+and labels (@pxref{Label Attributes}).
+@c APPLE LOCAL end for-fsf-4_4 3274130 5295549
You may also specify attributes with @samp{__} preceding and following
each keyword. This allows you to use them in header files without
being concerned about a possible macro of the same name. For example,
@@ -2640,10 +2646,14 @@ declarations only, but not on nested declarators.
@xref{Function Attributes}, for details of the semantics of attributes
applying to functions. @xref{Variable Attributes}, for details of the
-semantics of attributes applying to variables. @xref{Type Attributes},
-for details of the semantics of attributes applying to structure, union
-and enumerated types.
-
+@c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+semantics of attributes applying to variables. @xref{Type
+Attributes}, for details of the semantics of attributes applying to
+structure, union and enumerated types. @xref{Label Attributes}, for
+details of the semantics of attributes applying to labels and
+statements.
+
+@c APPLE LOCAL end for-fsf-4_4 3274130 5295549
An @dfn{attribute specifier} is of the form
@code{__attribute__ ((@var{attribute-list}))}. An @dfn{attribute list}
is a possibly empty comma-separated sequence of @dfn{attributes}, where
@@ -2680,19 +2690,18 @@ with the list being a single string constant.
An @dfn{attribute specifier list} is a sequence of one or more attribute
specifiers, not separated by any other tokens.
-In GNU C, an attribute specifier list may appear after the colon following a
-label, other than a @code{case} or @code{default} label. The only
-attribute it makes sense to use after a label is @code{unused}. This
-feature is intended for code generated by programs which contains labels
-that may be unused but which is compiled with @option{-Wall}. It would
-not normally be appropriate to use in it human-written code, though it
-could be useful in cases where the code that jumps to the label is
-contained within an @code{#ifdef} conditional. GNU C++ does not permit
-such placement of attribute lists, as it is permissible for a
-declaration, which could begin with an attribute list, to be labelled in
-C++. Declarations cannot be labelled in C90 or C99, so the ambiguity
-does not arise there.
+@c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+In GNU C, an attribute specifier list may appear after the colon
+following a label, other than a @code{case} or @code{default} label.
+GNU C++ does not permit such placement of attribute lists, as it is
+permissible for a declaration, which could begin with an attribute
+list, to be labelled in C++. Declarations cannot be labelled in C90
+or C99, so the ambiguity does not arise there.
+
+In GNU C an attribute specifier list may also appear after the keyword
+@code{while} in a while loop, after @code{do} and after @code{for}.
+@c APPLE LOCAL end for-fsf-4_4 3274130 5295549
An attribute specifier list may appear as part of a @code{struct},
@code{union} or @code{enum} specifier. It may go either immediately
after the @code{struct}, @code{union} or @code{enum} keyword, or after
@@ -2996,10 +3005,12 @@ by an attribute specification inside double parentheses. Some
attributes are currently defined generically for variables.
Other attributes are defined for variables on particular target
systems. Other attributes are available for functions
-(@pxref{Function Attributes}) and for types (@pxref{Type Attributes}).
-Other front ends might define more attributes
-(@pxref{C++ Extensions,,Extensions to the C++ Language}).
+@c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+(@pxref{Function Attributes}), types (@pxref{Type Attributes}) and
+labels (@pxref{Label Attributes}). Other front ends might define
+more attributes (@pxref{C++ Extensions,,Extensions to the C++ Language}).
+@c APPLE LOCAL end for-fsf-4_4 3274130 5295549
You may also specify attributes with @samp{__} preceding and following
each keyword. This allows you to use them in header files without
being concerned about a possible macro of the same name. For example,
@@ -3496,9 +3507,11 @@ inside double parentheses. Seven attributes are currently defined for
types: @code{aligned}, @code{packed}, @code{transparent_union},
@code{unused}, @code{deprecated}, @code{visibility}, and
@code{may_alias}. Other attributes are defined for functions
-(@pxref{Function Attributes}) and for variables (@pxref{Variable
-Attributes}).
+@c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+(@pxref{Function Attributes}), variables (@pxref{Variable
+Attributes}), and labels (@pxref{Label Attributes}).
+@c APPLE LOCAL end for-fsf-4_4 3274130 5295549
You may also specify any one of these attributes with @samp{__}
preceding and following its keyword. This allows you to use these
attributes in header files without being concerned about a possible
@@ -3846,6 +3859,67 @@ __attribute__((altivec(bool__))) unsigned
These attributes mainly are intended to support the @code{__vector},
@code{__pixel}, and @code{__bool} AltiVec keywords.
+@c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+@node Label Attributes
+@section Specifying Attributes of Labels and Statements
+@cindex attribute of labels
+@cindex label attributes
+@cindex attribute of statements
+@cindex statement attributes
+
+The keyword @code{__attribute__} allows you to specify special
+attributes of labels and statements.
+
+Some attributes are currently defined generically for variables.
+Other attributes are defined for variables on particular target
+systems. Other attributes are available for functions
+(@pxref{Function Attributes}), types (@pxref{Type Attributes}) and
+variables (@pxref{Variable Attributes}).
+
+You may also specify attributes with @samp{__} preceding and following
+each keyword. This allows you to use them in header files without
+being concerned about a possible macro of the same name. For example,
+you may use @code{__aligned__} instead of @code{aligned}.
+
+@xref{Attribute Syntax}, for details of the exact syntax for using
+attributes.
+
+@table @code
+@cindex @code{aligned} attribute
+@item aligned (@var{alignment})
+This attribute specifies a minimum alignment for the label,
+measured in bytes. For example, the declaration:
+
+@smallexample
+ some_label: __attribute__((aligned(16)))
+@end smallexample
+
+@noindent
+requests the compiler to align the label, inserting @code{nop}s as necessary,
+to a 16-byte boundary.
+
+The alignment is only a request. The compiler will usually be able to
+honour it but sometimes the label will be eliminated by the compiler,
+in which case its alignment will be eliminated too.
+
+When applied to loops, the @code{aligned} attribute causes the loop to
+be aligned.
+
+@item unused
+When attached to a label this attribute means that the label might not
+be used. GCC will not produce a warning for the label, even if the
+label doesn't seem to be referenced. This feature is intended for
+code generated by programs which contains labels that may be unused
+but which is compiled with @option{-Wall}. It would not normally be
+appropriate to use in it human-written code, though it could be useful
+in cases where the code that jumps to the label is contained within an
+@code{#ifdef} conditional.
+
+This attribute can only be applied to labels, not statements, because
+there is no warning if a statement is removed.
+@end table
+
+@c APPLE LOCAL end for-fsf-4_4 3274130 5295549
@node Inline
@section An Inline Function is As Fast As a Macro
@cindex inline functions
diff --git a/contrib/gcc/dwarf2out.c b/contrib/gcc/dwarf2out.c
index ad61de4..81fd022 100644
--- a/contrib/gcc/dwarf2out.c
+++ b/contrib/gcc/dwarf2out.c
@@ -2193,6 +2193,9 @@ output_call_frame_info (int for_eh)
specialization doesn't. */
if (TARGET_USES_WEAK_UNWIND_INFO
&& ! flag_asynchronous_unwind_tables
+/* APPLE LOCAL begin for-fsf-4_4 5480287 */ \
+ && flag_exceptions
+/* APPLE LOCAL end for-fsf-4_4 5480287 */ \
&& for_eh)
for (i = 0; i < fde_table_in_use; i++)
if ((fde_table[i].nothrow || fde_table[i].all_throwers_are_sibcalls)
diff --git a/contrib/gcc/emit-rtl.c b/contrib/gcc/emit-rtl.c
index 73ce0b4..fea0c11 100644
--- a/contrib/gcc/emit-rtl.c
+++ b/contrib/gcc/emit-rtl.c
@@ -2062,7 +2062,9 @@ rtx
gen_label_rtx (void)
{
return gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX, NULL_RTX,
- NULL, label_num++, NULL);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ NULL, label_num++, NULL, 0);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
/* For procedure integration. */
diff --git a/contrib/gcc/final.c b/contrib/gcc/final.c
index ef50ed9..90cad92 100644
--- a/contrib/gcc/final.c
+++ b/contrib/gcc/final.c
@@ -343,15 +343,13 @@ int insn_current_align;
for each insn we'll call the alignment chain of this insn in the following
comments. */
-struct label_alignment
-{
- short alignment;
- short max_skip;
-};
-
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
static rtx *uid_align;
static int *uid_shuid;
-static struct label_alignment *label_align;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* Indicate that branch shortening hasn't yet been done. */
@@ -555,20 +553,16 @@ final_addr_vec_align (rtx addr_vec)
#define INSN_SHUID(INSN) (uid_shuid[INSN_UID (INSN)])
-static int min_labelno, max_labelno;
-
-#define LABEL_TO_ALIGNMENT(LABEL) \
- (label_align[CODE_LABEL_NUMBER (LABEL) - min_labelno].alignment)
-
-#define LABEL_TO_MAX_SKIP(LABEL) \
- (label_align[CODE_LABEL_NUMBER (LABEL) - min_labelno].max_skip)
-
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* For the benefit of port specific code do this also as a function. */
int
label_to_alignment (rtx label)
{
- return LABEL_TO_ALIGNMENT (label);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ return LABEL_ALIGN_LOG (label);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
#ifdef HAVE_ATTR_length
@@ -617,7 +611,9 @@ align_fuzz (rtx start, rtx end, int known_align_log, unsigned int growth)
align_addr = INSN_ADDRESSES (uid) - insn_lengths[uid];
if (uid_shuid[uid] > end_shuid)
break;
- known_align_log = LABEL_TO_ALIGNMENT (align_label);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ known_align_log = LABEL_ALIGN_LOG (align_label);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
new_align = 1 << known_align_log;
if (new_align < known_align)
continue;
@@ -682,18 +678,12 @@ insn_current_reference_address (rtx branch)
static unsigned int
compute_alignments (void)
{
- int log, max_skip, max_log;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
basic_block bb;
- if (label_align)
- {
- free (label_align);
- label_align = 0;
- }
-
- max_labelno = max_label_num ();
- min_labelno = get_first_label_num ();
- label_align = XCNEWVEC (struct label_alignment, max_labelno - min_labelno + 1);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* If not optimizing or optimizing for size, don't assign any alignments. */
if (! optimize || optimize_size)
@@ -705,10 +695,19 @@ compute_alignments (void)
int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
edge e;
edge_iterator ei;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ int log, max_skip, max_log;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
if (!LABEL_P (label)
|| probably_never_executed_bb_p (bb))
continue;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ /* If user has specified an alignment, honour it. */
+ if (LABEL_ALIGN_LOG (label) > 0)
+ continue;
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
max_log = LABEL_ALIGN (label);
max_skip = LABEL_ALIGN_MAX_SKIP;
@@ -757,8 +756,9 @@ compute_alignments (void)
max_skip = LOOP_ALIGN_MAX_SKIP;
}
}
- LABEL_TO_ALIGNMENT (label) = max_log;
- LABEL_TO_MAX_SKIP (label) = max_skip;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ SET_LABEL_ALIGN (label, max_log, max_skip);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
return 0;
}
@@ -811,7 +811,9 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
#endif
- /* Compute maximum UID and allocate label_align / uid_shuid. */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ /* Compute maximum UID and allocate uid_shuid. */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
max_uid = get_max_uid ();
/* Free uid_shuid before reallocating it. */
@@ -819,29 +821,8 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
uid_shuid = XNEWVEC (int, max_uid);
- if (max_labelno != max_label_num ())
- {
- int old = max_labelno;
- int n_labels;
- int n_old_labels;
-
- max_labelno = max_label_num ();
-
- n_labels = max_labelno - min_labelno + 1;
- n_old_labels = old - min_labelno + 1;
-
- label_align = xrealloc (label_align,
- n_labels * sizeof (struct label_alignment));
-
- /* Range of labels grows monotonically in the function. Failing here
- means that the initialization of array got lost. */
- gcc_assert (n_old_labels <= n_labels);
-
- memset (label_align + n_old_labels, 0,
- (n_labels - n_old_labels) * sizeof (struct label_alignment));
- }
-
- /* Initialize label_align and set up uid_shuid to be strictly
+ /* APPLE LOCAL for-fsf-4_4 3274130 5295549 */ \
+ /* Initialize set up uid_shuid to be strictly
monotonically rising with insn order. */
/* We use max_log here to keep track of the maximum alignment we want to
impose on the next CODE_LABEL (or the current one if we are processing
@@ -863,11 +844,15 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
rtx next;
/* Merge in alignments computed by compute_alignments. */
- log = LABEL_TO_ALIGNMENT (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ log = LABEL_ALIGN_LOG (insn);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
if (max_log < log)
{
max_log = log;
- max_skip = LABEL_TO_MAX_SKIP (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ max_skip = LABEL_MAX_SKIP (insn);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
log = LABEL_ALIGN (insn);
@@ -895,8 +880,9 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
}
}
}
- LABEL_TO_ALIGNMENT (insn) = max_log;
- LABEL_TO_MAX_SKIP (insn) = max_skip;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ SET_LABEL_ALIGN (insn, max_log, max_skip);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
max_log = 0;
max_skip = 0;
}
@@ -943,7 +929,9 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
{
int uid = INSN_UID (seq);
int log;
- log = (LABEL_P (seq) ? LABEL_TO_ALIGNMENT (seq) : 0);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ log = (LABEL_P (seq) ? LABEL_ALIGN_LOG (seq) : 0);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
uid_align[uid] = align_tab[0];
if (log)
{
@@ -991,8 +979,10 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
max = shuid;
max_lab = lab;
}
- if (min_align > LABEL_TO_ALIGNMENT (lab))
- min_align = LABEL_TO_ALIGNMENT (lab);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ if (min_align > (int) LABEL_ALIGN_LOG (lab))
+ min_align = LABEL_ALIGN_LOG (lab);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
XEXP (pat, 2) = gen_rtx_LABEL_REF (Pmode, min_lab);
XEXP (pat, 3) = gen_rtx_LABEL_REF (Pmode, max_lab);
@@ -1021,7 +1011,9 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
if (LABEL_P (insn))
{
- int log = LABEL_TO_ALIGNMENT (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ int log = LABEL_ALIGN_LOG (insn);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
if (log)
{
int align = 1 << log;
@@ -1127,7 +1119,9 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
if (LABEL_P (insn))
{
- int log = LABEL_TO_ALIGNMENT (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ int log = LABEL_ALIGN_LOG (insn);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
if (log > insn_current_align)
{
int align = 1 << log;
@@ -1176,7 +1170,9 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
prev = PREV_INSN (prev))
if (varying_length[INSN_UID (prev)] & 2)
{
- rel_align = LABEL_TO_ALIGNMENT (prev);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ rel_align = LABEL_ALIGN_LOG (prev);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
break;
}
@@ -1848,26 +1844,27 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
case CODE_LABEL:
/* The target port might emit labels in the output function for
some insn, e.g. sh.c output_branchy_insn. */
- if (CODE_LABEL_NUMBER (insn) <= max_labelno)
- {
- int align = LABEL_TO_ALIGNMENT (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ {
+ int align = LABEL_ALIGN_LOG (insn);
#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
- int max_skip = LABEL_TO_MAX_SKIP (insn);
+ int max_skip = LABEL_MAX_SKIP (insn);
#endif
-
- if (align && NEXT_INSN (insn))
- {
+
+ if (align && NEXT_INSN (insn))
+ {
#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
- ASM_OUTPUT_MAX_SKIP_ALIGN (file, align, max_skip);
+ ASM_OUTPUT_MAX_SKIP_ALIGN (file, align, max_skip);
#else
#ifdef ASM_OUTPUT_ALIGN_WITH_NOP
- ASM_OUTPUT_ALIGN_WITH_NOP (file, align);
+ ASM_OUTPUT_ALIGN_WITH_NOP (file, align);
#else
- ASM_OUTPUT_ALIGN (file, align);
+ ASM_OUTPUT_ALIGN (file, align);
#endif
#endif
- }
- }
+ }
+ }
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
#ifdef HAVE_cc0
CC_STATUS_INIT;
/* If this label is reached from only one place, set the condition
diff --git a/contrib/gcc/print-rtl.c b/contrib/gcc/print-rtl.c
index a9c1a93..12f7425 100644
--- a/contrib/gcc/print-rtl.c
+++ b/contrib/gcc/print-rtl.c
@@ -606,6 +606,11 @@ print_rtx (rtx in_rtx)
case LABEL_WEAK_ENTRY: fputs (" [weak entry]", outfile); break;
default: gcc_unreachable ();
}
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ if (LABEL_ALIGN_LOG (in_rtx) > 0)
+ fprintf (outfile, " [log_align %u skip %u]", LABEL_ALIGN_LOG (in_rtx),
+ LABEL_MAX_SKIP (in_rtx));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
break;
default:
diff --git a/contrib/gcc/print-tree.c b/contrib/gcc/print-tree.c
index ef87ab6..1c480f9 100644
--- a/contrib/gcc/print-tree.c
+++ b/contrib/gcc/print-tree.c
@@ -302,6 +302,10 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
fputs (" static", file);
if (TREE_DEPRECATED (node))
fputs (" deprecated", file);
+ /* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) */
+ if (TREE_UNAVAILABLE (node))
+ fputs (" unavailable", file);
+ /* APPLE LOCAL end "unavailable" attribute (Radar 2809697) */
if (TREE_VISITED (node))
fputs (" visited", file);
if (TREE_LANG_FLAG_0 (node))
diff --git a/contrib/gcc/rtl.def b/contrib/gcc/rtl.def
index cb37f1a..f606443 100644
--- a/contrib/gcc/rtl.def
+++ b/contrib/gcc/rtl.def
@@ -139,9 +139,13 @@ DEF_RTL_EXPR(BARRIER, "barrier", "iuu000000", RTX_EXTRA)
4: is used in jump.c for the use-count of the label.
5: is used in flow.c to point to the chain of label_ref's to this label.
6: is a number that is unique in the entire compilation.
- 7: is the user-given name of the label, if any. */
-DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00is", RTX_EXTRA)
+ APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+ 7: is the user-given name of the label, if any.
+ 8: is the alignment of the label, made up of two parts,
+ LABEL_ALIGNMENT and LABEL_MAX_SKIP. */
+DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00isi", RTX_EXTRA)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
#ifdef USE_MAPPED_LOCATION
/* Say where in the code a source line starts, for symbol table's sake.
Operand:
diff --git a/contrib/gcc/rtl.h b/contrib/gcc/rtl.h
index 57de516..b92d53c 100644
--- a/contrib/gcc/rtl.h
+++ b/contrib/gcc/rtl.h
@@ -908,6 +908,15 @@ extern const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS];
of LABEL_REFs that point at it, so unused labels can be deleted. */
#define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* The alignment of the label, as the log-base-2 of the alignment in bytes. */
+#define LABEL_ALIGN_LOG(RTX) (XCUINT (RTX, 8, CODE_LABEL) & 0xFF)
+/* The maximum number of bytes to skip to achieve that alignment. */
+#define LABEL_MAX_SKIP(RTX) (XCUINT (RTX, 8, CODE_LABEL) >> 8)
+#define SET_LABEL_ALIGN(RTX, ALIGN, MAX_SKIP) \
+ (XCUINT (RTX, 8, CODE_LABEL) = (ALIGN) | ((MAX_SKIP) << 8))
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
/* Labels carry a two-bit field composed of the ->jump and ->call
bits. This field indicates whether the label is an alternate
entry point, and if so, what kind. */
diff --git a/contrib/gcc/stmt.c b/contrib/gcc/stmt.c
index 671e98a..279691b 100644
--- a/contrib/gcc/stmt.c
+++ b/contrib/gcc/stmt.c
@@ -136,9 +136,19 @@ label_rtx (tree label)
if (!DECL_RTL_SET_P (label))
{
rtx r = gen_label_rtx ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ unsigned align = DECL_ALIGN_UNIT (label);
+ int align_log2 = exact_log2 (align);
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
SET_DECL_RTL (label, r);
if (FORCED_LABEL (label) || DECL_NONLOCAL (label))
LABEL_PRESERVE_P (r) = 1;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+
+ if (align_log2 >= 0 && align_log2 <= 0xFF)
+ SET_LABEL_ALIGN (r, align_log2, align - 1);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
}
return DECL_RTL (label);
@@ -194,11 +204,12 @@ expand_computed_goto (tree exp)
/* Specify the location in the RTL code of a label LABEL,
which is a LABEL_DECL tree node.
- This is used for the kind of label that the user can jump to with a
- goto statement, and for alternatives of a switch or case statement.
- RTL labels generated for loops and conditionals don't go through here;
- they are generated directly at the RTL level, by other functions below.
+ APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+ This is used for those labels created by the front-end that survive
+ through CFG generation, including all user labels. (Some labels
+ are removed by cleanup_dead_labels in tree-cfg.c.)
+ APPLE LOCAL end for-fsf-4_4 3274130 5295549
Note that this has nothing to do with defining label *names*.
Languages vary in how they do that and what that even means. */
diff --git a/contrib/gcc/toplev.c b/contrib/gcc/toplev.c
index ab6a7ff..786ec12 100644
--- a/contrib/gcc/toplev.c
+++ b/contrib/gcc/toplev.c
@@ -946,6 +946,46 @@ warn_deprecated_use (tree node)
}
}
+/* APPLE LOCAL begin "unavailable" attribute (radar 2809697) --ilr */
+/* Warn about a use of an identifier which was marked deprecated. */
+void
+error_unavailable_use (tree node)
+{
+ if (node == 0)
+ return;
+
+ if (DECL_P (node))
+ error ("%qs is unavailable (declared at %s:%d)",
+ IDENTIFIER_POINTER (DECL_NAME (node)),
+ DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
+ else if (TYPE_P (node))
+ {
+ const char *what = NULL;
+ tree decl = TYPE_STUB_DECL (node);
+
+ if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
+ what = IDENTIFIER_POINTER (TYPE_NAME (node));
+ else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (node)))
+ what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
+
+ if (what)
+ {
+ if (decl)
+ error ("%qs is unavailable (declared at %s:%d)", what,
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ else
+ error ("%qs is unavailable", what);
+ }
+ else if (decl)
+ error ("type is unavailable (declared at %s:%d)",
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ else
+ error ("type is unavailable");
+ }
+}
+/* APPLE LOCAL end "unavailable" attribute (radar 2809697) --ilr */
+
/* Save the current INPUT_LOCATION on the top entry in the
INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the
INPUT_LOCATION accordingly. */
diff --git a/contrib/gcc/toplev.h b/contrib/gcc/toplev.h
index c935f7e..3b07441 100644
--- a/contrib/gcc/toplev.h
+++ b/contrib/gcc/toplev.h
@@ -79,6 +79,8 @@ extern void announce_function (tree);
extern void error_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warning_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warn_deprecated_use (tree);
+/* APPLE LOCAL "unavailable" attribute (radar 2809697) */
+extern void error_unavailable_use (tree);
#ifdef BUFSIZ
extern void output_quoted_string (FILE *, const char *);
diff --git a/contrib/gcc/tree-cfg.c b/contrib/gcc/tree-cfg.c
index 7573439..60c474b 100644
--- a/contrib/gcc/tree-cfg.c
+++ b/contrib/gcc/tree-cfg.c
@@ -1051,9 +1051,12 @@ cleanup_dead_labels (void)
for_each_eh_region (update_eh_label);
- /* Finally, purge dead labels. All user-defined labels and labels that
- can be the target of non-local gotos and labels which have their
- address taken are preserved. */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ /* Finally, purge dead labels. All user-defined labels, labels that
+ can be the target of non-local gotos, labels which have their
+ address taken and labels which have attributes or alignment are
+ preserved. */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
FOR_EACH_BB (bb)
{
block_stmt_iterator i;
@@ -1073,6 +1076,10 @@ cleanup_dead_labels (void)
if (label == label_for_this_bb
|| ! DECL_ARTIFICIAL (label)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ || DECL_ATTRIBUTES (label)
+ || DECL_USER_ALIGN (label)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
|| DECL_NONLOCAL (label)
|| FORCED_LABEL (label))
bsi_next (&i);
diff --git a/contrib/gcc/tree.h b/contrib/gcc/tree.h
index 6cfc3d3..e8870f0 100644
--- a/contrib/gcc/tree.h
+++ b/contrib/gcc/tree.h
@@ -386,6 +386,8 @@ struct tree_common GTY(())
unsigned lang_flag_5 : 1;
unsigned lang_flag_6 : 1;
unsigned visited : 1;
+ /* APPLE LOCAL "unavailable" attribute (Radar 2809697) --ilr */
+ unsigned unavailable_flag : 1;
};
/* The following table lists the uses of each of the above flags and
@@ -533,6 +535,13 @@ struct tree_common GTY(())
IDENTIFIER_TRANSPARENT_ALIAS in
IDENTIFIER_NODE
+ APPLE LOCAL begin "unavailable" attribute (Radar 2809697)
+ unavailable_flag:
+
+ TREE_UNAVAILABLE in
+ ..._DECL
+ APPLE LOCAL end "unavailable" attribute (Radar 2809697)
+
visited:
Used in tree traversals to mark visited nodes.
@@ -1226,6 +1235,12 @@ extern void omp_clause_range_check_failed (const tree, const char *, int,
#define TREE_DEPRECATED(NODE) \
((NODE)->common.deprecated_flag)
+/* APPLE LOCAL begin "unavailable" attribute (Radar 2809697) */
+/* Nonzero in a IDENTIFIER_NODE if the use of the name is defined as a
+ unavailable feature by __attribute__((unavailable)). */
+#define TREE_UNAVAILABLE(NODE) ((NODE)->common.unavailable_flag)
+/* APPLE LOCAL end "unavailable" attribute (Radar 2809697) */
+
/* Nonzero in an IDENTIFIER_NODE if the name is a local alias, whose
uses are to be substituted for uses of the TREE_CHAINed identifier. */
#define IDENTIFIER_TRANSPARENT_ALIAS(NODE) \
OpenPOWER on IntegriCloud