@@ -821,7 +821,9 @@ void CGenerator::makeAliasesTemplateData()
821821 break ;
822822 }
823823 default :
824+ {
824825 throw internal_error (" Only structs or enums are allowed as unnamed types." );
826+ }
825827 }
826828 }
827829 aliases.push_back (aliasInfo);
@@ -2268,8 +2270,11 @@ string CGenerator::getTypenameName(DataType *t, const string &name)
22682270 break ;
22692271 }
22702272 default :
2273+ {
22712274 throw internal_error (format_string (" In getTypenameName: unknown data type: %s value:%d" ,
22722275 t->getName ().c_str (), t->getDataType ()));
2276+ break ;
2277+ }
22732278 }
22742279 return returnName;
22752280}
@@ -2279,35 +2284,65 @@ string CGenerator::getBuiltinTypename(const BuiltinType *t)
22792284 switch (t->getBuiltinType ())
22802285 {
22812286 case BuiltinType::builtin_type_t ::kBoolType :
2287+ {
22822288 return " bool" ;
2289+ }
22832290 case BuiltinType::builtin_type_t ::kInt8Type :
2291+ {
22842292 return " int8_t" ;
2293+ }
22852294 case BuiltinType::builtin_type_t ::kInt16Type :
2295+ {
22862296 return " int16_t" ;
2297+ }
22872298 case BuiltinType::builtin_type_t ::kInt32Type :
2299+ {
22882300 return " int32_t" ;
2301+ }
22892302 case BuiltinType::builtin_type_t ::kInt64Type :
2303+ {
22902304 return " int64_t" ;
2305+ }
22912306 case BuiltinType::builtin_type_t ::kUInt8Type :
2307+ {
22922308 return " uint8_t" ;
2309+ }
22932310 case BuiltinType::builtin_type_t ::kUInt16Type :
2311+ {
22942312 return " uint16_t" ;
2313+ }
22952314 case BuiltinType::builtin_type_t ::kUInt32Type :
2315+ {
22962316 return " uint32_t" ;
2317+ }
22972318 case BuiltinType::builtin_type_t ::kUInt64Type :
2319+ {
22982320 return " uint64_t" ;
2321+ }
22992322 case BuiltinType::builtin_type_t ::kFloatType :
2323+ {
23002324 return " float" ;
2325+ }
23012326 case BuiltinType::builtin_type_t ::kDoubleType :
2327+ {
23022328 return " double" ;
2329+ }
23032330 case BuiltinType::builtin_type_t ::kStringType :
2331+ {
23042332 return " char *" ;
2333+ }
23052334 case BuiltinType::builtin_type_t ::kUStringType :
2335+ {
23062336 return " unsigned char*" ;
2337+ }
23072338 case BuiltinType::builtin_type_t ::kBinaryType :
2339+ {
23082340 return " uint8_t *" ;
2341+ }
23092342 default :
2343+ {
23102344 throw internal_error (" unknown builtin type" );
2345+ }
23112346 }
23122347}
23132348
@@ -3039,7 +3074,9 @@ bool CGenerator::isNeedCallFree(DataType *dataType)
30393074 return false ;
30403075 }
30413076 default :
3077+ {
30423078 return false ;
3079+ }
30433080 }
30443081}
30453082
@@ -3422,15 +3459,25 @@ string CGenerator::getDirection(param_direction_t direction)
34223459 switch (direction)
34233460 {
34243461 case param_direction_t ::kInDirection :
3462+ {
34253463 return " kInDirection" ;
3464+ }
34263465 case param_direction_t ::kOutDirection :
3466+ {
34273467 return " kOutDirection" ;
3468+ }
34283469 case param_direction_t ::kInoutDirection :
3470+ {
34293471 return " kInoutDirection" ;
3472+ }
34303473 case param_direction_t ::kReturn :
3474+ {
34313475 return " kReturn" ;
3476+ }
34323477 default :
3478+ {
34333479 throw semantic_error (" Unsupported direction type" );
3480+ }
34343481 }
34353482}
34363483
0 commit comments