diff --git a/intrinsiccv/CMakeLists.txt b/intrinsiccv/CMakeLists.txt index c341df95d9e4fa5f18739651c21c6980d6048895..1bd532bf98e416a8cf185d030ab3c46953cbe75e 100644 --- a/intrinsiccv/CMakeLists.txt +++ b/intrinsiccv/CMakeLists.txt @@ -76,6 +76,11 @@ set(INTRINSICCV_WARNING_FLAGS "-Wold-style-cast" ) +set(INTRINSICCV_SDL_FLAGS + "-include" + "unsafe.h" +) + set(INTRINSICCV_CLANG_FLAGS "-mllvm" "-inline-threshold=10000" @@ -91,6 +96,7 @@ set(INTRINSICCV_CXX_FLAGS "-fno-rtti" ${INTRINSICCV_CLANG_FLAGS} ${INTRINSICCV_WARNING_FLAGS} + ${INTRINSICCV_SDL_FLAGS} ) if(INTRINSICCV_ENABLE_SVE2) diff --git a/intrinsiccv/include/unsafe.h b/intrinsiccv/include/unsafe.h new file mode 100644 index 0000000000000000000000000000000000000000..a6037ad5440236905d3df3faee5c7a6f62b7acab --- /dev/null +++ b/intrinsiccv/include/unsafe.h @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: 2024 Arm Limited and/or its affiliates +// +// SPDX-License-Identifier: Apache-2.0 + +#ifndef INTRINSICCV_INCLUDE_UNSAFE_H_ +#define INTRINSICCV_INCLUDE_UNSAFE_H_ + +// Inclusion of standard library headers. +#ifdef __cplusplus +#include +#include +#include +#include +#include +#else // __cplusplus +#include +#include +#include +#include +#include +#endif // __cplusplus + +// ----------------------------------------------------------------------------- +// Conform to SEI CERT* C Coding Standard MSC24-C: Do not use deprecated or +// obsolescent functions +// * CERT is registered in the U.S. Patent and Trademark Office by Carnegie +// Mellon University. +// ----------------------------------------------------------------------------- + +#ifdef __GNUC__ + +// +#pragma GCC poison gets rewind setbuf +#pragma GCC poison fopen freopen +#pragma GCC poison printf fprintf sprintf snprintf +#pragma GCC poison vprintf vfprintf vsprintf vsnprintf +#pragma GCC poison scanf fscanf sscanf +#pragma GCC poison vscanf vfscanf vsscanf + +// +#pragma GCC poison atof atoi atol atoll +#pragma GCC poison bsearch getenv mbstowcs qsort + +// +// NOTE: memcpy and memmove are still useful. Their *_s alternatives would not +// make a difference in practice in this lib. +#pragma GCC poison strcat strncat +#pragma GCC poison strcpy strncpy +#pragma GCC poison strlen strtok strerror + +// +#pragma GCC poison asctime ctime gmtime localtime + +// +#pragma GCC poison mbsrtowcs +#pragma GCC poison wmemcpy wmemmove +#pragma GCC poison wprintf fwprintf swprintf +#pragma GCC poison vwprintf vfwprintf vswprintf +#pragma GCC poison fwscanf wscanf swscanf +#pragma GCC poison vfwscanf vwscanf vswscanf +#pragma GCC poison wcscat wcscpy wcslen wcstok wctomb wcrtomb wcstombs +#pragma GCC poison wcsncat wcsncpy wcsrtombs + +#endif // __GNUC__ + +#endif // INTRINSICCV_INCLUDE_UNSAFE_H_