Author: cazfi Date: Tue Feb 10 18:46:49 2015 New Revision: 28075 URL: http://svn.gna.org/viewcvs/freeciv?rev=28075&view=rev Log: Use new public FREECIV_NDEBUG instead of NDEBUG for controlling freeciv specific debugging facilities
See patch #5795 Modified: trunk/ai/default/aicity.c trunk/ai/default/aiguard.h trunk/client/client_main.c trunk/doc/HACKING trunk/gen_headers/freeciv_config.h.in trunk/m4/debug.m4 trunk/server/civserver.c trunk/server/sanitycheck.h trunk/server/srv_main.c trunk/server/techtools.c trunk/tools/civmanual.c trunk/tools/ruledit/ruledit.cpp trunk/utility/log.h Modified: trunk/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/ai/default/aicity.c (original) +++ trunk/ai/default/aicity.c Tue Feb 10 18:46:49 2015 @@ -108,9 +108,9 @@ (pcity->surplus[O_SHIELD] < 0 || city_unhappy(pcity) \ || pcity->food_stock + pcity->surplus[O_FOOD] < 0) -#ifdef NDEBUG +#ifdef FREECIV_NDEBUG #define ASSERT_CHOICE(c) /* Do nothing. */ -#else +#else /* FREECIV_NDEBUG */ #define ASSERT_CHOICE(c) \ do { \ if ((c).want > 0) { \ @@ -124,7 +124,7 @@ } \ } \ } while(FALSE); -#endif /* NDEBUG */ +#endif /* FREECIV_NDEBUG */ static void dai_sell_obsolete_buildings(struct city *pcity); static void resolve_city_emergency(struct ai_type *ait, struct player *pplayer, Modified: trunk/ai/default/aiguard.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiguard.h?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/ai/default/aiguard.h (original) +++ trunk/ai/default/aiguard.h Tue Feb 10 18:46:49 2015 @@ -17,13 +17,13 @@ #include "fc_types.h" -#ifndef NDEBUG +#ifndef FREECIV_NDEBUG #define CHECK_GUARD(ait, guard) aiguard_check_guard(ait, guard) #define CHECK_CHARGE_UNIT(ait, charge) aiguard_check_charge_unit(ait, charge) -#else +#else /* FREECIV_NDEBUG */ #define CHECK_GUARD(ait, guard) (void)0 #define CHECK_CHARGE_UNIT(ait, charge) (void)0 -#endif +#endif /* FREECIV_NDEBUG */ void aiguard_check_guard(struct ai_type *ait, const struct unit *guard); void aiguard_check_charge_unit(struct ai_type *ait, const struct unit *charge); Modified: trunk/client/client_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/client_main.c?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/client/client_main.c (original) +++ trunk/client/client_main.c Tue Feb 10 18:46:49 2015 @@ -319,13 +319,13 @@ /* Load win32 post-crash debugger */ #ifdef WIN32_NATIVE -# ifndef NDEBUG +# ifndef FREECIV_NDEBUG if (LoadLibrary("exchndl.dll") == NULL) { -# ifdef DEBUG +# ifdef FREECIV_DEBUG fprintf(stderr, "exchndl.dll could not be loaded, no crash debugger\n"); -# endif /* DEBUG */ - } -# endif /* NDEBUG */ +# endif /* FREECIV_DEBUG */ + } +# endif /* FREECIV_NDEBUG */ #endif /* WIN32_NATIVE */ i_am_client(); /* Tell to libfreeciv that we are client */ @@ -373,26 +373,26 @@ "(IPv4/IPv6/none)")); cmdhelp_add(help, "a", "autoconnect", _("Skip connect dialog")); -#ifdef DEBUG +#ifdef FREECIV_DEBUG cmdhelp_add(help, "d", /* TRANS: "debug" is exactly what user must type, do not translate. */ _("debug NUM"), _("Set debug log level (%d to %d, or " "%d:file1,min,max:...)"), LOG_FATAL, LOG_DEBUG, LOG_DEBUG); -#else +#else /* FREECIV_DEBUG */ cmdhelp_add(help, "d", /* TRANS: "debug" is exactly what user must type, do not translate. */ _("debug NUM"), _("Set debug log level (%d to %d)"), LOG_FATAL, LOG_VERBOSE); -#endif /* DEBUG */ -#ifndef NDEBUG +#endif /* FREECIV_DEBUG */ +#ifndef FREECIV_NDEBUG cmdhelp_add(help, "F", /* TRANS: "Fatal" is exactly what user must type, do not translate. */ _("Fatal [SIGNAL]"), _("Raise a signal on failed assertion")); -#endif /* NDEBUG */ +#endif /* FREECIV_NDEBUG */ cmdhelp_add(help, "f", /* TRANS: "file" is exactly what user must type, do not translate. */ _("file FILE"), @@ -456,13 +456,13 @@ } else if (is_option("--version", argv[i])) { fc_fprintf(stderr, "%s %s\n", freeciv_name_version(), client_string); exit(EXIT_SUCCESS); -#ifdef DEBUG +#ifdef FREECIV_DEBUG } else if (is_option("--Hackless", argv[i])) { hackless = TRUE; -#endif /* DEBUG */ +#endif /* FREECIV_DEBUG */ } else if ((option = get_option_malloc("--log", argv, &i, argc))) { logfile = option; /* never free()d */ -#ifndef NDEBUG +#ifndef FREECIV_NDEBUG } else if (is_option("--Fatal", argv[i])) { if (i + 1 >= argc || '-' == argv[i + 1][0]) { fatal_assertions = SIGABRT; @@ -474,7 +474,7 @@ fc_fprintf(stderr, _("Try using --help.\n")); exit(EXIT_FAILURE); } -#endif /* NDEBUG */ +#endif /* FREECIV_NDEBUG */ } else if ((option = get_option_malloc("--read", argv, &i, argc))) { scriptfile = option; /* never free()d */ } else if ((option = get_option_malloc("--file", argv, &i, argc))) { Modified: trunk/doc/HACKING URL: http://svn.gna.org/viewcvs/freeciv/trunk/doc/HACKING?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/doc/HACKING (original) +++ trunk/doc/HACKING Tue Feb 10 18:46:49 2015 @@ -1204,10 +1204,10 @@ '--enable-debug=no/some/yes/checks' to the configure script. The different options have the following meaning: - no: no debugging enabled(NDEBUG is defined) + no: no debugging enabled(FREECIV_NDEBUG and NDEBUG are defined) additional compiler flags for optimisation (-O3 -fomit-frame-pointer) - some: default build (neither NDEBUG nor DEBUG is defined) - yes: debugging enable (DEBUG is defined) + some: default build (neither FREECIV_NDEBUG nor FREECIV_DEBUG is defined) + yes: debugging enable (FREECIV_DEBUG is defined) debugging log level available (4, log_debug()) additional compiler flags: -Werror -Wmissing-prototypes -Wmissing-declarations Modified: trunk/gen_headers/freeciv_config.h.in URL: http://svn.gna.org/viewcvs/freeciv/trunk/gen_headers/freeciv_config.h.in?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/gen_headers/freeciv_config.h.in (original) +++ trunk/gen_headers/freeciv_config.h.in Tue Feb 10 18:46:49 2015 @@ -50,4 +50,7 @@ /* Extra debugging support */ #undef FREECIV_DEBUG +/* No freeciv specific debugging support at all */ +#undef FREECIV_NDEBUG + #endif /* FC__FREECIV_CONFIG_H */ Modified: trunk/m4/debug.m4 URL: http://svn.gna.org/viewcvs/freeciv/trunk/m4/debug.m4?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/m4/debug.m4 (original) +++ trunk/m4/debug.m4 Tue Feb 10 18:46:49 2015 @@ -15,6 +15,7 @@ dnl debug level == no if test "x$enable_debug" = "xno"; then AC_DEFINE([NDEBUG], [1], [No debugging support at all]) + AC_DEFINE([FREECIV_NDEBUG], [1], [No freeciv specific debugging support at all]) FC_C_FLAGS([-O3 -fomit-frame-pointer], [], [EXTRA_DEBUG_CFLAGS]) if test "x$cxx_works" = "xyes" ; then FC_CXX_FLAGS([-O3 -fomit-frame-pointer], [], [EXTRA_DEBUG_CXXFLAGS]) Modified: trunk/server/civserver.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/civserver.c?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/server/civserver.c (original) +++ trunk/server/civserver.c Tue Feb 10 18:46:49 2015 @@ -139,14 +139,14 @@ /* Load win32 post-crash debugger */ #ifdef WIN32_NATIVE -# ifndef NDEBUG +# ifndef FREECIV_NDEBUG if (LoadLibrary("exchndl.dll") == NULL) { -# ifdef DEBUG +# ifdef FREECIV_DEBUG fprintf(stderr, "exchndl.dll could not be loaded, no crash debugger\n"); -# endif - } -# endif -#endif +# endif /* FREECIV_DEBUG */ + } +# endif /* FREECIV_NDEBUG */ +#endif /* WIN32_NATIVE */ #ifdef USE_INTERRUPT_HANDLERS if (SIG_ERR == signal(SIGINT, signal_handler)) { @@ -205,7 +205,7 @@ break; } else if ((option = get_option_malloc("--log", argv, &inx, argc))) { srvarg.log_filename = option; /* Never freed. */ -#ifndef NDEBUG +#ifndef FREECIV_NDEBUG } else if (is_option("--Fatal", argv[inx])) { if (inx + 1 >= argc || '-' == argv[inx + 1][0]) { srvarg.fatal_assertions = SIGABRT; @@ -217,7 +217,7 @@ inx++; showhelp = TRUE; } -#endif /* NDEBUG */ +#endif /* FREECIV_NDEBUG */ } else if ((option = get_option_malloc("--Ranklog", argv, &inx, argc))) { srvarg.ranklog_filename = option; /* Never freed. */ } else if (is_option("--nometa", argv[inx])) { @@ -350,24 +350,24 @@ _("Listen for clients on ADDR")); cmdhelp_add(help, "B", "Bind-meta ADDR", _("Connect to metaserver from this address")); -#ifdef DEBUG +#ifdef FREECIV_DEBUG cmdhelp_add(help, "d", /* TRANS: "debug" is exactly what user must type, do not translate. */ _("debug NUM"), _("Set debug log level (%d to %d, or %d:file1,min,max:...)"), LOG_FATAL, LOG_DEBUG, LOG_DEBUG); -#else /* DEBUG */ +#else /* FREECIV_DEBUG */ cmdhelp_add(help, "d", /* TRANS: "debug" is exactly what user must type, do not translate. */ _("debug NUM"), _("Set debug log level (%d to %d)"), LOG_FATAL, LOG_VERBOSE); -#endif /* DEBUG */ -#ifndef NDEBUG +#endif /* FREECIV_DEBUG */ +#ifndef FREECIV_NDEBUG cmdhelp_add(help, "F", /* TRANS: "Fatal" is exactly what user must type, do not translate. */ _("Fatal [SIGNAL]"), _("Raise a signal on failed assertion")); -#endif +#endif /* FREECIV_NDEBUG */ cmdhelp_add(help, "f", /* TRANS: "file" is exactly what user must type, do not translate. */ _("file FILE"), Modified: trunk/server/sanitycheck.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/sanitycheck.h?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/server/sanitycheck.h (original) +++ trunk/server/sanitycheck.h Tue Feb 10 18:46:49 2015 @@ -15,7 +15,7 @@ #include "fc_types.h" -#if ((IS_BETA_VERSION || IS_DEVEL_VERSION) && !defined NDEBUG) \ +#if ((IS_BETA_VERSION || IS_DEVEL_VERSION) && !defined(FREECIV_NDEBUG)) \ || defined(FREECIV_DEBUG) # define SANITY_CHECKING #endif Modified: trunk/server/srv_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/server/srv_main.c (original) +++ trunk/server/srv_main.c Tue Feb 10 18:46:49 2015 @@ -2814,9 +2814,9 @@ /* Restore the settings. */ for (i = 0; i < ARRAY_SIZE(mapgen_settings); i++) { struct setting *pset = setting_by_name(mapgen_settings[i].name); -#ifdef NDEBUG +#ifdef FREECIV_NDEBUG setting_enum_set(pset, mapgen_settings[i].value, NULL, NULL, 0); -#else +#else /* FREECIV_NDEBUG */ char error[128]; bool success; @@ -2827,7 +2827,7 @@ "Failed to restore '%s': %s", mapgen_settings[i].name, error); -#endif +#endif /* FREECIV_NDEBUG */ } map_allocate(); /* NOT map_init() as that would overwrite settings */ } Modified: trunk/server/techtools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/techtools.c?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/server/techtools.c (original) +++ trunk/server/techtools.c Tue Feb 10 18:46:49 2015 @@ -314,12 +314,12 @@ struct advance *vap = valid_advance_by_number(tech_found); struct city *pcity; -#ifndef NDEBUG +#ifndef FREECIV_NDEBUG if (!is_future_tech(tech_found)) { fc_assert(NULL != vap); fc_assert(TECH_KNOWN != research_invention_state(presearch, tech_found)); } -#endif +#endif /* FREECIV_NDEBUG */ was_first = (!game.info.global_advances[tech_found]); /* Assign 'advance_name' before we increase the future tech counter. */ @@ -1144,13 +1144,13 @@ fc_assert(stolen_tech != A_NONE); } } else { /* preferred != A_UNSET */ -#ifndef NDEBUG +#ifndef FREECIV_NDEBUG if (!is_future_tech(preferred)) { fc_assert(NULL != valid_advance_by_number(preferred)); fc_assert(TECH_KNOWN == research_invention_state(vresearch, preferred)); } -#endif +#endif /* FREECIV_NDEBUG */ stolen_tech = preferred; } Modified: trunk/tools/civmanual.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/civmanual.c?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/tools/civmanual.c (original) +++ trunk/tools/civmanual.c Tue Feb 10 18:46:49 2015 @@ -528,7 +528,7 @@ showvers = TRUE; } else if ((option = get_option_malloc("--log", argv, &inx, argc))) { srvarg.log_filename = option; /* Never freed. */ -#ifndef NDEBUG +#ifndef FREECIV_NDEBUG } else if (is_option("--Fatal", argv[inx])) { if (inx + 1 >= argc || '-' == argv[inx + 1][0]) { srvarg.fatal_assertions = SIGABRT; @@ -540,7 +540,7 @@ inx++; showhelp = TRUE; } -#endif /* NDEBUG */ +#endif /* FREECIV_NDEBUG */ } else if ((option = get_option_malloc("--debug", argv, &inx, argc))) { if (!log_parse_level_str(option, &srvarg.loglevel)) { showhelp = TRUE; @@ -593,12 +593,12 @@ _("Set debug log level (%d to %d)"), LOG_FATAL, LOG_VERBOSE); #endif /* DEBUG */ -#ifndef NDEBUG +#ifndef FREECIV_NDEBUG cmdhelp_add(help, "F", /* TRANS: "Fatal" is exactly what user must type, do not translate. */ _("Fatal [SIGNAL]"), _("Raise a signal on failed assertion")); -#endif /* NDEBUG */ +#endif /* FREECIV_NDEBUG */ cmdhelp_add(help, "h", "help", _("Print a summary of the options")); cmdhelp_add(help, "l", Modified: trunk/tools/ruledit/ruledit.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/ruledit.cpp?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/tools/ruledit/ruledit.cpp (original) +++ trunk/tools/ruledit/ruledit.cpp Tue Feb 10 18:46:49 2015 @@ -49,13 +49,13 @@ /* Load win32 post-crash debugger */ #ifdef WIN32_NATIVE -# ifndef NDEBUG +# ifndef FREECIV_NDEBUG if (LoadLibrary("exchndl.dll") == NULL) { -# ifdef DEBUG +# ifdef FREECIV_DEBUG fprintf(stderr, "exchndl.dll could not be loaded, no crash debugger\n"); -# endif /* DEBUG */ +# endif /* FREECIV_DEBUG */ } -# endif /* NDEBUG */ +# endif /* FREECIV_NDEBUG */ #endif /* WIN32_NATIVE */ init_nls(); Modified: trunk/utility/log.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/log.h?rev=28075&r1=28074&r2=28075&view=diff ============================================================================== --- trunk/utility/log.h (original) +++ trunk/utility/log.h Tue Feb 10 18:46:49 2015 @@ -117,14 +117,14 @@ /* Assertions. */ void fc_assert_set_fatal(int fatal_assertions); -#ifdef NDEBUG +#ifdef FREECIV_NDEBUG /* Disable the assertion failures, but not the tests! */ #define fc_assert_fail(...) (void) 0 #else void fc_assert_fail(const char *file, const char *function, int line, const char *assertion, const char *message, ...) fc__attribute((__format__ (__printf__, 5, 6))); -#endif /* NDEBUG */ +#endif /* FREECIV_NDEBUG */ #define fc_assert_full(file, function, line, \ condition, action, message, ...) \ @@ -135,7 +135,7 @@ } \ (void) 0 /* Force the usage of ';' at the end of the call. */ -#ifdef NDEBUG +#ifdef FREECIV_NDEBUG /* Disabled. */ #define fc_assert(...) (void) 0 #define fc_assert_msg(...) (void) 0 @@ -150,7 +150,7 @@ ((condition) ? (void) 0 \ : fc_assert_fail(__FILE__, __FUNCTION__, __FC_LINE__, \ #condition, message, ## __VA_ARGS__)) -#endif /* NDEBUG */ +#endif /* FREECIV_NDEBUG */ /* Do action on failure. */ #define fc_assert_action(condition, action) \ _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits