[Asterisk-code-review] autoconf: Use m4 conditional in AST GCC ATTRIBUTE. (asterisk[15])

Corey Farrell asteriskteam at digium.com
Mon Nov 27 14:02:12 CST 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7385


Change subject: autoconf: Use m4 conditional in AST_GCC_ATTRIBUTE.
......................................................................

autoconf: Use m4 conditional in AST_GCC_ATTRIBUTE.

Change-Id: Ie70134f5795f38cb6fbd46684971e1fa847bc774
---
M autoconf/ast_gcc_attribute.m4
M configure
2 files changed, 4 insertions(+), 387 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/85/7385/1

diff --git a/autoconf/ast_gcc_attribute.m4 b/autoconf/ast_gcc_attribute.m4
index b1972be..9d5a320 100644
--- a/autoconf/ast_gcc_attribute.m4
+++ b/autoconf/ast_gcc_attribute.m4
@@ -9,28 +9,17 @@
 m4_ifval([$4],$4=0)
 ax_cv_have_func_attribute_$1=0
 
-if test "x$2" = "x"
-then
 AC_COMPILE_IFELSE(
-	[AC_LANG_PROGRAM([$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
-			[])],
+	[AC_LANG_PROGRAM(
+		m4_ifblank([$2],
+			[$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
+			[$3 void __attribute__(($2)) *test(void *muffin, ...) ;]))],
 	AC_MSG_RESULT(yes)
 	m4_ifval([$4],$4=1)
 	ax_cv_have_func_attribute_$1=1
 	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
 	AC_MSG_RESULT(no)
 )
-else
-AC_COMPILE_IFELSE(
-	[AC_LANG_PROGRAM([$3 void __attribute__(($2)) *test(void *muffin, ...) ;],
-			[])],
-	AC_MSG_RESULT(yes)
-	m4_ifval([$4],$4=1)
-	ax_cv_have_func_attribute_$1=1
-	AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
-	AC_MSG_RESULT(no)
-)
-fi
 
 m4_ifval([$4],[AC_SUBST($4)])
 CFLAGS="$saved_CFLAGS"
diff --git a/configure b/configure
index ed366b4..f4cd6d9 100755
--- a/configure
+++ b/configure
@@ -18042,8 +18042,6 @@
 
 ax_cv_have_func_attribute_pure=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18071,35 +18069,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_pure=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_pure 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18113,8 +18082,6 @@
 
 ax_cv_have_func_attribute_malloc=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18142,35 +18109,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_malloc=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_malloc 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18184,8 +18122,6 @@
 
 ax_cv_have_func_attribute_const=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18213,35 +18149,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_const=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_const 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18255,8 +18162,6 @@
 
 ax_cv_have_func_attribute_unused=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18284,35 +18189,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_unused=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_unused 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18326,8 +18202,6 @@
 
 ax_cv_have_func_attribute_always_inline=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18355,35 +18229,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_always_inline=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_always_inline 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18397,8 +18242,6 @@
 
 ax_cv_have_func_attribute_deprecated=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18426,35 +18269,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_deprecated=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_deprecated 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18468,8 +18282,6 @@
 
 ax_cv_have_func_attribute_sentinel=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18497,35 +18309,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_sentinel=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_sentinel 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18539,8 +18322,6 @@
 
 ax_cv_have_func_attribute_warn_unused_result=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18568,35 +18349,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_warn_unused_result=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_warn_unused_result 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18610,8 +18362,6 @@
 
 ax_cv_have_func_attribute_may_alias=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((may_alias)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18639,35 +18389,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_may_alias=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_may_alias 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18681,8 +18402,6 @@
 
 ax_cv_have_func_attribute_constructor=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((constructor)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18710,35 +18429,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_constructor=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_constructor 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18756,8 +18446,6 @@
 
 ax_cv_have_func_attribute_destructor=0
 
-if test "x" = "x"
-then
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((destructor)) *test(void *muffin, ...) {return (void *) 0;}
@@ -18785,35 +18473,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) ;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_destructor=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_destructor 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"
@@ -18830,36 +18489,6 @@
 
 ax_cv_have_func_attribute_noreturn=0
 
-if test "xnoreturn" = "x"
-then
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- void __attribute__((noreturn)) *test(void *muffin, ...) {return (void *) 0;}
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-	ax_cv_have_func_attribute_noreturn=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_noreturn 1
-_ACEOF
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
  void __attribute__((noreturn)) *test(void *muffin, ...) ;
@@ -18887,7 +18516,6 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
 
 CFLAGS="$saved_CFLAGS"

-- 
To view, visit https://gerrit.asterisk.org/7385
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie70134f5795f38cb6fbd46684971e1fa847bc774
Gerrit-Change-Number: 7385
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171127/ecb0c55c/attachment-0001.html>


More information about the asterisk-code-review mailing list