mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-29 06:10:09 +08:00
Fix unicode compiler warning
The compiler warned about the unicode_to_utf8 code. I fixed it by giving an error. This is the same as gcc does.
This commit is contained in:
parent
e7396c99b0
commit
19cc80788d
1
tccpp.c
1
tccpp.c
@ -352,6 +352,7 @@ ST_INLN char *unicode_to_utf8 (char *b, uint32_t Uc)
|
||||
else if (Uc-0xd800u<0x800) return b;
|
||||
else if (Uc<0x10000) *b++=224+Uc/4096, *b++=128+Uc/64%64, *b++=128+Uc%64;
|
||||
else if (Uc<0x110000) *b++=240+Uc/262144, *b++=128+Uc/4096%64, *b++=128+Uc/64%64, *b++=128+Uc%64;
|
||||
else tcc_error("0x%x is not a valid universal character", Uc);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
@ -442,4 +442,10 @@ int f() { ({ return 78; }); }
|
||||
int main() { return f(); }
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
#elif defined test_illegal_unicode
|
||||
int main() {
|
||||
char *str = "\Uffffffff";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -216,3 +216,6 @@ arg[1] = "Y"
|
||||
|
||||
[test_return_from_statement_expr]
|
||||
[returns 78]
|
||||
|
||||
[test_illegal_unicode]
|
||||
60_errors_and_warnings.c:448: error: 0xffffffff is not a valid universal character
|
||||
|
Loading…
Reference in New Issue
Block a user