Mercurial > hg > CbC > CbC_gcc
comparison gcc/c/c-decl.c @ 113:bdf41c9fa0b7
remove RECTYPE
author | mir3636 |
---|---|
date | Fri, 17 Nov 2017 06:33:55 +0900 |
parents | ab0bcb71f44d |
children | d34655255c78 |
comparison
equal
deleted
inserted
replaced
112:ab0bcb71f44d | 113:bdf41c9fa0b7 |
---|---|
5870 declspecs->thread_gnu_p ? "__thread" : "_Thread_local"); | 5870 declspecs->thread_gnu_p ? "__thread" : "_Thread_local"); |
5871 threadp = false; | 5871 threadp = false; |
5872 } | 5872 } |
5873 } | 5873 } |
5874 | 5874 |
5875 #ifndef noCbC | |
5876 if ( declspecs->typespec_word == cts_CbC_rec ) | |
5877 { | |
5878 // IS_RECTYPE(type) = 1; | |
5879 // type = build_code_segment_type (type, NULL_TREE); | |
5880 IS_RECTYPE(type) = 1; | |
5881 } | |
5882 #endif | |
5883 | |
5884 /* Now figure out the structure of the declarator proper. | 5875 /* Now figure out the structure of the declarator proper. |
5885 Descend through it, creating more complex types, until we reach | 5876 Descend through it, creating more complex types, until we reach |
5886 the declared identifier (or NULL_TREE, in an absolute declarator). | 5877 the declared identifier (or NULL_TREE, in an absolute declarator). |
5887 At each stage we maintain an unqualified version of the type | 5878 At each stage we maintain an unqualified version of the type |
5888 together with any qualifiers that should be applied to it with | 5879 together with any qualifiers that should be applied to it with |
6476 TYPE_NAME (type) = decl; | 6467 TYPE_NAME (type) = decl; |
6477 } | 6468 } |
6478 | 6469 |
6479 type = c_build_pointer_type (type); | 6470 type = c_build_pointer_type (type); |
6480 | 6471 |
6481 #ifndef noCbC | |
6482 if ( declspecs->typespec_word == cts_CbC_rec ){ | |
6483 IS_RECTYPE(type) = 1; | |
6484 } | |
6485 #endif | |
6486 | |
6487 /* Process type qualifiers (such as const or volatile) | 6472 /* Process type qualifiers (such as const or volatile) |
6488 that were given inside the `*'. */ | 6473 that were given inside the `*'. */ |
6489 type_quals = declarator->u.pointer_quals; | 6474 type_quals = declarator->u.pointer_quals; |
6490 | 6475 |
6491 declarator = declarator->declarator; | 6476 declarator = declarator->declarator; |
8617 #ifndef noCbC | 8602 #ifndef noCbC |
8618 #define CbC_STACK_SIZE (1024 * 8) | 8603 #define CbC_STACK_SIZE (1024 * 8) |
8619 static void cbc_set_codesegment(tree fndecl){ | 8604 static void cbc_set_codesegment(tree fndecl){ |
8620 tree args; | 8605 tree args; |
8621 tree *nextp; | 8606 tree *nextp; |
8622 // tree itype; | |
8623 // tree icst; | |
8624 // tree padding_array; | |
8625 // tree list; | |
8626 int padding_size = CbC_STACK_SIZE; | 8607 int padding_size = CbC_STACK_SIZE; |
8627 | |
8628 //CbC_IS_CODE_SEGMENT(TREE_TYPE(fndecl)) = 1; | |
8629 //CbC_IS_CODE_SEGMENT(fndecl) = 1; | |
8630 | 8608 |
8631 nextp = & TYPE_ARG_TYPES (TREE_TYPE (fndecl)); | 8609 nextp = & TYPE_ARG_TYPES (TREE_TYPE (fndecl)); |
8632 for (args = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); args; | 8610 for (args = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); args; |
8633 args = TREE_CHAIN (args)) | 8611 args = TREE_CHAIN (args)) |
8634 { | 8612 { |
8713 cbc_return_f = NULL_TREE; | 8691 cbc_return_f = NULL_TREE; |
8714 cbc_env = NULL_TREE; | 8692 cbc_env = NULL_TREE; |
8715 if ( declspecs->typespec_word == cts_CbC_code ) | 8693 if ( declspecs->typespec_word == cts_CbC_code ) |
8716 { | 8694 { |
8717 cbc_set_codesegment(decl1); | 8695 cbc_set_codesegment(decl1); |
8718 //CbC_IS_CODE_SEGMENT(TREE_TYPE(decl1)) = 1; | |
8719 | |
8720 | |
8721 /* implementation of rectype */ | |
8722 tree func_tree = TREE_TYPE(decl1); | |
8723 // parm is PARM_DECL | |
8724 tree parm = declarator->u.arg_info->parms; | |
8725 while (parm) { | |
8726 tree tmptype = parm; | |
8727 if (!IS_RECTYPE(TREE_TYPE(tmptype))) { | |
8728 parm = TREE_CHAIN(parm); | |
8729 continue; | |
8730 } | |
8731 tree t = TREE_TYPE(tmptype); | |
8732 while (TREE_CODE(t) == POINTER_TYPE) { | |
8733 tmptype = t; | |
8734 t= TREE_TYPE(tmptype); | |
8735 } | |
8736 TREE_TYPE(tmptype) = func_tree; | |
8737 parm = TREE_CHAIN(parm); | |
8738 } | |
8739 | |
8740 } | 8696 } |
8741 | 8697 |
8742 #endif | 8698 #endif |
8743 | 8699 |
8744 invoke_plugin_callbacks (PLUGIN_START_PARSE_FUNCTION, decl1); | 8700 invoke_plugin_callbacks (PLUGIN_START_PARSE_FUNCTION, decl1); |
10082 error_at (loc, | 10038 error_at (loc, |
10083 ("both %<long%> and %<void%> in " | 10039 ("both %<long%> and %<void%> in " |
10084 "declaration specifiers")); | 10040 "declaration specifiers")); |
10085 #ifndef noCbC | 10041 #ifndef noCbC |
10086 else if (specs->typespec_word == cts_CbC_code) | 10042 else if (specs->typespec_word == cts_CbC_code) |
10087 error_at (loc, | |
10088 ("both %<long%> and %<void%> in " | |
10089 "declaration specifiers")); | |
10090 else if (specs->typespec_word == cts_CbC_rec) | |
10091 error_at (loc, | 10043 error_at (loc, |
10092 ("both %<long%> and %<void%> in " | 10044 ("both %<long%> and %<void%> in " |
10093 "declaration specifiers")); | 10045 "declaration specifiers")); |
10094 #endif | 10046 #endif |
10095 else if (specs->typespec_word == cts_int_n) | 10047 else if (specs->typespec_word == cts_int_n) |
10149 error_at (loc, | 10101 error_at (loc, |
10150 ("both %<short%> and %<void%> in " | 10102 ("both %<short%> and %<void%> in " |
10151 "declaration specifiers")); | 10103 "declaration specifiers")); |
10152 #ifndef noCbC | 10104 #ifndef noCbC |
10153 else if (specs->typespec_word == cts_CbC_code) | 10105 else if (specs->typespec_word == cts_CbC_code) |
10154 error_at (loc, | |
10155 ("both %<short%> and %<void%> in " | |
10156 "declaration specifiers")); | |
10157 else if (specs->typespec_word == cts_CbC_rec) | |
10158 error_at (loc, | 10106 error_at (loc, |
10159 ("both %<short%> and %<void%> in " | 10107 ("both %<short%> and %<void%> in " |
10160 "declaration specifiers")); | 10108 "declaration specifiers")); |
10161 #endif | 10109 #endif |
10162 else if (specs->typespec_word == cts_int_n) | 10110 else if (specs->typespec_word == cts_int_n) |
10223 #ifndef noCbC | 10171 #ifndef noCbC |
10224 else if (specs->typespec_word == cts_CbC_code) | 10172 else if (specs->typespec_word == cts_CbC_code) |
10225 error_at (loc, | 10173 error_at (loc, |
10226 ("both %<signed%> and %<void%> in " | 10174 ("both %<signed%> and %<void%> in " |
10227 "declaration specifiers")); | 10175 "declaration specifiers")); |
10228 else if (specs->typespec_word == cts_CbC_rec) | |
10229 error_at (loc, | |
10230 ("both %<signed%> and %<void%> in " | |
10231 "declaration specifiers")); | |
10232 #endif | 10176 #endif |
10233 else if (specs->typespec_word == cts_bool) | 10177 else if (specs->typespec_word == cts_bool) |
10234 error_at (loc, | 10178 error_at (loc, |
10235 ("both %<signed%> and %<_Bool%> in " | 10179 ("both %<signed%> and %<_Bool%> in " |
10236 "declaration specifiers")); | 10180 "declaration specifiers")); |
10285 #ifndef noCbC | 10229 #ifndef noCbC |
10286 else if (specs->typespec_word == cts_CbC_code) | 10230 else if (specs->typespec_word == cts_CbC_code) |
10287 error_at (loc, | 10231 error_at (loc, |
10288 ("both %<unsigned%> and %<void%> in " | 10232 ("both %<unsigned%> and %<void%> in " |
10289 "declaration specifiers")); | 10233 "declaration specifiers")); |
10290 else if (specs->typespec_word == cts_CbC_rec) | |
10291 error_at (loc, | |
10292 ("both %<unsigned%> and %<void%> in " | |
10293 "declaration specifiers")); | |
10294 #endif | 10234 #endif |
10295 else if (specs->typespec_word == cts_bool) | 10235 else if (specs->typespec_word == cts_bool) |
10296 error_at (loc, | 10236 error_at (loc, |
10297 ("both %<unsigned%> and %<_Bool%> in " | 10237 ("both %<unsigned%> and %<_Bool%> in " |
10298 "declaration specifiers")); | 10238 "declaration specifiers")); |
10343 error_at (loc, | 10283 error_at (loc, |
10344 ("both %<complex%> and %<void%> in " | 10284 ("both %<complex%> and %<void%> in " |
10345 "declaration specifiers")); | 10285 "declaration specifiers")); |
10346 #ifndef noCbC | 10286 #ifndef noCbC |
10347 else if (specs->typespec_word == cts_CbC_code) | 10287 else if (specs->typespec_word == cts_CbC_code) |
10348 error_at (loc, | |
10349 ("both %<complex%> and %<void%> in " | |
10350 "declaration specifiers")); | |
10351 else if (specs->typespec_word == cts_CbC_rec) | |
10352 error_at (loc, | 10288 error_at (loc, |
10353 ("both %<complex%> and %<void%> in " | 10289 ("both %<complex%> and %<void%> in " |
10354 "declaration specifiers")); | 10290 "declaration specifiers")); |
10355 #endif | 10291 #endif |
10356 | 10292 |
10602 error_at (loc, | 10538 error_at (loc, |
10603 ("both %<complex%> and %<_Bool%> in " | 10539 ("both %<complex%> and %<_Bool%> in " |
10604 "declaration specifiers")); | 10540 "declaration specifiers")); |
10605 else | 10541 else |
10606 specs->typespec_word = cts_CbC_code; | 10542 specs->typespec_word = cts_CbC_code; |
10607 return specs; | |
10608 case RID_CbC_REC: | |
10609 if (specs->long_p) | |
10610 error_at (loc, | |
10611 ("both %<long%> and %<_Bool%> in " | |
10612 "declaration specifiers")); | |
10613 else if (specs->short_p) | |
10614 error_at (loc, | |
10615 ("both %<short%> and %<_Bool%> in " | |
10616 "declaration specifiers")); | |
10617 else if (specs->signed_p) | |
10618 error_at (loc, | |
10619 ("both %<signed%> and %<_Bool%> in " | |
10620 "declaration specifiers")); | |
10621 else if (specs->unsigned_p) | |
10622 error_at (loc, | |
10623 ("both %<unsigned%> and %<_Bool%> in " | |
10624 "declaration specifiers")); | |
10625 else if (specs->complex_p) | |
10626 error_at (loc, | |
10627 ("both %<complex%> and %<_Bool%> in " | |
10628 "declaration specifiers")); | |
10629 else | |
10630 specs->typespec_word = cts_CbC_rec; | |
10631 return specs; | 10543 return specs; |
10632 #endif | 10544 #endif |
10633 case RID_BOOL: | 10545 case RID_BOOL: |
10634 if (!in_system_header_at (loc)) | 10546 if (!in_system_header_at (loc)) |
10635 pedwarn_c90 (loc, OPT_Wpedantic, | 10547 pedwarn_c90 (loc, OPT_Wpedantic, |
11202 /* Type to be filled in later. */ | 11114 /* Type to be filled in later. */ |
11203 break; | 11115 break; |
11204 case cts_void: | 11116 case cts_void: |
11205 #ifndef noCbC | 11117 #ifndef noCbC |
11206 case cts_CbC_code: | 11118 case cts_CbC_code: |
11207 case cts_CbC_rec: | |
11208 #endif | 11119 #endif |
11209 gcc_assert (!specs->long_p && !specs->short_p | 11120 gcc_assert (!specs->long_p && !specs->short_p |
11210 && !specs->signed_p && !specs->unsigned_p | 11121 && !specs->signed_p && !specs->unsigned_p |
11211 && !specs->complex_p); | 11122 && !specs->complex_p); |
11212 specs->type = void_type_node; | 11123 specs->type = void_type_node; |