]> git.lttng.org Git - lttng-ust.git/commitdiff
Fix: Check C++ designated initializers support before compiling 'hello.cxx' test
authorZifei Tong <soariez@gmail.com>
Tue, 18 Jun 2013 13:48:21 +0000 (09:48 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 18 Jun 2013 13:48:21 +0000 (09:48 -0400)
Tested on a Ububtu system with g++ 4.6, g++ 4.7 and clang++.

Fixes #557

Signed-off-by: Zifei Tong <soariez@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
README
configure.ac

diff --git a/README b/README
index 1f6b9d2ca66e859b0ec8a63a47cd295c177563c3..a2ff00bc9d045e45d2651d844c3635f1a481c7b3 100644 (file)
--- a/README
+++ b/README
@@ -111,7 +111,8 @@ USAGE:
   - Enable instrumentation and control tracing with the "lttng" command
     from lttng-tools. See lttng-tools doc/quickstart.txt.
   - Note for C++ support: since LTTng-UST 2.3, both tracepoints and
-    tracepoint probes can be compiled with g++.
+    tracepoint probes can be compiled in C++. To compile tracepoint probes
+    in C++, you need g++ >= 4.7 or Clang.
 
 
 ENVIRONMENT VARIABLES:
index 802ccaa5ffe49566740e0e39fdcf46674924f12b..716f22d6527c2afee7778737cea6913575fad61f 100644 (file)
@@ -83,8 +83,21 @@ AC_CACHE_CHECK([whether the C++ compiler works],
                [rw_cv_prog_cxx_works],
                [AC_LANG_PUSH([C++])
                AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
-                               [rw_cv_prog_cxx_works=yes],
+                               [check_cxx_designated_initializers=yes],
                                [rw_cv_prog_cxx_works=no])
+               if test "$check_cxx_designated_initializers" = "yes"; then
+                       AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+                               struct foo { int a; int b; };
+                               void fct(void)
+                               {
+                                       struct foo f = { .a = 0, .b = 1 };
+                               }
+                       ]])],[
+                               rw_cv_prog_cxx_works=yes
+                       ],[
+                               rw_cv_prog_cxx_works=no
+                       ])
+               fi
                AC_LANG_POP([C++])])
 
 AM_CONDITIONAL([CXX_WORKS], [test "x$rw_cv_prog_cxx_works" = "xyes"])
This page took 0.029661 seconds and 4 git commands to generate.