[patch 08/15] [trace.diff] Swallow the semicolon on tracing macros

c.shoemaker at cox.net c.shoemaker at cox.net
Mon Oct 10 10:34:30 EDT 2005


 * src/engine/gnc-trace.h                                 |   50 +++++++++--------
    - swallow the semicolon on the tracing macros

 * src/business/business-core/file/gnc-bill-term-xml-v2.c |    2 
 * src/business/business-core/file/gnc-tax-table-xml-v2.c |    2 
 * src/engine/Scrub.c                                     |    2 
 * src/engine/gnc-hooks.c                                 |    2 
    - make tracing macros end in semicolon

 src/business/business-core/file/gnc-bill-term-xml-v2.c |    2 
 src/business/business-core/file/gnc-tax-table-xml-v2.c |    2 
 src/engine/Scrub.c                                     |    2 
 src/engine/gnc-hooks.c                                 |    2 
 src/engine/gnc-trace.h                                 |   50 +++++++++--------
 src/import-export/import-backend.c                     |    4 -
 6 files changed, 33 insertions(+), 29 deletions(-)

Index: gnucash/src/business/business-core/file/gnc-bill-term-xml-v2.c
===================================================================
--- gnucash.orig/src/business/business-core/file/gnc-bill-term-xml-v2.c
+++ gnucash/src/business/business-core/file/gnc-bill-term-xml-v2.c
@@ -657,7 +657,7 @@ billterm_reset_refcount (gpointer key, g
   if (count != gncBillTermGetRefcount(term) && !gncBillTermGetInvisible(term)) {
     PWARN("Fixing refcount on billterm %s (%" G_GINT64_FORMAT " -> %d)\n",
 	  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))),
-	  gncBillTermGetRefcount(term), count)
+	  gncBillTermGetRefcount(term), count);
       gncBillTermSetRefcount(term, count);
   }
 }
Index: gnucash/src/business/business-core/file/gnc-tax-table-xml-v2.c
===================================================================
--- gnucash.orig/src/business/business-core/file/gnc-tax-table-xml-v2.c
+++ gnucash/src/business/business-core/file/gnc-tax-table-xml-v2.c
@@ -618,7 +618,7 @@ taxtable_reset_refcount (gpointer key, g
   if (count != gncTaxTableGetRefcount(table) && !gncTaxTableGetInvisible(table)) {
     PWARN("Fixing refcount on taxtable %s (%" G_GINT64_FORMAT " -> %d)\n",
 	  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(table))),
-	  gncTaxTableGetRefcount(table), count)
+	  gncTaxTableGetRefcount(table), count);
       gncTaxTableSetRefcount(table, count);
   }
 }
Index: gnucash/src/engine/Scrub.c
===================================================================
--- gnucash.orig/src/engine/Scrub.c
+++ gnucash/src/engine/Scrub.c
@@ -823,7 +823,7 @@ xaccGroupScrubQuoteSources (AccountGroup
   ENTER(" ");
 
   if (!group || !table) {
-    LEAVE("Oops")
+    LEAVE("Oops");
     return;
   }
 
Index: gnucash/src/engine/gnc-hooks.c
===================================================================
--- gnucash.orig/src/engine/gnc-hooks.c
+++ gnucash/src/engine/gnc-hooks.c
@@ -56,7 +56,7 @@ gnc_hook_create (const gchar *name, gint
   g_return_val_if_fail(num_args <= 1, NULL);
   g_return_val_if_fail(desc != NULL, NULL);
 
-  ENTER("name %s", name)
+  ENTER("name %s", name);
   if (gnc_hooks_list == NULL) {
     gnc_hooks_list = g_hash_table_new(g_str_hash, g_str_equal);
 
Index: gnucash/src/engine/gnc-trace.h
===================================================================
--- gnucash.orig/src/engine/gnc-trace.h
+++ gnucash/src/engine/gnc-trace.h
@@ -141,47 +141,47 @@ gint qof_log_module_count(void);
  */
 
 /** Log an fatal error */
-#define FATAL(format, args...) {                     \
+#define FATAL(format, args...) do {                  \
     g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR,          \
       "Fatal Error: %s(): " format, FUNK , ## args); \
-}
+} while (0)
 
 /** Log an serious error */
-#define PERR(format, args...) {                    \
+#define PERR(format, args...) do {                     \
   if (gnc_should_log (log_module, GNC_LOG_ERROR)) {    \
     g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,     \
       "Error: %s(): " format, FUNK , ## args);     \
   }                                                \
-}
+} while (0)
 
 /** Log an warning */
-#define PWARN(format, args...) {                   \
+#define PWARN(format, args...) do {                    \
   if (gnc_should_log (log_module, GNC_LOG_WARNING)) {  \
     g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,      \
       "Warning: %s(): " format, FUNK , ## args);   \
   }                                                \
-}
+} while (0)
 
 /** Print an informational note */
