On Sun, 17 Nov 2013, Diego Biurrun wrote:

On Fri, Nov 15, 2013 at 10:12:07PM +0100, Anton Khirnov wrote:

--- a/configure
+++ b/configure
@@ -963,6 +963,16 @@ check_builtin(){

+check_compile_assert(){
+    log check_compile_assert "$@"
+    name=$1
+    headers=$2
+    condition=$3
+    shift 3
+    disable "$name"
+    check_code cc "$headers" "char c[!!($condition) - 1]" "$@" && enable 
"$name"
+}
+
@@ -3393,6 +3404,9 @@ if enabled_all ccc glibc; then

+check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
+    add_cppflags '-I\$(SRC_PATH)/compat/limits'
+

I'm not terribly fond of the name as I don't see any assertion being
invoked, nor do I think this test will be very reusable.

Without commenting on the rest of this, this _IS_ a compile time assert - it's a pretty generic pattern. It doesn't need to invoke any assert by itself, but if the condition isn't true, the compiler will refuse to compile the snippet. See e.g. this: http://stackoverflow.com/questions/807244/c-compiler-asserts-how-to-implement

Whether we'll need this for other things as well or not, I'm not sure.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to