diff options
author | pfg <pfg@FreeBSD.org> | 2014-01-26 19:49:54 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-01-26 19:49:54 +0000 |
commit | fe288f1b72a13316f613e06cd07d4d777cd59b99 (patch) | |
tree | 388002273457e1ebeee9510b9908dc299e3748f1 /contrib/gcc/stub-objc.c | |
parent | 5c96f061e7bff64c2387d5fd90ff095b71ce59b2 (diff) | |
download | FreeBSD-src-fe288f1b72a13316f613e06cd07d4d777cd59b99.zip FreeBSD-src-fe288f1b72a13316f613e06cd07d4d777cd59b99.tar.gz |
MFC r260311, r260831:
gcc: Add support for Apple's Block extension
Block objects [1] are a C-level syntactic and runtime feature. They
are similar to standard C functions, but in addition to executable
code they may also contain variable bindings to automatic (stack)
or managed (heap) memory. A block can therefore maintain a set of
state (data) that it can use to impact behavior when executed.
This port is based on Apple's GCC 5646 with some bugfixes from
Apple GCC 5666.3. It has some small differences with the support
in clang, which remains the recommended compiler.
Perhaps the most notable difference is that in GCC __block is not
actually a keyword, but a macro. There may be workaround for this
issue in the future. Other issues can be consulted in the clang
documentation [2]
For better compatiblity with Apple's GCC and llvm-gcc, some related
fixes and features from Apple have been included. Support for the
non-standard nested functions in GCC is now off by default.
No effort was made to update the ObjC support since FreeBSD doesn't
carry ObjC in the base system but some of the code crept in and
was more difficult to remove than to adjust.
References:
[1]
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html
[2]
http://clang.llvm.org/compatibility.html#block-variable-initialization
Obtained from: Apple GCC 4.2
Diffstat (limited to 'contrib/gcc/stub-objc.c')
-rw-r--r-- | contrib/gcc/stub-objc.c | 274 |
1 files changed, 267 insertions, 7 deletions
diff --git a/contrib/gcc/stub-objc.c b/contrib/gcc/stub-objc.c index 0cd6017..0277289 100644 --- a/contrib/gcc/stub-objc.c +++ b/contrib/gcc/stub-objc.c @@ -45,6 +45,13 @@ objc_is_object_ptr (tree ARG_UNUSED (arg)) return 0; } +/* APPLE LOCAL begin radar 4133425 */ +bool objc_diagnose_private_ivar (tree ARG_UNUSED (arg)) +{ + return false; +} +/* APPLE LOCAL end radar 4133425 */ + tree objc_lookup_ivar (tree other, tree ARG_UNUSED (arg)) { @@ -56,6 +63,28 @@ void objc_check_decl (tree ARG_UNUSED (decl)) { } + +/* APPLE LOCAL begin radar 4281748 */ +void +objc_check_global_decl (tree ARG_UNUSED (decl)) +{ +} +/* APPLE LOCAL end radar 4281748 */ + +/* APPLE LOCAL begin radar 4330422 */ +tree +objc_non_volatilized_type (tree type) +{ + return type; +} +/* APPLE LOCAL end radar 4330422 */ + +/* APPLE LOCAL begin radar 4697411 */ +void +objc_volatilize_component_ref (tree ARG_UNUSED (cref), tree ARG_UNUSED (type)) +{ +} +/* APPLE LOCAL end radar 4697411 */ int objc_is_reserved_word (tree ARG_UNUSED (ident)) @@ -63,12 +92,33 @@ objc_is_reserved_word (tree ARG_UNUSED (ident)) return 0; } +/* APPLE LOCAL begin 4154928 */ +tree +objc_common_type (tree ARG_UNUSED (type1), tree ARG_UNUSED (type2)) +{ + return false; +} +/* APPLE LOCAL end 4154928 */ + bool objc_compare_types (tree ARG_UNUSED (ltyp), tree ARG_UNUSED (rtyp), - int ARG_UNUSED (argno), tree ARG_UNUSED (callee)) + /* APPLE LOCAL begin radar 6231433 */ + int ARG_UNUSED (argno), tree ARG_UNUSED (callee), + const char * ARG_UNUSED (message)) + /* APPLE LOCAL end radar 6231433 */ +{ + return false; +} + +/* APPLE LOCAL begin radar 4229905 - radar 6231433 */ +bool +objc_have_common_type (tree ARG_UNUSED (ltyp), tree ARG_UNUSED (rtyp), + int ARG_UNUSED (argno), tree ARG_UNUSED (callee), + const char * ARG_UNUSED (message)) { return false; } +/* APPLE LOCAL end radar 4229905 - radar 6231433 */ void objc_volatilize_decl (tree ARG_UNUSED (decl)) @@ -104,20 +154,26 @@ objc_declare_class (tree ARG_UNUSED (list)) } void -objc_declare_protocols (tree ARG_UNUSED (list)) +/* APPLE LOCAL begin radar 4947311 - protocol attributes */ +objc_declare_protocols (tree ARG_UNUSED (list), tree ARG_UNUSED (attributes)) { } void objc_start_protocol (tree ARG_UNUSED (proto), - tree ARG_UNUSED (protorefs)) + tree ARG_UNUSED (protorefs), + tree ARG_UNUSED (attributes)) { } +/* APPLE LOCAL end radar 4947311 - protocol attributes */ void objc_start_class_interface (tree ARG_UNUSED (name), tree ARG_UNUSED (super), - tree ARG_UNUSED (protos)) +/* APPLE LOCAL begin radar 4548636 */ + tree ARG_UNUSED (protos), + tree ARG_UNUSED (attributes)) +/* APPLE LOCAL end radar 4548636 */ { } @@ -181,12 +237,18 @@ objc_finish_implementation (void) } void -objc_add_method_declaration (tree ARG_UNUSED (signature)) +/* APPLE LOCAL begin radar 3803157 - objc attribute */ +objc_add_method_declaration (tree ARG_UNUSED (signature), + tree ARG_UNUSED (attribute)) +/* APPLE LOCAL end radar 3803157 - objc attribute */ { } void -objc_start_method_definition (tree ARG_UNUSED (signature)) +/* APPLE LOCAL begin radar 3803157 - objc attribute */ +objc_start_method_definition (tree ARG_UNUSED (signature), + tree ARG_UNUSED (attribute)) +/* APPLE LOCAL end radar 3803157 - objc attribute */ { } @@ -198,7 +260,10 @@ objc_finish_method_definition (tree ARG_UNUSED (fndecl)) tree objc_build_keyword_decl (tree ARG_UNUSED (selector), tree ARG_UNUSED (typename), - tree ARG_UNUSED (identifier)) + /* APPLE LOCAL begin radar 4157812 */ + tree ARG_UNUSED (identifier), + tree ARG_UNUSED (attribute)) + /* APPLE LOCAL end radar 4157812 */ { return 0; } @@ -248,6 +313,18 @@ objc_get_class_reference (tree ARG_UNUSED (name)) return 0; } +/* APPLE LOCAL begin radar 4291785 */ +tree +objc_get_interface_ivars (tree ARG_UNUSED (fieldlist)) +{ + return 0; +} +void +objc_detect_field_duplicates (tree ARG_UNUSED (fieldlist)) +{ +} +/* APPLE LOCAL end radar 4291785 */ + tree objc_get_protocol_qualified_type (tree ARG_UNUSED (name), tree ARG_UNUSED (protos)) @@ -273,6 +350,49 @@ objc_is_public (tree ARG_UNUSED (expr), tree ARG_UNUSED (identifier)) return 1; } +/* APPLE LOCAL begin C* language */ +void +objc_set_method_opt (int ARG_UNUSED (opt)) +{ +} + +tree +objc_build_component_ref (tree ARG_UNUSED (datum), tree ARG_UNUSED (component)) +{ + return 0; +} + +tree +objc_build_foreach_components (tree ARG_UNUSED (receiver), + tree *ARG_UNUSED (enumState_decl), + tree *ARG_UNUSED (items_decl), + tree *ARG_UNUSED (limit_decl), + tree *ARG_UNUSED (startMutations_decl), + tree *ARG_UNUSED (counter_decl), + tree *ARG_UNUSED (countByEnumeratingWithState)) +{ + return 0; +} +/* APPLE LOCAL end C* language */ + +/* APPLE LOCAL begin C* property (Radar 4436866) */ +void +objc_set_property_attr (int ARG_UNUSED (code), tree ARG_UNUSED (identifier)) +{ +} +void +objc_add_property_variable (tree ARG_UNUSED (prop)) +{ +} +/* APPLE LOCAL radar 5285911 */ +/* Stub for objc_build_getter_call is removed. */ +tree +objc_build_setter_call (tree ARG_UNUSED (lhs), tree ARG_UNUSED (rhs)) +{ + return 0; +} +/* APPLE LOCAL end C* property (Radar 4436866) */ + tree objc_get_class_ivars (tree ARG_UNUSED (name)) { @@ -326,3 +446,143 @@ objc_generate_write_barrier (tree ARG_UNUSED (lhs), { return 0; } +/* APPLE LOCAL begin radar 5276085 */ +void objc_weak_reference_expr (tree* ARG_UNUSED (expr)) +{ +} + +tree +objc_build_weak_reference_tree (tree expr) +{ + return expr; +} +/* APPLE LOCAL end radar 5276085 */ + +/* APPLE LOCAL begin C* warnings to easy porting to new abi */ +void +diagnose_selector_cast (tree ARG_UNUSED (cast_type), tree ARG_UNUSED (sel_exp)) +{ +} +/* APPLE LOCAL end C* warnings to easy porting to new abi */ + +/* APPLE LOCAL begin radar 4441049 */ +tree +objc_v2_component_ref_field_offset (tree ARG_UNUSED (exp)) +{ + return 0; +} + +tree +objc_v2_bitfield_ivar_bitpos (tree ARG_UNUSED (exp)) +{ + return 0; +} +/* APPLE LOCAL end radar 4441049 */ +/* APPLE LOCAL begin radar 4507230 */ +bool +objc_type_valid_for_messaging (tree ARG_UNUSED (exp)) +{ + return false; +} +/* APPLE LOCAL end radar 4507230 */ +/* APPLE LOCAL begin radar 3803157 - objc attribute */ +bool +objc_method_decl (enum tree_code ARG_UNUSED (opcode)) +{ + return false; +} +/* APPLE LOCAL end radar 3803157 - objc attribute */ + +/* APPLE LOCAL begin radar 4708210 (for_objc_collection in 4.2) */ +void +objc_finish_foreach_loop (location_t ARG_UNUSED (location), tree ARG_UNUSED (cond), + tree ARG_UNUSED (for_body), tree ARG_UNUSED (blab), + tree ARG_UNUSED (clab)) +{ + return; +} +/* APPLE LOCAL end radar 4708210 (for_objc_collection in 4.2) */ +/* APPLE LOCAL begin radar 5847976 */ +int +objc_is_gcable_type (tree ARG_UNUSED (type)) +{ + return 0; +} +/* APPLE LOCAL end radar 5847976 */ +/* APPLE LOCAL begin radar 4592503 */ +void +objc_checkon_weak_attribute (tree ARG_UNUSED (decl)) +{ + return; +} +/* APPLE LOCAL end radar 4592503 */ +/* APPLE LOCAL begin radar 4712269 */ +tree +objc_build_incr_decr_setter_call (enum tree_code ARG_UNUSED (code), + tree ARG_UNUSED (lhs), + tree ARG_UNUSED (inc)) +{ + return NULL_TREE; +} +/* APPLE LOCAL end radar 4712269 */ +/* APPLE LOCAL begin objc new property */ +void objc_declare_property_impl (int ARG_UNUSED (code), + tree ARG_UNUSED (tree_list)) +{ +} +/* APPLE LOCAL begin radar 5285911 */ +tree +objc_build_property_reference_expr (tree ARG_UNUSED (datum), + tree ARG_UNUSED (component)) +{ + return 0; +} +bool +objc_property_reference_expr (tree ARG_UNUSED (exp)) +{ + return false; +} +/* APPLE LOCAL end radar 5285911 */ +/* APPLE LOCAL end objc new property */ +/* APPLE LOCAL begin radar 4985544 */ +bool +objc_check_format_nsstring (tree ARG_UNUSED (argument), + unsigned HOST_WIDE_INT ARG_UNUSED (format_num), + bool * ARG_UNUSED(no_add_attrs)) +{ + return false; +} +/* APPLE LOCAL end radar 4985544 */ +/* APPLE LOCAL begin radar 5202926 */ +bool +objc_anonymous_local_objc_name (const char * ARG_UNUSED (name)) +{ + return false; +} +/* APPLE LOCAL begin radar 5195402 */ +bool +objc_check_nsstring_pointer_type (tree ARG_UNUSED (type)) +{ + return false; +} +/* APPLE LOCAL end radar 5195402 */ +/* APPLE LOCAL end radar 5202926 */ + +/* APPLE LOCAL begin radar 5782740 - blocks */ +bool block_requires_copying (tree exp) +{ + /* APPLE LOCAL begin radar 6175959 */ + tree type = TREE_TYPE (exp); + return TREE_CODE (type) == BLOCK_POINTER_TYPE + || (POINTER_TYPE_P (type) + && lookup_attribute ("NSObject", TYPE_ATTRIBUTES (type))); + /* APPLE LOCAL end radar 6175959 */ +} +/* APPLE LOCAL end radar 5782740 - blocks */ + +/* APPLE LOCAL begin radar 5802025 */ +tree objc_build_property_getter_func_call (tree object) +{ + return object; +} +/* APPLE LOCAL end radar 5802025 */ |