Hi, When using macros with variable numbers of arguments with GCC 2.95, as in the file gnc-trace.h, one should put space before the comma that's before ## args, or never use it with zero arguments. E.g.:
#define PINFO(format, args...) { \ if (gnc_should_log (module, GNC_LOG_INFO)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ - "Info: %s(): " format, FUNK, ## args); \ + "Info: %s(): " format, FUNK , ## args); \ } \ } That's because when args is empty, ## makes cpp removes the preceding sequence of non-whitespace characters, not the previous the previous preprocessor token. I discovered this because engine-helpers.c uses PINFO (and possibly other similar macros) with only one argument, several times. A full patch for gnc-trace.h is attached. -- Lionel
Index: gnc-trace.h =================================================================== RCS file: /home/cvs/cvsroot/gnucash/src/engine/gnc-trace.h,v retrieving revision 1.8 diff -u -r1.8 gnc-trace.h --- gnc-trace.h 19 Oct 2003 15:47:26 -0000 1.8 +++ gnc-trace.h 19 Dec 2003 11:10:10 -0000 @@ -123,55 +123,55 @@ #define FATAL(format, args...) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, \ - "Fatal Error: %s(): " format, FUNK, ## args); \ + "Fatal Error: %s(): " format, FUNK , ## args); \ } #define PERR(format, args...) { \ if (gnc_should_log (module, GNC_LOG_ERROR)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \ - "Error: %s(): " format, FUNK, ## args); \ + "Error: %s(): " format, FUNK , ## args); \ } \ } #define PWARN(format, args...) { \ if (gnc_should_log (module, GNC_LOG_WARNING)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, \ - "Warning: %s(): " format, FUNK, ## args); \ + "Warning: %s(): " format, FUNK , ## args); \ } \ } #define PINFO(format, args...) { \ if (gnc_should_log (module, GNC_LOG_INFO)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, \ - "Info: %s(): " format, FUNK, ## args); \ + "Info: %s(): " format, FUNK , ## args); \ } \ } #define DEBUG(format, args...) { \ if (gnc_should_log (module, GNC_LOG_DEBUG)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "Debug: %s(): " format, FUNK, ## args); \ + "Debug: %s(): " format, FUNK , ## args); \ } \ } #define ENTER(format, args...) { \ if (gnc_should_log (module, GNC_LOG_DEBUG)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "Enter: %s" format, FUNK, ## args); \ + "Enter: %s" format, FUNK , ## args); \ } \ } #define LEAVE(format, args...) { \ if (gnc_should_log (module, GNC_LOG_DEBUG)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "Leave: %s" format, FUNK, ## args); \ + "Leave: %s" format, FUNK , ## args); \ } \ } #define TRACE(format, args...) { \ if (gnc_should_log (module, GNC_LOG_TRACE)) { \ g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \ - "Trace: %s(): " format, FUNK, ## args); \ + "Trace: %s(): " format, FUNK , ## args); \ } \ } @@ -200,19 +200,19 @@ #define START_CLOCK(clockno,format, args...) { \ if (gnc_should_log (module, GNC_LOG_INFO)) \ gnc_start_clock (clockno, module, GNC_LOG_INFO, \ - __FUNCTION__, format, ## args); \ + __FUNCTION__, format , ## args); \ } #define REPORT_CLOCK(clockno,format, args...) { \ if (gnc_should_log (module, GNC_LOG_INFO)) \ gnc_report_clock (clockno, module, GNC_LOG_INFO, \ - __FUNCTION__, format, ## args); \ + __FUNCTION__, format , ## args); \ } #define REPORT_CLOCK_TOTAL(clockno,format, args...) { \ if (gnc_should_log (module, GNC_LOG_INFO)) \ gnc_report_clock_total (clockno, module, GNC_LOG_INFO, \ - __FUNCTION__, format, ## args); \ + __FUNCTION__, format , ## args); \ } #endif /* GNC_TRACE_H */
signature.asc
Description: Digital signature
_______________________________________________ gnucash-devel mailing list [EMAIL PROTECTED] http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel