Skip to content

Commit

Permalink
Add support for i64 and ui64 literal suffixes on Windows
Browse files Browse the repository at this point in the history
Used by MSVC's stdint.h, etc.
  • Loading branch information
sgraham committed Oct 28, 2023
1 parent 2269e4b commit 442affc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/tokenize.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ static bool convert_pp_int(Token* tok) {
startswith(p, "uLL") || startswith(p, "ull")) {
p += 3;
l = u = true;
#if X64WIN
} else if (startswith(p, "i64")) {
p += 3;
l = true;
} else if (startswith(p, "ui64")) {
p += 4;
l = u = true;
#endif
} else if (!strncasecmp(p, "lu", 2) || !strncasecmp(p, "ul", 2)) {
p += 2;
l = u = true;
Expand Down
6 changes: 6 additions & 0 deletions test/literal.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ int main() {
ASSERT(8, sizeof(0LL));
ASSERT(8, sizeof(0LLU));
ASSERT(8, sizeof(0Ull));
#ifdef _WIN64
ASSERT(8, sizeof(0ui64));
ASSERT(8, sizeof(0i64));
ASSERT(8, sizeof(1ui64));
ASSERT(8, sizeof(1i64));
#endif
ASSERT(8, sizeof(0l));
ASSERT(8, sizeof(0ll));
ASSERT(8, sizeof(0x0L));
Expand Down

0 comments on commit 442affc

Please sign in to comment.