aboutsummaryrefslogtreecommitdiff
path: root/mysql/libmysql/assert.c
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-11-02 23:11:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-11-21 13:51:37 +0300
commitb1471ebbe9db90c472ff356bea6a7c8aedb45db9 (patch)
treea3494b3c2ca9a3529588c4da6e52d9040722a404 /mysql/libmysql/assert.c
parent4bce3c574df293415c7b2f45b9c2951262fe3412 (diff)
Add implementation
Diffstat (limited to 'mysql/libmysql/assert.c')
-rw-r--r--mysql/libmysql/assert.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql/libmysql/assert.c b/mysql/libmysql/assert.c
new file mode 100644
index 0000000..e11db5b
--- /dev/null
+++ b/mysql/libmysql/assert.c
@@ -0,0 +1,28 @@
+/* file : mysql/libmysql/assert.c -*- C -*-
+ * copyright : Copyright (c) 2016-2017 Code Synthesis Ltd
+ * license : GPLv2 with FOSS License Exception; see accompanying COPYING file
+ */
+
+#include <mysql/my_config.h>
+
+#ifdef _MSC_VER
+# include <windows.h> // C_ASSERT()
+#endif
+
+#include <time.h>
+#include <sys/types.h>
+
+/*
+ * Make sure that some assumptions made at the preprocessing stage are true.
+ */
+
+/*
+ * _Static_assert() is introduced in C11, is supported by GCC and Clang for C99
+ * as well, and is not supported by VC at all.
+ */
+#ifdef _MSC_VER
+# define _Static_assert(C, M) C_ASSERT (C)
+#endif
+
+_Static_assert (sizeof (off_t) == SIZEOF_OFF_T, "unexpected off_t size");
+_Static_assert (sizeof (time_t) == SIZEOF_TIME_T, "unexpected time_t size");