ValueType: only use default signedness for char/short/int/long/longlong

This commit is contained in:
Daniel Marjamäki 2016-01-01 20:03:31 +01:00
parent b457ceef0e
commit 416861b530
1 changed files with 8 additions and 1 deletions

View File

@ -3791,7 +3791,7 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
const unsigned int pointer0 = valuetype->pointer;
while (Token::Match(type->previous(), "%name%"))
type = type->previous();
valuetype->sign = defaultSignedness;
valuetype->sign = ValueType::Sign::UNKNOWN_SIGN;
valuetype->type = ValueType::Type::UNKNOWN_TYPE;
while (Token::Match(type, "%name%|*|&") && !type->variable()) {
if (type->isSigned())
@ -3824,6 +3824,13 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
valuetype->originalTypeName = type->originalName();
type = type->next();
}
// If no signedness is given for char/short/int/long/longlong type, use default signedness
if (valuetype->type >= ValueType::Type::CHAR &&
valuetype->type <= ValueType::Type::LONGLONG &&
valuetype->sign == ValueType::Sign::UNKNOWN_SIGN)
valuetype->sign = defaultSignedness;
return (type && valuetype->type != ValueType::Type::UNKNOWN_TYPE) ? type : nullptr;
}