]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
assert: choose function-var name on non-gnu 831/head
authorNoah Watkins <noahwatkins@gmail.com>
Sun, 21 Jul 2013 01:41:38 +0000 (18:41 -0700)
committerNoah Watkins <noahwatkins@gmail.com>
Wed, 6 Nov 2013 22:16:28 +0000 (14:16 -0800)
commitac044812d0b25964fbf81eb04b1291ae484d1a34
treed3d4ef8fff46a5b50c977253ddff541660a14d2f
parentf5514654e0ef3652cb435a96148ffbb51116840b
assert: choose function-var name on non-gnu

Selects __PRETTY_FUNCTION__ or __func__. Linux assumes GNU, and chooses
__PRETTY_FUNCTION__ if gcc/g++ versions are favorable.

This also includes a fix in ax_c_var_func.m4:

AC_TRY_COMPILE will wrap the test in main{}, and then GCC will complain
about nested functions. Just use the original main{} body.

diff --git a/m4/ax_c_var_func.m4 b/m4/ax_c_var_func.m4
index 0ad7d2b..8b57563 100644
--- a/m4/ax_c_var_func.m4
+++ b/m4/ax_c_var_func.m4
@@ -57,9 +57,9 @@ AC_DEFUN([AX_C_VAR_FUNC],
 [AC_REQUIRE([AC_PROG_CC])
 AC_CACHE_CHECK(whether $CC recognizes __func__, ac_cv_c_var_func,
 AC_TRY_COMPILE(,
-[int main() {
+[
 char *s = __func__;
-}],
+],
 AC_DEFINE(HAVE_FUNC,,
 [Define if the C complier supports __func__]) ac_cv_c_var_func=yes,
 ac_cv_c_var_func=no) )

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
configure.ac
m4/ax_c_pretty_func.m4 [new file with mode: 0644]
m4/ax_c_var_func.m4 [new file with mode: 0644]
src/include/assert.h