]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add -Wdeclaration-after-statement for supported compilers
authorMichael Jerris <mike@jerris.com>
Wed, 2 Dec 2009 20:28:49 +0000 (20:28 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 2 Dec 2009 20:28:49 +0000 (20:28 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15762 d0543943-73ff-0310-b7d9-9358b9ac24b2

configure.in
src/switch_console.c

index 7a48c9656e5d69ac71980cf01f33fed0ca88b3f1..e9ed537c001a915edb96af2131046d32dbbbe09d 100644 (file)
@@ -261,11 +261,11 @@ AC_ARG_ENABLE(debug,
 
 if test "${enable_debug}" = "yes"; then
         AC_DEFINE([DEBUG],[],[Enable extra debugging.])
-       saved_CFLAGS=$CFLAGS
+       saved_CFLAGS="$CFLAGS"
        CFLAGS=
         AX_CFLAGS_WARN_ALL_ANSI
        SWITCH_ANSI_CFLAGS=$CFLAGS
-       CFLAGS=$saved_CFLAGS    
+       CFLAGS="$saved_CFLAGS"  
 
        if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
            APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb)
@@ -282,10 +282,10 @@ AM_CONDITIONAL([ENABLE_CPP],[test "${enable_cpp}" = "yes"])
 AC_ARG_ENABLE(zrtp,
        [AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"])
 if test "x$enable_zrtp" = "xyes" ; then
-   saved_LIBS=$LIBS
+   saved_LIBS="$LIBS"
    LIBS="$saved_LIBS -L/usr/local/lib -lbn -lpthread"
    AC_CHECK_LIB(zrtp, zrtp_init, [has_zrtp="yes"], [has_zrtp="no"])
-   LIBS=$saved_LIBS
+   LIBS="$saved_LIBS"
    if test "x$has_zrtp" = "xno"; then
       AC_ERROR([Cannot locate zrtp libraries])
    fi
@@ -452,6 +452,7 @@ else
 fi
 AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
 
+
 AC_MSG_CHECKING(whether compiler has __attribute__)
 AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
 compiler_has_attribute=yes,
@@ -465,7 +466,16 @@ fi
 AC_SUBST(ATTR_UNUSED)
 
 
-
+saved_CFLAGS="$CFLAGS"
+AC_CACHE_CHECK([whether compiler supports -Wdeclaration-after-statement], [ac_cv_gcc_declaration_after_statement], [
+CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_declaration_after_statement=yes],[ac_cv_gcc_declaration_after_statement=no])
+])
+AC_MSG_RESULT($ac_cv_gcc_declaration_after_statement)
+if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then
+    APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wdeclaration-after-statement)
+fi
+CFLAGS="$saved_CFLAGS"
 
 AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
 
index 751881c174a20b57d4c2f5122f7aec56f24781d8..8abf633a0c98244dfd5fb1b764dc56fcbb1c79fa 100644 (file)
@@ -584,12 +584,11 @@ static unsigned char complete(EditLine * el, int ch)
 
        if (h.hits != 1) {
                char *dupdup = strdup(dup);
-               switch_assert(dupdup);
                int x, argc = 0;
                char *argv[10] = { 0 };
                switch_stream_handle_t stream = { 0 };
                SWITCH_STANDARD_STREAM(stream);
-
+               switch_assert(dupdup);
 
                argc = switch_separate_string(dupdup, ' ', argv, (sizeof(argv) / sizeof(argv[0])));