--- zzzz-none-000/linux-4.9.218/include/linux/compiler-gcc.h 2020-04-02 15:20:41.000000000 +0000 +++ seale-7590ac-750/linux-4.9.218/include/linux/compiler-gcc.h 2022-11-30 09:46:20.000000000 +0000 @@ -351,3 +351,43 @@ #if GCC_VERSION >= 50100 #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 #endif + +/* + * Turn individual warnings and errors on and off locally, depending + * on version. + */ +#define __diag_GCC(version, severity, s) \ + __diag_GCC_##version(__diag_GCC_##severity s) + +/* Severity used in pragma directives */ +#define __diag_GCC_ignore ignored +#define __diag_GCC_warn warning +#define __diag_GCC_error error + +/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */ +#if GCC_VERSION >= 40600 +#define __diag_str1(s) #s +#define __diag_str(s) __diag_str1(s) +#define __diag(s) _Pragma(__diag_str(GCC diagnostic s)) +#endif + +#if GCC_VERSION >= 80000 +#define __diag_GCC_8(s) __diag(s) +#else +#define __diag_GCC_8(s) +#endif + +#if GCC_VERSION >= 80000 +/* + * The nonstring variable attribute specifies that an object or member + * declaration with type array of char, signed char, or unsigned char, + * or pointer to such a type is intended to store character arrays that + * do not necessarily contain a terminating NUL. This is useful in detecting + * uses of such arrays or pointers with functions that expect NUL-terminated + * strings, and to avoid warnings when such an array or pointer is used as + * an argument to a bounded string manipulation function such as strncpy. + * + * https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html + */ +#define __nonstring __attribute__((nonstring)) +#endif