From 4b80497ee9dafdafee50ac16974aefaf44b499c8 Mon Sep 17 00:00:00 2001 From: VincentWei Date: Sun, 28 Jan 2018 11:38:41 +0800 Subject: [PATCH] define _DEBUG and NDEBUG for develmode or not resp. --- configure.ac | 16 +++------------- include/common.h | 33 +++++++++++++++------------------ src/gui/lf_manager.c | 4 ++-- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/configure.ac b/configure.ac index f7d04f2e..8359f994 100644 --- a/configure.ac +++ b/configure.ac @@ -83,7 +83,6 @@ dnl User selectable options dnl System wide options devel_mode="no" -use_debug="no" trace_message="no" message_string="no" @@ -286,10 +285,6 @@ AC_ARG_ENABLE(develmode, [ --enable-develmode developer mode ], devel_mode=$enableval) -AC_ARG_ENABLE(debug, -[ --enable-debug build with debugging messages ], -use_debug=$enableval) - AC_ARG_ENABLE(tracemsg, [ --enable-tracemsg trace messages of MiniGUI ], trace_message=$enableval) @@ -1642,7 +1637,6 @@ if test "x$fixed_math" = "xyes"; then fi if test "x$devel_mode" = "xyes"; then - use_debug="yes" message_string="yes" trace_message="no" @@ -1698,8 +1692,6 @@ if test "x$devel_mode" = "xyes"; then enable_video_shadow="yes" enable_video_mlshadow="yes" enable_video_custom="yes" - - build_screensaver="yes" fi dnl Depedencies @@ -1711,11 +1703,6 @@ if test "x$build_ctrl_treeview_rdr" = "xyes"; then build_ctrl_scrollview="yes" fi -if test "x$use_debug" = "xyes"; then - AC_DEFINE(_DEBUG, 1, - [Define if build with debugging messages]) -fi - if test "x$trace_message" = "xyes"; then message_string="yes" @@ -2439,9 +2426,12 @@ dnl define _GNU_SOURCE for pthread_rwlock_t CFLAGS="$CFLAGS -D_GNU_SOURCE" if test "x$devel_mode" = "xyes"; then + CPPFLAGS="$CPPFLAGS -D_DEBUG" if test "$ac_cv_prog_gcc" = "yes"; then CPPFLAGS="$CPPFLAGS -Wall -Werror" fi +else + CPPFLAGS="$CPPFLAGS -DNDEBUG" fi if test "$ac_cv_prog_gcc" = "yes"; then diff --git a/include/common.h b/include/common.h index 85625ce4..638aa3d7 100644 --- a/include/common.h +++ b/include/common.h @@ -40,6 +40,13 @@ #define _MGUI_COMMON_H #ifndef MINIGUI_MAJOR_VERSION +# undef PACKAGE +# undef VERSION +# undef PACKAGE_BUGREPORT +# undef PACKAGE_NAME +# undef PACKAGE_STRING +# undef PACKAGE_TARNAME +# undef PACKAGE_VERSION # ifdef __MINIGUI_LIB__ # ifdef _FOR_DATANG # ifdef WIN32 @@ -57,24 +64,18 @@ # endif # endif # else -# undef PACKAGE -# undef VERSION -# undef PACKAGE_BUGREPORT -# undef PACKAGE_NAME -# undef PACKAGE_STRING -# undef PACKAGE_TARNAME -# undef PACKAGE_VERSION # include "mgconfig.h" -# undef PACKAGE -# undef VERSION -# undef PACKAGE_BUGREPORT -# undef PACKAGE_NAME -# undef PACKAGE_STRING -# undef PACKAGE_TARNAME -# undef PACKAGE_VERSION # endif #endif +#include +#include +#include +#include +#include +#include +#include + /** * \defgroup macros_types Macros and data types commonly used * @{ @@ -1898,8 +1899,6 @@ int init_minigui_printf (int (*output_char) (int ch), # define _DBG_PRINTF(fmt...) # endif #else /* __GNUC__ */ -#include -#include static inline void _ERR_PRINTF(const char* fmt, ...) { @@ -1966,8 +1965,6 @@ int start_minigui_pthread (int (* pth_entry) (int argc, const char* argv []), int argc, const char* argv[], char* stack_base, unsigned int stack_size); -#include - #ifndef ESRCH # define ESRCH 3 #endif diff --git a/src/gui/lf_manager.c b/src/gui/lf_manager.c index b685059f..469b5954 100644 --- a/src/gui/lf_manager.c +++ b/src/gui/lf_manager.c @@ -696,8 +696,8 @@ GetWindowElementPixelEx (HWND hwnd, HDC hdc, int we_attr_id) HDC dc; gal_pixel pixel; - if ((we_attr_id & WE_ATTR_TYPE_MASK)!=WE_ATTR_TYPE_COLOR) { - _MG_PRINTF ("GUI: Can't get color. ID is invalid.\n"); + if ((we_attr_id & WE_ATTR_TYPE_MASK) != WE_ATTR_TYPE_COLOR) { + _MG_PRINTF ("GUI: Can't get color; invalid attr id: %x.\n", we_attr_id); return -1; }