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:
Václav Slavík 2006-09-05 14:21:08 +00:00
parent e8b4959678
commit ca766534cf
4 changed files with 119 additions and 14 deletions

86
configure vendored
View File

@ -12156,7 +12156,7 @@ echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
CFLAGS="$CFLAGS -g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
@ -12628,7 +12628,7 @@ fi
unset ac_cv_prog_cc_g
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
CFLAGS="$CFLAGS -g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
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
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
CXXFLAGS="$CXXFLAGS -g -O2"
else
CXXFLAGS="-g"
CXXFLAGS="$CXXFLAGS -g"
fi
else
if test "$GXX" = yes; then
@ -14065,7 +14065,7 @@ fi
unset ac_cv_prog_cc_g
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
CFLAGS="$CFLAGS -g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
@ -22058,6 +22058,76 @@ _ACEOF
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.
if test "${enable_largefile+set}" = set; then
enableval="$enable_largefile"
@ -34897,10 +34967,8 @@ if test "${wx_cv_func_snprintf_pos_params+set}" = set; then
else
if test "$cross_compiling" = yes; then
{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
See \`config.log' for more details." >&5
echo "$as_me: error: cannot run test program while cross compiling
See \`config.log' for more details." >&2;}
{ { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5
echo "$as_me: error: internal error: not reached in cross-compile" >&2;}
{ (exit 1); exit 1; }; }
else
cat >conftest.$ac_ext <<_ACEOF

View File

@ -1931,6 +1931,31 @@ else
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
AC_SYS_LARGEFILE

View File

@ -567,14 +567,21 @@ DECLARE_LOG_FUNCTION2(SysError, long, lErrCode);
#else //!debug || !wxUSE_LOG
// 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
// 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 wxVLogTrace(wxTraceMask, const wxChar *, va_list) { }
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); }
#endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS
#endif // debug/!debug
// 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())
#else //!debug
inline void wxLogApiError(const wxChar *, long) { }
inline void wxLogLastError(const wxChar *) { }
#define wxLogApiError(api, err)
#define wxLogLastError(api)
#endif //debug/!debug
// wxCocoa has additiional trace masks

View File

@ -567,6 +567,11 @@
*/
#undef VA_LIST_IS_ARRAY
/*
* Define if the compiler supports variadic macros
*/
#undef HAVE_VARIADIC_MACROS
/*
* Define if your compiler has std::wstring
*/