diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-14 09:27:13 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-14 09:27:13 -0300 |
commit | 21f63caf8ecef619318edf0d4344f722cfadc7f3 (patch) | |
tree | 666695a495d717b7ff2f8bcb13c61829e7bc393b /include/my_global.h | |
parent | dbef812ab935452e7d308f95156b7f0323cc2a7f (diff) | |
download | mariadb-git-21f63caf8ecef619318edf0d4344f722cfadc7f3.tar.gz |
Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.
Another rather noisy violation of strict aliasing rules
is the spatial code which makes use of stack-based memory
(of type Geometry_buffer) to provide placement for Geometry
objects. Although a placement new is allowed to dynamically
change the type of a object, the object returned by the
new placement was being ignored and the original stack-based
object was being casted to the new type, thus violating strict
aliasing rules.
The solution is to reorganize the code so that the object
returned by the new placement is used instead of casting the
original object. Also, to ensure that the stack-based object
is properly aligned with respect to the objects it provides
placement for, a set of compiler-dependent macros and types
are introduced so that the alignment of objects can be inquired
and specified.
Diffstat (limited to 'include/my_global.h')
-rw-r--r-- | include/my_global.h | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/include/my_global.h b/include/my_global.h index f03ed665d5a..6723267ae50 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -941,9 +941,6 @@ typedef long long my_ptrdiff_t; #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) -#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B)) -#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))] - /* Custom version of standard offsetof() macro which can be used to get offsets of members in class for non-POD types (according to the current |