-#define PINFO(format, args...) {                   \
+#define PINFO(format, args...) do {                    \
   if (gnc_should_log (log_module, GNC_LOG_INFO)) {     \
     g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO,         \
       "Info: %s(): " format,                       \
       FUNK , ## args);                             \
   }                                                \
-}
+} while (0)
 
 /** Print an debugging message */
-#define DEBUG(format, args...) {                   \
+#define DEBUG(format, args...) do {                    \
   if (gnc_should_log (log_module, GNC_LOG_DEBUG)) {    \
     g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,        \
       "Debug: %s(): " format,                      \
       FUNK , ## args);                             \
   }                                                \
-}
+} while (0)
 
 /** Print an function entry debugging message */
-#define ENTER(format, args...) {                   \
+#define ENTER(format, args...) do {                \
   extern gint gnc_trace_num_spaces;                \
   if (gnc_should_log (log_module, GNC_LOG_DEBUG)) {    \
     g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,        \
@@ -189,10 +189,10 @@ gint qof_log_module_count(void);
       FUNK , ## args);                             \
     gnc_trace_num_spaces += GNC_TRACE_INDENT_WIDTH;\
   }                                                \
-}
+} while (0)
 
 /** Print an function exit debugging message */
-#define LEAVE(format, args...) {                   \
+#define LEAVE(format, args...) do {                \
   extern gint gnc_trace_num_spaces;                \
   if (gnc_should_log (log_module, GNC_LOG_DEBUG)) {    \
     gnc_trace_num_spaces -= GNC_TRACE_INDENT_WIDTH;\
@@ -200,17 +200,21 @@ gint qof_log_module_count(void);
       "Leave: %s()" format,                        \
       FUNK , ## args);                             \
   }                                                \
-}
+} while (0)
 
 /** Print an function trace debugging message */
-#define TRACE(format, args...) {                   \
+#define TRACE(format, args...) do {                    \
   if (gnc_should_log (log_module, GNC_LOG_TRACE)) {    \
     g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,        \
       "Trace: %s(): " format, FUNK , ## args);     \
   }                                                \
-}
+} while (0)
 
-#define DEBUGCMD(x) { if (gnc_should_log (log_module, GNC_LOG_DEBUG)) { (x); }}
+#define DEBUGCMD(x) do {                            \
+  if (gnc_should_log (log_module, GNC_LOG_DEBUG)) { \
+      (x);                                          \
+  }                                                 \
+} while (0)
 
 /* -------------------------------------------------------- */
 /** Infrastructure to make timing measurements for critical peices 
@@ -233,25 +237,25 @@ void gnc_report_clock_total (int clockno
                              const char *format, ...);
 
 /** start a particular timer */
-#define START_CLOCK(clockno,format, args...) {              \
+#define START_CLOCK(clockno,format, args...) do {               \
   if (gnc_should_log (log_module, GNC_LOG_INFO))                \
     gnc_start_clock (clockno, log_module, GNC_LOG_INFO,         \
              __FUNCTION__, format , ## args);               \
-}
+} while (0)
 
 /** report elapsed time since last report on a particular timer */
-#define REPORT_CLOCK(clockno,format, args...) {             \
+#define REPORT_CLOCK(clockno,format, args...) do {              \
   if (gnc_should_log (log_module, GNC_LOG_INFO))                \
     gnc_report_clock (clockno, log_module, GNC_LOG_INFO,        \
              __FUNCTION__, format , ## args);               \
-}
+} while (0)
 
 /** report total elapsed time since timer started */
-#define REPORT_CLOCK_TOTAL(clockno,format, args...) {       \
+#define REPORT_CLOCK_TOTAL(clockno,format, args...) do {        \
   if (gnc_should_log (log_module, GNC_LOG_INFO))                \
     gnc_report_clock_total (clockno, log_module, GNC_LOG_INFO,  \
              __FUNCTION__, format , ## args);               \
-}
+} while (0)
 
 #endif /* GNC_TRACE_H */
 /* @} */
Index: gnucash/src/import-export/import-backend.c
===================================================================
--- gnucash.orig/src/import-export/import-backend.c
+++ gnucash/src/import-export/import-backend.c
@@ -898,7 +898,7 @@ gnc_import_process_trans_clist (GtkCList
 	  if(gnc_import_MatchInfo_get_split 
 	     (gnc_import_TransInfo_get_selected_match (trans_info)) ==NULL)
 	    {
-	      PERR("The split I am trying to reconcile is NULL, shouldn't happen!")
+                PERR("The split I am trying to reconcile is NULL, shouldn't happen!");
 	    }
 	  else
 	    {
@@ -939,7 +939,7 @@ gnc_import_process_trans_clist (GtkCList
 	    }
 	  break;
 	case GNCImport_EDIT:
-	    PERR("EDIT action is UNSUPPORTED!")
+	    PERR("EDIT action is UNSUPPORTED!");
 	  break;
 	default:
 	  DEBUG("Invalid GNCImportAction for this imported transaction.");

--


More information about the gnucash-devel mailing list