Mercurial > hg > CbC > CbC_gcc
diff gcc/config/darwin-c.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
line wrap: on
line diff
--- a/gcc/config/darwin-c.c Tue May 25 18:58:51 2010 +0900 +++ b/gcc/config/darwin-c.c Tue Mar 22 17:18:12 2011 +0900 @@ -1,5 +1,5 @@ /* Darwin support needed only by C/C++ frontends. - Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008 + Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc. Contributed by Apple Computer Inc. @@ -25,11 +25,11 @@ #include "tm.h" #include "cpplib.h" #include "tree.h" -#include "c-pragma.h" -#include "c-tree.h" #include "incpath.h" -#include "c-common.h" -#include "toplev.h" +#include "c-family/c-common.h" +#include "c-family/c-pragma.h" +#include "c-family/c-format.h" +#include "diagnostic-core.h" #include "flags.h" #include "tm_p.h" #include "cppdefault.h" @@ -589,7 +589,7 @@ return result; fail: - error ("Unknown value %qs of -mmacosx-version-min", + error ("unknown value %qs of -mmacosx-version-min", darwin_macosx_version_min); return "1000"; } @@ -608,8 +608,30 @@ to be defined and won't work if it isn't. */ builtin_define_with_value ("__APPLE_CC__", "1", false); + if (darwin_constant_cfstrings) + builtin_define ("__CONSTANT_CFSTRINGS__"); + builtin_define_with_value ("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__", version_as_macro(), false); + + /* Since we do not (at 4.6) support ObjC gc for the NeXT runtime, the + following will cause a syntax error if one tries to compile gc attributed + items. However, without this, NeXT system headers cannot be parsed + properly (on systems >= darwin 9). */ + if (flag_objc_gc) + { + builtin_define ("__strong=__attribute__((objc_gc(strong)))"); + builtin_define ("__weak=__attribute__((objc_gc(weak)))"); + builtin_define ("__OBJC_GC__"); + } + else + { + builtin_define ("__strong="); + builtin_define ("__weak="); + } + + if (flag_objc_abi == 2) + builtin_define ("__OBJC2__"); } /* Handle C family front-end options. */ @@ -642,3 +664,54 @@ #define TARGET_HANDLE_C_OPTION handle_c_option struct gcc_targetcm targetcm = TARGETCM_INITIALIZER; + +/* Allow ObjC* access to CFStrings. */ +tree +darwin_objc_construct_string (tree str) +{ + if (!darwin_constant_cfstrings) + { + /* Even though we are not using CFStrings, place our literal + into the cfstring_htab hash table, so that the + darwin_constant_cfstring_p() function will see it. */ + darwin_enter_string_into_cfstring_table (str); + /* Fall back to NSConstantString. */ + return NULL_TREE; + } + + return darwin_build_constant_cfstring (str); +} + +/* The string ref type is created as CFStringRef by <CFBase.h> therefore, we + must match for it explicitly, since it's outside the gcc code. */ + +bool +darwin_cfstring_ref_p (const_tree strp) +{ + tree tn; + if (!strp || TREE_CODE (strp) != POINTER_TYPE) + return false; + + tn = TYPE_NAME (strp); + if (tn) + tn = DECL_NAME (tn); + return (tn + && IDENTIFIER_POINTER (tn) + && !strncmp (IDENTIFIER_POINTER (tn), "CFStringRef", 8)); +} + +/* At present the behavior of this is undefined and it does nothing. */ +void +darwin_check_cfstring_format_arg (tree ARG_UNUSED (format_arg), + tree ARG_UNUSED (args_list)) +{ +} + +/* The extra format types we recognize. */ +EXPORTED_CONST format_kind_info darwin_additional_format_types[] = { + { "CFString", NULL, NULL, NULL, NULL, + NULL, NULL, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL, 0, 0, 0, 0, 0, 0, + NULL, NULL + } +};