use macros to completely remove wxLogTrace, wxLogDebug etc. in release build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41015 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e8b4959678
commit
ca766534cf
86
configure
vendored
86
configure
vendored
@ -12156,7 +12156,7 @@ echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
|
|||||||
GCC=`test $ac_compiler_gnu = yes && echo yes`
|
GCC=`test $ac_compiler_gnu = yes && echo yes`
|
||||||
ac_test_CFLAGS=${CFLAGS+set}
|
ac_test_CFLAGS=${CFLAGS+set}
|
||||||
ac_save_CFLAGS=$CFLAGS
|
ac_save_CFLAGS=$CFLAGS
|
||||||
CFLAGS="-g"
|
CFLAGS="$CFLAGS -g"
|
||||||
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
|
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
|
||||||
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
|
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
|
||||||
if test "${ac_cv_prog_cc_g+set}" = set; then
|
if test "${ac_cv_prog_cc_g+set}" = set; then
|
||||||
@ -12628,7 +12628,7 @@ fi
|
|||||||
unset ac_cv_prog_cc_g
|
unset ac_cv_prog_cc_g
|
||||||
ac_test_CFLAGS=${CFLAGS+set}
|
ac_test_CFLAGS=${CFLAGS+set}
|
||||||
ac_save_CFLAGS=$CFLAGS
|
ac_save_CFLAGS=$CFLAGS
|
||||||
CFLAGS="-g"
|
CFLAGS="$CFLAGS -g"
|
||||||
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
|
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
|
||||||
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
|
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
|
||||||
if test "${ac_cv_prog_cc_g+set}" = set; then
|
if test "${ac_cv_prog_cc_g+set}" = set; then
|
||||||
@ -13800,9 +13800,9 @@ if test "$ac_test_CXXFLAGS" = set; then
|
|||||||
CXXFLAGS=$ac_save_CXXFLAGS
|
CXXFLAGS=$ac_save_CXXFLAGS
|
||||||
elif test $ac_cv_prog_cxx_g = yes; then
|
elif test $ac_cv_prog_cxx_g = yes; then
|
||||||
if test "$GXX" = yes; then
|
if test "$GXX" = yes; then
|
||||||
CXXFLAGS="-g -O2"
|
CXXFLAGS="$CXXFLAGS -g -O2"
|
||||||
else
|
else
|
||||||
CXXFLAGS="-g"
|
CXXFLAGS="$CXXFLAGS -g"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if test "$GXX" = yes; then
|
if test "$GXX" = yes; then
|
||||||
@ -14065,7 +14065,7 @@ fi
|
|||||||
unset ac_cv_prog_cc_g
|
unset ac_cv_prog_cc_g
|
||||||
ac_test_CFLAGS=${CFLAGS+set}
|
ac_test_CFLAGS=${CFLAGS+set}
|
||||||
ac_save_CFLAGS=$CFLAGS
|
ac_save_CFLAGS=$CFLAGS
|
||||||
CFLAGS="-g"
|
CFLAGS="$CFLAGS -g"
|
||||||
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
|
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
|
||||||
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
|
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
|
||||||
if test "${ac_cv_prog_cc_g+set}" = set; then
|
if test "${ac_cv_prog_cc_g+set}" = set; then
|
||||||
@ -22058,6 +22058,76 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$as_me:$LINENO: checking whether the compiler supports variadic macros" >&5
|
||||||
|
echo $ECHO_N "checking whether the compiler supports variadic macros... $ECHO_C" >&6
|
||||||
|
if test "${wx_cv_have_variadic_macros+set}" = set; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#define test(fmt, ...) printf(fmt, __VA_ARGS__)
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
test("%s %d %p", "test", 1, 0);
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
|
(eval $ac_compile) 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } &&
|
||||||
|
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; } &&
|
||||||
|
{ ac_try='test -s conftest.$ac_objext'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
wx_cv_have_variadic_macros=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
wx_cv_have_variadic_macros=no
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
echo "$as_me:$LINENO: result: $wx_cv_have_variadic_macros" >&5
|
||||||
|
echo "${ECHO_T}$wx_cv_have_variadic_macros" >&6
|
||||||
|
|
||||||
|
if test $wx_cv_have_variadic_macros = "yes"; then
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define HAVE_VARIADIC_MACROS 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# Check whether --enable-largefile or --disable-largefile was given.
|
# Check whether --enable-largefile or --disable-largefile was given.
|
||||||
if test "${enable_largefile+set}" = set; then
|
if test "${enable_largefile+set}" = set; then
|
||||||
enableval="$enable_largefile"
|
enableval="$enable_largefile"
|
||||||
@ -34897,10 +34967,8 @@ if test "${wx_cv_func_snprintf_pos_params+set}" = set; then
|
|||||||
else
|
else
|
||||||
|
|
||||||
if test "$cross_compiling" = yes; then
|
if test "$cross_compiling" = yes; then
|
||||||
{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
|
{ { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
|
||||||
See \`config.log' for more details." >&5
|
echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
|
||||||
echo "$as_me: error: cannot run test program while cross compiling
|
|
||||||
See \`config.log' for more details." >&2;}
|
|
||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
else
|
else
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
25
configure.in
25
configure.in
@ -1931,6 +1931,31 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl Check if variadic macros (C99 feature) are supported:
|
||||||
|
AC_CACHE_CHECK(
|
||||||
|
[whether the compiler supports variadic macros],
|
||||||
|
[wx_cv_have_variadic_macros],
|
||||||
|
[
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
AC_LANG_PROGRAM(
|
||||||
|
[
|
||||||
|
#include <stdio.h>
|
||||||
|
#define test(fmt, ...) printf(fmt, __VA_ARGS__)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
test("%s %d %p", "test", 1, 0);
|
||||||
|
]
|
||||||
|
),
|
||||||
|
[wx_cv_have_variadic_macros=yes],
|
||||||
|
[wx_cv_have_variadic_macros=no]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test $wx_cv_have_variadic_macros = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_VARIADIC_MACROS)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl check for large file support
|
dnl check for large file support
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
|
@ -567,14 +567,21 @@ DECLARE_LOG_FUNCTION2(SysError, long, lErrCode);
|
|||||||
#else //!debug || !wxUSE_LOG
|
#else //!debug || !wxUSE_LOG
|
||||||
// these functions do nothing in release builds
|
// these functions do nothing in release builds
|
||||||
|
|
||||||
|
#define wxVLogDebug(fmt, valist)
|
||||||
|
#define wxVLogTrace(mask, fmt, valist)
|
||||||
|
|
||||||
|
#ifdef HAVE_VARIADIC_MACROS
|
||||||
|
// unlike the inline functions below, this completely removes the
|
||||||
|
// wxLogXXX calls from the object file:
|
||||||
|
#define wxLogDebug(fmt, ...)
|
||||||
|
#define wxLogTrace(mask, fmt, ...)
|
||||||
|
#else // !HAVE_VARIADIC_MACROS
|
||||||
// note that leaving out "fmt" in the vararg functions provokes a warning
|
// note that leaving out "fmt" in the vararg functions provokes a warning
|
||||||
// from SGI CC: "the last argument of the varargs function is unnamed"
|
// from SGI CC: "the last argument of the varargs function is unnamed"
|
||||||
inline void wxVLogDebug(const wxChar *, va_list) { }
|
|
||||||
inline void wxLogDebug(const wxChar *fmt, ...) { wxUnusedVar(fmt); }
|
inline void wxLogDebug(const wxChar *fmt, ...) { wxUnusedVar(fmt); }
|
||||||
inline void wxVLogTrace(wxTraceMask, const wxChar *, va_list) { }
|
|
||||||
inline void wxLogTrace(wxTraceMask, const wxChar *fmt, ...) { wxUnusedVar(fmt); }
|
inline void wxLogTrace(wxTraceMask, const wxChar *fmt, ...) { wxUnusedVar(fmt); }
|
||||||
inline void wxVLogTrace(const wxChar *, const wxChar *, va_list) { }
|
|
||||||
inline void wxLogTrace(const wxChar *, const wxChar *fmt, ...) { wxUnusedVar(fmt); }
|
inline void wxLogTrace(const wxChar *, const wxChar *fmt, ...) { wxUnusedVar(fmt); }
|
||||||
|
#endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS
|
||||||
#endif // debug/!debug
|
#endif // debug/!debug
|
||||||
|
|
||||||
// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
|
// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
|
||||||
@ -605,8 +612,8 @@ wxSafeShowMessage(const wxString& title, const wxString& text);
|
|||||||
#define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
|
#define wxLogLastError(api) wxLogApiError(api, wxSysErrorCode())
|
||||||
|
|
||||||
#else //!debug
|
#else //!debug
|
||||||
inline void wxLogApiError(const wxChar *, long) { }
|
#define wxLogApiError(api, err)
|
||||||
inline void wxLogLastError(const wxChar *) { }
|
#define wxLogLastError(api)
|
||||||
#endif //debug/!debug
|
#endif //debug/!debug
|
||||||
|
|
||||||
// wxCocoa has additiional trace masks
|
// wxCocoa has additiional trace masks
|
||||||
|
@ -567,6 +567,11 @@
|
|||||||
*/
|
*/
|
||||||
#undef VA_LIST_IS_ARRAY
|
#undef VA_LIST_IS_ARRAY
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define if the compiler supports variadic macros
|
||||||
|
*/
|
||||||
|
#undef HAVE_VARIADIC_MACROS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define if your compiler has std::wstring
|
* Define if your compiler has std::wstring
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user