8214976: Warn about uses of functions replaced for portability

Reviewed-by: dholmes, tschatzl, coleenp
This commit is contained in:
Kim Barrett 2022-06-08 19:16:46 +00:00
parent 024a240e1b
commit 04f02ac6b2
11 changed files with 153 additions and 27 deletions

View file

@ -156,6 +156,19 @@ inline intptr_t p2i(const volatile void* p) {
return (intptr_t) p;
}
//----------------------------------------------------------------------------------------------------
// Forbid the use of various C library functions.
// Some of these have os:: replacements that should normally be used instead.
// Others are considered security concerns, with preferred alternatives.
FORBID_C_FUNCTION(void exit(int), "use os::exit");
FORBID_C_FUNCTION(void _exit(int), "use os::exit");
FORBID_C_FUNCTION(char* strerror(int), "use os::strerror");
FORBID_C_FUNCTION(char* strtok(char*, const char*), "use strtok_r");
FORBID_C_FUNCTION(int vsprintf(char*, const char*, va_list), "use os::vsnprintf");
FORBID_C_FUNCTION(int vsnprintf(char*, size_t, const char*, va_list), "use os::vsnprintf");
//----------------------------------------------------------------------------------------------------
// Constants