summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@sun.com>2010-05-26 16:12:23 +0200
committerTor Didriksen <tor.didriksen@sun.com>2010-05-26 16:12:23 +0200
commitd8536dfbddbf98df10081bdbf83b2c06cf9d01c1 (patch)
treee02f9ec4f4f64535006e2aeecf1ec1497146b50c /include
parent33e9d05c086a54ec0cd3860acdc01585e0d4fda6 (diff)
downloadmariadb-git-d8536dfbddbf98df10081bdbf83b2c06cf9d01c1.tar.gz
Bug #53445 Build with -Wall and fix warnings that it generates
Add -Wall to gcc/g++ Fix most warnings reported in dbg and opt mode.
Diffstat (limited to 'include')
-rw-r--r--include/my_global.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 094853cb642..2a65c610604 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1070,6 +1070,17 @@ typedef long long my_ptrdiff_t;
#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))]
+#ifdef __cplusplus
+template <size_t sz> struct Aligned_char_array
+{
+ union {
+ void *v; // Ensures alignment.
+ char arr[sz]; // The actual buffer.
+ } u;
+ void* arr() { return &u.arr[0]; }
+};
+#endif /* __cplusplus */
+
/*
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