[asterisk-commits] dlee: trunk r373120 - in /trunk: ./ include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 18 10:50:39 CDT 2012


Author: dlee
Date: Tue Sep 18 10:50:35 2012
New Revision: 373120

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373120
Log:
Add -fnested-functions compile flag, if needed.

In order to use nested functions on some versions of GCC (e.g. GCC on OS X),
the -fnested-functions flag must be passed to the compiler. This patch adds
detection logic to ./configure to add the flag if necessary. It also adds
a comment to utils.h as to why the nested function needs a prototype.

(closes issue ASTERISK-20399)
Reported by: David M. Lee
Review: https://reviewboard.asterisk.org/r/2102/
........

Merged revisions 373119 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    trunk/   (props changed)
    trunk/Makefile
    trunk/configure
    trunk/configure.ac
    trunk/include/asterisk/autoconfig.h.in
    trunk/include/asterisk/utils.h
    trunk/makeopts.in

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: trunk/Makefile
URL: http://svnview.digium.com/svn/asterisk/trunk/Makefile?view=diff&rev=373120&r1=373119&r2=373120
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Tue Sep 18 10:50:35 2012
@@ -184,7 +184,7 @@
   _ASTCFLAGS+=-Wall
 endif
 
-_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
+_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_NESTED_FUNCTIONS) $(DEBUG)
 ADDL_TARGETS=
 
 ifeq ($(AST_DEVMODE),yes)

Modified: trunk/configure.ac
URL: http://svnview.digium.com/svn/asterisk/trunk/configure.ac?view=diff&rev=373120&r1=373119&r2=373120
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Tue Sep 18 10:50:35 2012
@@ -1038,6 +1038,18 @@
 fi
 AC_SUBST(AST_NATIVE_ARCH)
 
+dnl Nested functions required for RAII implementation
+AC_MSG_CHECKING(for -fnested-functions)
+AC_COMPILE_IFELSE(
+	dnl Prototype needed due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36774
+	[AC_LANG_PROGRAM([], [auto void foo(void); void foo(void) {}])],
+	AC_MSG_RESULT(no)
+	[AST_NESTED_FUNCTIONS=],
+	AC_MSG_RESULT(required)
+	[AST_NESTED_FUNCTIONS=-fnested-functions]
+)
+AC_SUBST(AST_NESTED_FUNCTIONS)
+
 AC_MSG_CHECKING(for sysinfo)
 AC_LINK_IFELSE(
         [AC_LANG_PROGRAM([#include <sys/sysinfo.h>],

Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=373120&r1=373119&r2=373120
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Tue Sep 18 10:50:35 2012
@@ -845,19 +845,19 @@
 /* Define to 1 if you have the `strtoq' function. */
 #undef HAVE_STRTOQ
 
-/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
+/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
 
-/* Define to 1 if `uid' is member of `struct sockpeercred'. */
+/* Define to 1 if `uid' is a member of `struct sockpeercred'. */
 #undef HAVE_STRUCT_SOCKPEERCRED_UID
 
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
-/* Define to 1 if `cr_uid' is member of `struct ucred'. */
+/* Define to 1 if `cr_uid' is a member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_CR_UID
 
-/* Define to 1 if `uid' is member of `struct ucred'. */
+/* Define to 1 if `uid' is a member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_UID
 
 /* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -1134,6 +1134,9 @@
 
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
 
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION

Modified: trunk/include/asterisk/utils.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/utils.h?view=diff&rev=373120&r1=373119&r2=373120
==============================================================================
--- trunk/include/asterisk/utils.h (original)
+++ trunk/include/asterisk/utils.h Tue Sep 18 10:50:35 2012
@@ -919,8 +919,9 @@
  * \endcode
  */
 #define RAII_VAR(vartype, varname, initval, dtor) \
+    /* Prototype needed due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36774 */ \
     auto void _dtor_ ## varname (vartype * v); \
-    auto void _dtor_ ## varname (vartype * v) { dtor(*v); } \
+    void _dtor_ ## varname (vartype * v) { dtor(*v); } \
     vartype varname __attribute__((cleanup(_dtor_ ## varname))) = (initval)
 
 #endif /* _ASTERISK_UTILS_H */

Modified: trunk/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/trunk/makeopts.in?view=diff&rev=373120&r1=373119&r2=373120
==============================================================================
--- trunk/makeopts.in (original)
+++ trunk/makeopts.in Tue Sep 18 10:50:35 2012
@@ -105,6 +105,7 @@
 AST_TRAMPOLINES=@AST_TRAMPOLINES@
 AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@
 AST_SHADOW_WARNINGS=@AST_SHADOW_WARNINGS@
+AST_NESTED_FUNCTIONS=@AST_NESTED_FUNCTIONS@
 AST_FORTIFY_SOURCE=@AST_FORTIFY_SOURCE@
 AST_MARCH_NATIVE=@AST_MARCH_NATIVE@
 




More information about the asterisk-commits mailing list