diff options
author | Robert Bragg <robert@linux.intel.com> | 2012-04-16 17:23:15 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-04-18 14:24:01 +0100 |
commit | 465b39a764f2720e77678cafa56acb0e69007ffd (patch) | |
tree | 70acfa5acba12273f12b1c822875d0ac4d55eed0 /configure.ac | |
parent | 5b785dd441a83024333e0a2f2b83d067f891194f (diff) | |
download | cogl-465b39a764f2720e77678cafa56acb0e69007ffd.tar.gz |
Add _COGL_STATIC_ASSERT macro
This adds a _COGL_STATIC_ASSERT macro that can be used for compile time
assertions in C code. If supported by the compiler this macro uses
_Static_assert so that a message can be printed out if the assertion
fails.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 9d3c9917..668bf876 100644 --- a/configure.ac +++ b/configure.ac @@ -925,6 +925,19 @@ AM_PROG_CC_C_O AC_ISC_POSIX AC_C_CONST +dnl ============================================================ +dnl Compiler features +dnl ============================================================ +AC_TRY_COMPILE([], +[ +_Static_assert (1, ""); +int +main (int argc, char **argv) +{ + return 0; +} +], +[AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Whether _Static_assert can be used or not])]) dnl ================================================================ dnl Libtool stuff. |