Omit all non-standard stuff from <ctype.h> if __KeepNamespacePure__ is defined.

This affects the toint function and the _tolower and _toupper macros. Several other non-standard functions and macros were already being omitted.
This commit is contained in:
Stephen Heumann 2021-08-22 15:29:12 -05:00
parent bb51e77193
commit e4515e580a
2 changed files with 6 additions and 4 deletions

View File

@ -81,11 +81,13 @@ int isblank(int);
#define isblank(c) ((__ctype2)[(c)+1] & __blank)
#ifndef __KeepNamespacePure__
#define toascii(c) ((c) & 0x7F)
int toint(char);
#endif
int toint(char);
int tolower(int);
int toupper(int);
#define _tolower(c) ((c) | 0x20)
#define _toupper(c) ((c) & 0x5F)
#ifndef __KeepNamespacePure__
#define _tolower(c) ((c) | 0x20)
#define _toupper(c) ((c) & 0x5F)
#endif
#endif

View File

@ -1172,7 +1172,7 @@ int foo(int[42]);
146. In initializers for static data, expressions where an integer with unsigned type was added to an array address (e.g. "a + 1U") would not be accepted.
147. The <string.h> header includes several non-standard functions. Their declarations should be omitted if __KeepNamespacePure__ is defined.
147. The <string.h> and <ctype.h> headers include several non-standard functions and macros. Their declarations and definitions should be omitted if __KeepNamespacePure__ is defined.
148. When an expression that the intermediate code peephole optimizer could reduce to a constant was cast to a character type, the resulting value could be outside the range of that type.