• Davi Arnaut's avatar
    Bug#42733: Type-punning warnings when compiling MySQL -- · 53b88296
    Davi Arnaut authored
                strict aliasing violations.
    
    One somewhat major source of strict-aliasing violations and
    related warnings is the SQL_LIST structure. For example,
    consider its member function `link_in_list` which takes
    a pointer to pointer of type T (any type) as a pointer to
    pointer to unsigned char. Dereferencing this pointer, which
    is done to reset the next field, violates strict-aliasing
    rules and might cause problems for surrounding code that
    uses the next field of the object being added to the list.
    
    The solution is to use templates to parametrize the SQL_LIST
    structure in order to deference the pointers with compatible
    types. As a side bonus, it becomes possible to remove quite
    a few casts related to acessing data members of SQL_LIST.
    53b88296
sql_lex.h 58.7 KB