<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7260">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">menuselect: Remove ineffective weak attribute detection.<br><br>menuselect detects compiler support for multiple styles of weak<br>functions. This is a remnant from 2013 when OPTIONAL_API required weak<br>functions. It is no longer correct for menuselect to switch<br>dependencies from optional to required based on lack of weak function<br>support.<br><br>Note an issue remains - dependencies should switch from optional to<br>required based on OPTIONAL_API being enabled or disabled. I don't think<br>this is possible. menuselect needs to know at startup if OPTIONAL_API<br>is enabled or disabled, so the only way to fix this is to remove<br>OPTIONAL_API from menuselect and create a configure option. I've left<br>the code that switches in place but it's preprocessed out.<br><br>Additionally removed:<br>- WEAKREF variable from Asterisk makeopts.in.<br>- Related disabled code from test_utils.<br>- Pointless AC_REVISION call from menuselect/configure.ac.<br><br>Change-Id: Ifa702e5f98eb45f338b2f131a93354632a8fb389<br>---<br>M makeopts.in<br>M menuselect/autoconfig.h.in<br>M menuselect/configure<br>M menuselect/configure.ac<br>M menuselect/menuselect.c<br>M tests/test_utils.c<br>6 files changed, 6 insertions(+), 374 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/60/7260/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/makeopts.in b/makeopts.in<br>index 1d31c29..43a4728 100644<br>--- a/makeopts.in<br>+++ b/makeopts.in<br>@@ -73,7 +73,6 @@<br> CONFIG_SIGNED_CHAR=@CONFIG_SIGNED_CHAR@<br> <br> GNU_LD=@GNU_LD@<br>-WEAKREF=@PBX_WEAKREF@<br> HAVE_DYNAMIC_LIST=@PBX_DYNAMIC_LIST@<br> <br> prefix = @prefix@<br>diff --git a/menuselect/autoconfig.h.in b/menuselect/autoconfig.h.in<br>index 9cafa56..590ce61 100644<br>--- a/menuselect/autoconfig.h.in<br>+++ b/menuselect/autoconfig.h.in<br>@@ -26,15 +26,6 @@<br> /* Define to 1 if you have the `asprintf' function. */<br> #undef HAVE_ASPRINTF<br> <br>-/* Define to 1 if your GCC C compiler supports the 'weak' attribute. */<br>-#undef HAVE_ATTRIBUTE_weak<br>-<br>-/* Define to 1 if your GCC C compiler supports the 'weak_import' attribute. */<br>-#undef HAVE_ATTRIBUTE_weak_import<br>-<br>-/* Define to 1 if your GCC C compiler supports the 'weakref' attribute. */<br>-#undef HAVE_ATTRIBUTE_weakref<br>-<br> /* Define to 1 if you have the curses library. */<br> #undef HAVE_CURSES<br> <br>diff --git a/menuselect/configure b/menuselect/configure<br>index 4235ea0..13a330b 100755<br>--- a/menuselect/configure<br>+++ b/menuselect/configure<br>@@ -1,5 +1,4 @@<br> #! /bin/sh<br>-# From configure.ac Revision.<br> # Guess values for system-dependent variables and create Makefiles.<br> # Generated by GNU Autoconf 2.69.<br> #<br>@@ -655,7 +654,6 @@<br> EGREP<br> GREP<br> CPP<br>-PBX_WEAKREF<br> MENUSELECT_DEBUG<br> GNU_MAKE<br> OBJEXT<br>@@ -2218,7 +2216,6 @@<br> <br> <br> <br>-<br> ac_aux_dir=<br> for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do<br> if test -f "$ac_dir/install-sh"; then<br>@@ -3194,305 +3191,6 @@<br> <br> <br> <br>-# Support weak symbols on a platform specific basis. The Mac OS X<br>-# (Darwin) support must be isolated from the other platforms because<br>-# it has caused other platforms to fail.<br>-#<br>-case "${OSARCH}" in<br>- darwin*)<br>- # Allow weak symbol support on Darwin platforms only because there<br>- # is active community support for it.<br>- # However, Darwin seems to break weak symbols for each new version.<br>- #<br>-<br>-<br>-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weak_import' support" >&5<br>-$as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; }<br>-saved_CFLAGS="$CFLAGS"<br>-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br>-PBX_WEAKREF=0<br>-<br>-if test "x" = "x"<br>-then<br>-cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>-/* end confdefs.h. */<br>- void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;}<br>-int<br>-main ()<br>-{<br>-<br>- ;<br>- return 0;<br>-}<br>-_ACEOF<br>-if ac_fn_c_try_compile "$LINENO"; then :<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>-$as_echo "yes" >&6; }<br>- PBX_WEAKREF=1<br>-<br>-cat >>confdefs.h <<_ACEOF<br>-#define HAVE_ATTRIBUTE_weak_import 1<br>-_ACEOF<br>-<br>-else<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>-$as_echo "no" >&6; }<br>-<br>-fi<br>-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>-else<br>-cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>-/* end confdefs.h. */<br>- void __attribute__(()) *test(void *muffin, ...) ;<br>-int<br>-main ()<br>-{<br>-<br>- ;<br>- return 0;<br>-}<br>-_ACEOF<br>-if ac_fn_c_try_compile "$LINENO"; then :<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>-$as_echo "yes" >&6; }<br>- PBX_WEAKREF=1<br>-<br>-cat >>confdefs.h <<_ACEOF<br>-#define HAVE_ATTRIBUTE_weak_import 1<br>-_ACEOF<br>-<br>-else<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>-$as_echo "no" >&6; }<br>-<br>-fi<br>-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>-fi<br>-<br>-<br>-CFLAGS="$saved_CFLAGS"<br>-<br>-<br>-<br>- # Several other platforms including Linux have GCC versions that<br>- # define the weak attribute. However, this attribute is only<br>- # setup for use in the code by Darwin.<br>-<br>-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weak' support" >&5<br>-$as_echo_n "checking for compiler 'attribute weak' support... " >&6; }<br>-saved_CFLAGS="$CFLAGS"<br>-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br>-PBX_WEAKREF=0<br>-<br>-if test "x" = "x"<br>-then<br>-cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>-/* end confdefs.h. */<br>- void __attribute__((weak)) *test(void *muffin, ...) {return (void *) 0;}<br>-int<br>-main ()<br>-{<br>-<br>- ;<br>- return 0;<br>-}<br>-_ACEOF<br>-if ac_fn_c_try_compile "$LINENO"; then :<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>-$as_echo "yes" >&6; }<br>- PBX_WEAKREF=1<br>-<br>-cat >>confdefs.h <<_ACEOF<br>-#define HAVE_ATTRIBUTE_weak 1<br>-_ACEOF<br>-<br>-else<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>-$as_echo "no" >&6; }<br>-<br>-fi<br>-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>-else<br>-cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>-/* end confdefs.h. */<br>- void __attribute__(()) *test(void *muffin, ...) ;<br>-int<br>-main ()<br>-{<br>-<br>- ;<br>- return 0;<br>-}<br>-_ACEOF<br>-if ac_fn_c_try_compile "$LINENO"; then :<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>-$as_echo "yes" >&6; }<br>- PBX_WEAKREF=1<br>-<br>-cat >>confdefs.h <<_ACEOF<br>-#define HAVE_ATTRIBUTE_weak 1<br>-_ACEOF<br>-<br>-else<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>-$as_echo "no" >&6; }<br>-<br>-fi<br>-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>-fi<br>-<br>-<br>-CFLAGS="$saved_CFLAGS"<br>-<br>-<br>- ;;<br>- linux-gnu)<br>- # Primarily support weak symbols on Linux platforms.<br>- #<br>-<br>-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weakref' support" >&5<br>-$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }<br>-saved_CFLAGS="$CFLAGS"<br>-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br>-PBX_WEAKREF=0<br>-<br>-if test "xweakref("foo")" = "x"<br>-then<br>-cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>-/* end confdefs.h. */<br>-static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}<br>-int<br>-main ()<br>-{<br>-<br>- ;<br>- return 0;<br>-}<br>-_ACEOF<br>-if ac_fn_c_try_compile "$LINENO"; then :<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>-$as_echo "yes" >&6; }<br>- PBX_WEAKREF=1<br>-<br>-cat >>confdefs.h <<_ACEOF<br>-#define HAVE_ATTRIBUTE_weakref 1<br>-_ACEOF<br>-<br>-else<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>-$as_echo "no" >&6; }<br>-<br>-fi<br>-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>-else<br>-cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>-/* end confdefs.h. */<br>-static void __attribute__((weakref("foo"))) *test(void *muffin, ...) ;<br>-int<br>-main ()<br>-{<br>-<br>- ;<br>- return 0;<br>-}<br>-_ACEOF<br>-if ac_fn_c_try_compile "$LINENO"; then :<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>-$as_echo "yes" >&6; }<br>- PBX_WEAKREF=1<br>-<br>-cat >>confdefs.h <<_ACEOF<br>-#define HAVE_ATTRIBUTE_weakref 1<br>-_ACEOF<br>-<br>-else<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>-$as_echo "no" >&6; }<br>-<br>-fi<br>-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>-fi<br>-<br>-<br>-CFLAGS="$saved_CFLAGS"<br>-<br>-<br>- ;;<br>- *)<br>- # Allow weak symbols on other platforms. However, any problems<br>- # with this feature on other platforms must be fixed by the<br>- # community.<br>- #<br>-<br>-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weakref' support" >&5<br>-$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }<br>-saved_CFLAGS="$CFLAGS"<br>-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"<br>-PBX_WEAKREF=0<br>-<br>-if test "xweakref("foo")" = "x"<br>-then<br>-cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>-/* end confdefs.h. */<br>-static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}<br>-int<br>-main ()<br>-{<br>-<br>- ;<br>- return 0;<br>-}<br>-_ACEOF<br>-if ac_fn_c_try_compile "$LINENO"; then :<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>-$as_echo "yes" >&6; }<br>- PBX_WEAKREF=1<br>-<br>-cat >>confdefs.h <<_ACEOF<br>-#define HAVE_ATTRIBUTE_weakref 1<br>-_ACEOF<br>-<br>-else<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>-$as_echo "no" >&6; }<br>-<br>-fi<br>-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>-else<br>-cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>-/* end confdefs.h. */<br>-static void __attribute__((weakref("foo"))) *test(void *muffin, ...) ;<br>-int<br>-main ()<br>-{<br>-<br>- ;<br>- return 0;<br>-}<br>-_ACEOF<br>-if ac_fn_c_try_compile "$LINENO"; then :<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>-$as_echo "yes" >&6; }<br>- PBX_WEAKREF=1<br>-<br>-cat >>confdefs.h <<_ACEOF<br>-#define HAVE_ATTRIBUTE_weakref 1<br>-_ACEOF<br>-<br>-else<br>- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>-$as_echo "no" >&6; }<br>-<br>-fi<br>-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>-fi<br>-<br>-<br>-CFLAGS="$saved_CFLAGS"<br>-<br>-<br>- ;;<br>-esac<br> <br> ac_ext=c<br> ac_cpp='$CPP $CPPFLAGS'<br>diff --git a/menuselect/configure.ac b/menuselect/configure.ac<br>index 29c43cb..5945f5c 100644<br>--- a/menuselect/configure.ac<br>+++ b/menuselect/configure.ac<br>@@ -15,7 +15,6 @@<br> AC_CONFIG_HEADER(autoconfig.h)<br> <br> AC_COPYRIGHT("Menuselect")<br>-AC_REVISION($Revision$)<br> <br> AC_CANONICAL_BUILD<br> AC_CANONICAL_HOST<br>@@ -80,37 +79,6 @@<br> *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;<br> esac])<br> AC_SUBST(MENUSELECT_DEBUG)<br>-<br>-# Support weak symbols on a platform specific basis. The Mac OS X<br>-# (Darwin) support must be isolated from the other platforms because<br>-# it has caused other platforms to fail.<br>-#<br>-case "${OSARCH}" in<br>- darwin*)<br>- # Allow weak symbol support on Darwin platforms only because there<br>- # is active community support for it.<br>- # However, Darwin seems to break weak symbols for each new version.<br>- #<br>- AST_GCC_ATTRIBUTE(weak_import, [], [], PBX_WEAKREF)<br>-<br>- # Several other platforms including Linux have GCC versions that<br>- # define the weak attribute. However, this attribute is only<br>- # setup for use in the code by Darwin.<br>- AST_GCC_ATTRIBUTE(weak, [], [], PBX_WEAKREF)<br>- ;;<br>- linux-gnu)<br>- # Primarily support weak symbols on Linux platforms.<br>- #<br>- AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)<br>- ;;<br>- *)<br>- # Allow weak symbols on other platforms. However, any problems<br>- # with this feature on other platforms must be fixed by the<br>- # community.<br>- #<br>- AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)<br>- ;;<br>-esac<br> <br> AC_FUNC_ALLOCA<br> AC_CHECK_FUNCS([asprintf getloadavg setenv strcasestr strndup strnlen strsep unsetenv vasprintf])<br>diff --git a/menuselect/menuselect.c b/menuselect/menuselect.c<br>index 689cebf..83f6098 100644<br>--- a/menuselect/menuselect.c<br>+++ b/menuselect/menuselect.c<br>@@ -986,8 +986,12 @@<br> }<br> }<br> <br>- /* If weak linking is not supported, move module uses which are other modules to the dependency list */<br>-#if !defined(HAVE_ATTRIBUTE_weak_import) && !defined(HAVE_ATTRIBUTE_weakref) && !defined(HAVE_ATTRIBUTE_weak)<br>+/*<br>+ * BUGBUG:<br>+ * This doesn't work, the only way we can fix this is to remove OPTIONAL_API<br>+ * toggle from menuselect and add a command-line argument to ./configure.<br>+ */<br>+#if 0<br> AST_LIST_TRAVERSE(&categories, cat, list) {<br> AST_LIST_TRAVERSE(&cat->members, mem, list) {<br> if (mem->is_separator) {<br>diff --git a/tests/test_utils.c b/tests/test_utils.c<br>index 072cf0a..68a2857 100644<br>--- a/tests/test_utils.c<br>+++ b/tests/test_utils.c<br>@@ -324,20 +324,6 @@<br> break;<br> }<br> <br>-#if 0 /* Not defined on Solaris */<br>- ast_test_status_update(test,<br>- "address of __stub__ast_crypto_loaded is %p\n",<br>- __stub__ast_crypto_loaded);<br>-#ifndef HAVE_ATTRIBUTE_weak_import<br>- ast_test_status_update(test,<br>- "address of __ref__ast_crypto_loaded is %p\n",<br>- __ref__ast_crypto_loaded);<br>-#endif<br>- ast_test_status_update(test,<br>- "pointer to ast_crypto_loaded is %p\n",<br>- ast_crypto_loaded);<br>-#endif<br>-<br> return ast_crypto_loaded() ? AST_TEST_PASS : AST_TEST_FAIL;<br> }<br> <br>@@ -387,20 +373,6 @@<br> case TEST_EXECUTE:<br> break;<br> }<br>-<br>-#if 0<br>- ast_test_status_update(test,<br>- "address of __stub__ast_agi_register is %p\n",<br>- __stub__ast_agi_register);<br>-#ifndef HAVE_ATTRIBUTE_weak_import<br>- ast_test_status_update(test,<br>- "address of __ref__ast_agi_register is %p\n",<br>- __ref__ast_agi_register);<br>-#endif<br>- ast_test_status_update(test,<br>- "pointer to ast_agi_register is %p\n",<br>- ast_agi_register);<br>-#endif<br> <br> if (ast_agi_register(ast_module_info->self, &noop_command) == AST_OPTIONAL_API_UNAVAILABLE) {<br> ast_test_status_update(test, "Unable to register testnoop command, because res_agi is not loaded.\n");<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7260">change 7260</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/7260"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ifa702e5f98eb45f338b2f131a93354632a8fb389 </div>
<div style="display:none"> Gerrit-Change-Number: 7260 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>