<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7202">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Build: Make function constructor/destructor attributes mandatory.<br><br>This change causes the configure script to fail if the C compiler does<br>not support both function attributes constructor and destructor. These<br>were already required as modules cannot function without these attributes<br>and Asterisk requires modules.<br><br>This also has AST_GCC_ATTRIBUTE set a variable<br>ax_cv_have_func_attribute_$1. This is the same variable name used by<br>autoconf-archive's AX_GCC_FUNC_ATTRIBUTE, used for the same purpose.<br><br>Change-Id: Id68e8a1447f2a6d707c54b56350e7bfdb33fb663<br>---<br>M autoconf/ast_gcc_attribute.m4<br>M configure<br>M configure.ac<br>M include/asterisk/optional_api.h<br>4 files changed, 53 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/autoconf/ast_gcc_attribute.m4 b/autoconf/ast_gcc_attribute.m4<br>index 4ade814..b1972be 100644<br>--- a/autoconf/ast_gcc_attribute.m4<br>+++ b/autoconf/ast_gcc_attribute.m4<br>@@ -7,6 +7,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> m4_ifval([$4],$4=0)<br>+ax_cv_have_func_attribute_$1=0<br> <br> if test "x$2" = "x"<br> then<br>@@ -15,6 +16,7 @@<br> [])],<br> AC_MSG_RESULT(yes)<br> m4_ifval([$4],$4=1)<br>+ ax_cv_have_func_attribute_$1=1<br> AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),<br> AC_MSG_RESULT(no)<br> )<br>@@ -24,6 +26,7 @@<br> [])],<br> AC_MSG_RESULT(yes)<br> m4_ifval([$4],$4=1)<br>+ ax_cv_have_func_attribute_$1=1<br> AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),<br> AC_MSG_RESULT(no)<br> )<br>diff --git a/configure b/configure<br>index 9a8fb40..70553fc 100755<br>--- a/configure<br>+++ b/configure<br>@@ -18139,6 +18139,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_pure=0<br> <br> if test "x" = "x"<br> then<br>@@ -18157,6 +18158,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_pure=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_pure 1<br>@@ -18184,6 +18186,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_pure=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_pure 1<br>@@ -18207,6 +18210,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_malloc=0<br> <br> if test "x" = "x"<br> then<br>@@ -18225,6 +18229,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_malloc=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_malloc 1<br>@@ -18252,6 +18257,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_malloc=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_malloc 1<br>@@ -18275,6 +18281,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_const=0<br> <br> if test "x" = "x"<br> then<br>@@ -18293,6 +18300,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_const=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_const 1<br>@@ -18320,6 +18328,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_const=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_const 1<br>@@ -18343,6 +18352,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_unused=0<br> <br> if test "x" = "x"<br> then<br>@@ -18361,6 +18371,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_unused=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_unused 1<br>@@ -18388,6 +18399,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_unused=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_unused 1<br>@@ -18411,6 +18423,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_always_inline=0<br> <br> if test "x" = "x"<br> then<br>@@ -18429,6 +18442,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_always_inline=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_always_inline 1<br>@@ -18456,6 +18470,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_always_inline=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_always_inline 1<br>@@ -18479,6 +18494,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_deprecated=0<br> <br> if test "x" = "x"<br> then<br>@@ -18497,6 +18513,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_deprecated=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_deprecated 1<br>@@ -18524,6 +18541,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_deprecated=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_deprecated 1<br>@@ -18547,6 +18565,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_sentinel=0<br> <br> if test "x" = "x"<br> then<br>@@ -18565,6 +18584,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_sentinel=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_sentinel 1<br>@@ -18592,6 +18612,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_sentinel=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_sentinel 1<br>@@ -18615,6 +18636,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_warn_unused_result=0<br> <br> if test "x" = "x"<br> then<br>@@ -18633,6 +18655,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_warn_unused_result=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_warn_unused_result 1<br>@@ -18660,6 +18683,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_warn_unused_result=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_warn_unused_result 1<br>@@ -18683,6 +18707,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_may_alias=0<br> <br> if test "x" = "x"<br> then<br>@@ -18701,6 +18726,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_may_alias=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_may_alias 1<br>@@ -18728,6 +18754,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_may_alias=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_may_alias 1<br>@@ -18751,6 +18778,7 @@<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_constructor=0<br> <br> if test "x" = "x"<br> then<br>@@ -18769,6 +18797,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_constructor=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_constructor 1<br>@@ -18796,6 +18825,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_constructor=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_constructor 1<br>@@ -18813,12 +18843,17 @@<br> CFLAGS="$saved_CFLAGS"<br> <br> <br>+if test "$ax_cv_have_func_attribute_constructor" != "1"; then<br>+ as_fn_error $? "*** Function constructor attribute is not supported by your compiler." "$LINENO" 5<br>+fi<br>+<br> <br> { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute destructor' support" >&5<br> $as_echo_n "checking for compiler 'attribute destructor' support... " >&6; }<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_destructor=0<br> <br> if test "x" = "x"<br> then<br>@@ -18837,6 +18872,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_destructor=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_destructor 1<br>@@ -18864,6 +18900,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_destructor=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_destructor 1<br>@@ -18881,12 +18918,16 @@<br> CFLAGS="$saved_CFLAGS"<br> <br> <br>+if test "$ax_cv_have_func_attribute_destructor" != "1"; then<br>+ as_fn_error $? "*** Function destructor attribute is not supported by your compiler." "$LINENO" 5<br>+fi<br> <br> { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute noreturn' support" >&5<br> $as_echo_n "checking for compiler 'attribute noreturn' support... " >&6; }<br> saved_CFLAGS="$CFLAGS"<br> CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br> <br>+ax_cv_have_func_attribute_noreturn=0<br> <br> if test "xnoreturn" = "x"<br> then<br>@@ -18905,6 +18946,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_noreturn=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_noreturn 1<br>@@ -18932,6 +18974,7 @@<br> { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br> $as_echo "yes" >&6; }<br> <br>+ ax_cv_have_func_attribute_noreturn=1<br> <br> cat >>confdefs.h <<_ACEOF<br> #define HAVE_ATTRIBUTE_noreturn 1<br>diff --git a/configure.ac b/configure.ac<br>index 23ff526..f5c160c 100644<br>--- a/configure.ac<br>+++ b/configure.ac<br>@@ -1149,7 +1149,14 @@<br> AST_GCC_ATTRIBUTE(warn_unused_result)<br> AST_GCC_ATTRIBUTE(may_alias)<br> AST_GCC_ATTRIBUTE(constructor)<br>+if test "$ax_cv_have_func_attribute_constructor" != "1"; then<br>+ AC_MSG_ERROR([*** Function constructor attribute is not supported by your compiler.])<br>+fi<br>+<br> AST_GCC_ATTRIBUTE(destructor)<br>+if test "$ax_cv_have_func_attribute_destructor" != "1"; then<br>+ AC_MSG_ERROR([*** Function destructor attribute is not supported by your compiler.])<br>+fi<br> AST_GCC_ATTRIBUTE(noreturn,noreturn)<br> <br> AC_MSG_CHECKING(for -fsanitize=address support)<br>diff --git a/include/asterisk/optional_api.h b/include/asterisk/optional_api.h<br>index 1118dc7..1ac7651 100644<br>--- a/include/asterisk/optional_api.h<br>+++ b/include/asterisk/optional_api.h<br>@@ -107,10 +107,6 @@<br> <br> #if defined(OPTIONAL_API)<br> <br>-#if !defined(HAVE_ATTRIBUTE_constructor) || !defined(HAVE_ATTRIBUTE_constructor)<br>-#error OPTIONAL_API requires compiler constructor/destructor support<br>-#endif<br>-<br> /*!<br> * \internal<br> * \brief Function pointer to an optional API function.<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7202">change 7202</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7202"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Id68e8a1447f2a6d707c54b56350e7bfdb33fb663 </div>
<div style="display:none"> Gerrit-Change-Number: 7202 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>