From 7b43483f68701330b388fde33336dd45f746adc9 Mon Sep 17 00:00:00 2001 From: Russell Joyce Date: Thu, 18 Jun 2020 17:20:02 +0100 Subject: [PATCH] Added handling of "short int" type specifier Just consumes and discards the "int" token and treats as if it was only a "short". --- c-tests/types.c | 9 +++++++-- type.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/c-tests/types.c b/c-tests/types.c index eda768f..375bc0f 100644 --- a/c-tests/types.c +++ b/c-tests/types.c @@ -8,8 +8,13 @@ long int e; unsigned long f; unsigned long int g; -volatile int i; -int volatile static j; +short h; +short int i; +unsigned short j; +unsigned short int k; + +volatile int l; +int volatile static m; const int x; long const y; diff --git a/type.c b/type.c index a2af8d2..f2bcfc4 100644 --- a/type.c +++ b/type.c @@ -464,8 +464,8 @@ int TypeParseFront(struct ParseState *Parser, struct ValueType **Typ, Token = LexGetToken(Parser, &LexerValue, true); } - /* handle long with trailing int by consuming and ignoring the int */ - if (Token == TokenLongType) { + /* handle long or short with trailing int by consuming and ignoring the int */ + if (Token == TokenLongType || Token == TokenShortType) { enum LexToken FollowToken = LexGetToken(Parser, NULL, false); if (FollowToken == TokenIntType) { LexGetToken(Parser, NULL, true);