# HG changeset patch # User Nobuyasu Oshiro # Date 1313932952 -32400 # Node ID 20c18990c3e409a3e3c09f27dc73c2c8e912d450 # Parent e334828451cba4237d786f7c9a6fb0dfcc942203 merge gcc/c-typeck.c diff -r e334828451cb -r 20c18990c3e4 gcc/c-typeck.c --- a/gcc/c-typeck.c Sun Aug 21 14:50:19 2011 +0900 +++ b/gcc/c-typeck.c Sun Aug 21 22:22:32 2011 +0900 @@ -41,6 +41,10 @@ #include "bitmap.h" #include "gimple.h" #include "c-family/c-objc.h" +#ifndef noCbC + #include "cbc-tree.h" +#endif + /* Possible cases of implicit bad conversions. Used to select diagnostic messages in convert_for_assignment. */ @@ -478,6 +482,9 @@ /* Function types: prefer the one that specified arg types. If both do, merge the arg types. Also merge the return types. */ { +#ifndef noCbC + int is_code_segment = CbC_IS_CODE_SEGMENT(t1); +#endif tree valtype = composite_type (TREE_TYPE (t1), TREE_TYPE (t2)); tree p1 = TYPE_ARG_TYPES (t1); tree p2 = TYPE_ARG_TYPES (t2); @@ -494,12 +501,20 @@ /* Simple way if one arg fails to specify argument types. */ if (TYPE_ARG_TYPES (t1) == 0) { +#ifndef noCbC + if (is_code_segment) t1 = build_code_segment_type (valtype, TYPE_ARG_TYPES (t2)); + else +#endif t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2)); t1 = build_type_attribute_variant (t1, attributes); return qualify_type (t1, t2); } if (TYPE_ARG_TYPES (t2) == 0) { +#ifndef noCbC + if (is_code_segment) t1 = build_code_segment_type (valtype, TYPE_ARG_TYPES (t1)); + else +#endif t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1)); t1 = build_type_attribute_variant (t1, attributes); return qualify_type (t1, t2); @@ -593,6 +608,10 @@ } c_override_global_bindings_to_false = false; +#ifndef noCbC + if (is_code_segment) t1 = build_code_segment_type (valtype, newargs); + else +#endif t1 = build_function_type (valtype, newargs); t1 = qualify_type (t1, t2); /* ... falls through ... */ @@ -2458,7 +2477,11 @@ } else if (fun) /* Implicit function declaration. */ +#ifndef noCbC + ref = implicitly_declare (loc, id, fun); +#else ref = implicitly_declare (loc, id); +#endif else if (decl == error_mark_node) /* Don't complain about something that's already been complained about. */ @@ -3162,7 +3185,13 @@ gcc_assert (parmnum == VEC_length (tree, values)); +#ifndef noCbC + if (typetail != 0 && TREE_VALUE (typetail) != void_type_node + //&& !CbC_IS_CODE_SEGMENT(TREE_TYPE(fundecl)) ) + && !(fundecl&&CbC_IS_CODE_SEGMENT(fundecl)) ) +#else if (typetail != 0 && TREE_VALUE (typetail) != void_type_node) +#endif { error_at (input_location, "too few arguments to function %qE", function);