Fix MariadDB to compile with gcc 7.5.0

gcc 7.5.0 does not understand __attribute__((no_sanitize("undefined"))
I moved the usage of this attribute from sql/set_var.h to
include/my_attribute.h and created a macro for it depending on
compiler used.
This commit is contained in:
Monty 2024-12-04 12:58:00 +02:00
parent 818c84ad45
commit 8e9aa9c6b0
2 changed files with 10 additions and 3 deletions

View file

@ -70,5 +70,11 @@
# endif /* GNUC >= 3.1 */
#endif
/* gcc 7.5.0 does not support __attribute__((no_sanitize("undefined")) */
#if defined(__clang__)
#define __attribute_no_sanitize__ __attribute__((no_sanitize("undefined")))
#else
#define __attribute_no_sanitize__
#endif
#endif /* _my_attribute_h */

View file

@ -26,6 +26,7 @@
#endif
#include <my_getopt.h>
#include <my_attribute.h>
class sys_var;
class set_var;
@ -247,11 +248,11 @@ protected:
Typically it's the same as session_value_ptr(), but it's different,
for example, for ENUM, that is printed as a string, but stored as a number.
*/
__attribute__((no_sanitize("undefined")))
__attribute_no_sanitize__
uchar *session_var_ptr(THD *thd) const
{ return ((uchar*)&(thd->variables)) + offset; }
__attribute__((no_sanitize("undefined")))
__attribute_no_sanitize__
uchar *global_var_ptr() const
{ return ((uchar*)&global_system_variables) + offset; }