summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.cc
diff options
context:
space:
mode:
authorunknown <dlenev@mockturtle.local>2006-10-20 15:47:52 +0400
committerunknown <dlenev@mockturtle.local>2006-10-20 15:47:52 +0400
commit1a793de9e40179845b98454e9f1333464ef54e62 (patch)
tree5b84be9c2183df8cb61c0f7962b707022e594820 /sql/sql_trigger.cc
parent00fca9ea6d433dd9cd08e038bbf4bbe9527181eb (diff)
downloadmariadb-git-1a793de9e40179845b98454e9f1333464ef54e62.tar.gz
Fix for bug#15228 "'invalid access to non-static data member'
warnings in sql_trigger.cc and sql_view.cc". According to the current version of C++ standard offsetof() macro can't be used for non-POD types. So warnings were emitted when we tried to use this macro for TABLE_LIST and Table_triggers_list classes. Note that despite of these warnings it was probably safe thing to do. This fix tries to circumvent this limitation by implementing custom version of offsetof() macro to be used with these classes. This hack should go away once we will refactor File_parser class. Alternative approaches such as disabling this warning for sql_trigger.cc/sql_view.cc or for the whole server were considered less explicit. Also I was unable to find a way to disable particular warning for particular _part_ of file in GCC. sql/parse_file.h: Introduced auxillary macro which can be used instead of offsetof() to get offsets of members in class for non-POD types without getting warnings (assuming that all instances of the class has same offsets for same members). sql/sql_trigger.cc: Use my_offsetof() macro instead of standard offsetof() macro with Table_triggers_list class in order to avoid warnings (offsetof() cannot be used for non-POD types according to the standard). sql/sql_view.cc: Use my_offsetof() macro instead of standard offsetof() macro with TABLE_LIST class in order to avoid warnings (offsetof() cannot be used for non-POD types according to the standard).
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r--sql/sql_trigger.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 6bb50d602c3..c6d85934820 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -36,17 +36,17 @@ static File_option triggers_file_parameters[]=
{
{
{(char *) STRING_WITH_LEN("triggers") },
- offsetof(class Table_triggers_list, definitions_list),
+ my_offsetof(class Table_triggers_list, definitions_list),
FILE_OPTIONS_STRLIST
},
{
{(char *) STRING_WITH_LEN("sql_modes") },
- offsetof(class Table_triggers_list, definition_modes_list),
+ my_offsetof(class Table_triggers_list, definition_modes_list),
FILE_OPTIONS_ULLLIST
},
{
{(char *) STRING_WITH_LEN("definers") },
- offsetof(class Table_triggers_list, definers_list),
+ my_offsetof(class Table_triggers_list, definers_list),
FILE_OPTIONS_STRLIST
},
{ { 0, 0 }, 0, FILE_OPTIONS_STRING }
@@ -55,7 +55,7 @@ static File_option triggers_file_parameters[]=
File_option sql_modes_parameters=
{
{(char*) STRING_WITH_LEN("sql_modes") },
- offsetof(class Table_triggers_list, definition_modes_list),
+ my_offsetof(class Table_triggers_list, definition_modes_list),
FILE_OPTIONS_ULLLIST
};