removed Clang warnings
This commit is contained in:
parent
6fea1cfb25
commit
e2c479de2e
3
error.c
3
error.c
|
@ -143,6 +143,8 @@ static const char *err_msgs[] = {
|
|||
"Invalid type\n",
|
||||
/* IN_FUNCTION_NAME_USED_BY_VARIABLE */
|
||||
"%s:%u: function name already used by existing variable at: %s\n",
|
||||
/* IN_CANNOT_CAST_VALUE_TO_ARRAY */
|
||||
"%s:%u: cannot cast value to array at: %s\n",
|
||||
};
|
||||
|
||||
static const int err_codes[] = {
|
||||
|
@ -224,6 +226,7 @@ static const int err_codes[] = {
|
|||
536, /* IN_INVALID_DECLARATION_TYPE */
|
||||
537, /* IN_INVALID_TYPE */
|
||||
538, /* IN_FUNCTION_NAME_USED_BY_VARIABLE */
|
||||
539, /* IN_CANNOT_CAST_VALUE_TO_ARRAY */
|
||||
};
|
||||
|
||||
int error(ErrorType e, ...)
|
||||
|
|
1
error.h
1
error.h
|
@ -102,6 +102,7 @@ typedef enum {
|
|||
IN_INVALID_DECLARATION_TYPE,
|
||||
IN_INVALID_TYPE,
|
||||
IN_FUNCTION_NAME_USED_BY_VARIABLE,
|
||||
IN_CANNOT_CAST_VALUE_TO_ARRAY,
|
||||
} ErrorType;
|
||||
|
||||
int error(ErrorType, ...);
|
||||
|
|
|
@ -2990,6 +2990,16 @@ ReturnObject *interpretCastStmtNode(StmtNode *node,
|
|||
case CT_STRING:
|
||||
if (!(cast = castStringExplicit(val, scope))) return NULL;
|
||||
break;
|
||||
case CT_ARRAY: {
|
||||
IdentifierNode *id = (IdentifierNode *)(stmt->target);
|
||||
char *name = resolveIdentifierName(id, scope);
|
||||
if (name) {
|
||||
error(IN_CANNOT_CAST_VALUE_TO_ARRAY, id->fname, id->line, name);
|
||||
free(name);
|
||||
}
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!updateScopeValue(scope, scope, stmt->target, cast)) {
|
||||
deleteValueObject(cast);
|
||||
|
|
|
@ -136,6 +136,7 @@ char *copyString(char *);
|
|||
unsigned int isDecString(const char *);
|
||||
unsigned int isHexString(const char *);
|
||||
char *resolveIdentifierName(IdentifierNode *, ScopeObject *);
|
||||
int resolveTerminalSlot(ScopeObject *, ScopeObject *, IdentifierNode *, ScopeObject **, IdentifierNode **);
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue