r18840 - gnucash/trunk/src/business/business-core - MSVC compatibility: Disable "C99 designated initializers" by a compiler-dependent macro

Christian Stimming cstim at code.gnucash.org
Fri Mar 5 14:57:04 EST 2010


Author: cstim
Date: 2010-03-05 14:57:04 -0500 (Fri, 05 Mar 2010)
New Revision: 18840
Trac: http://svn.gnucash.org/trac/changeset/18840

Modified:
   gnucash/trunk/src/business/business-core/gncAddress.c
   gnucash/trunk/src/business/business-core/gncBillTerm.c
   gnucash/trunk/src/business/business-core/gncBusiness.h
   gnucash/trunk/src/business/business-core/gncCustomer.c
   gnucash/trunk/src/business/business-core/gncEmployee.c
   gnucash/trunk/src/business/business-core/gncEntry.c
   gnucash/trunk/src/business/business-core/gncInvoice.c
   gnucash/trunk/src/business/business-core/gncJob.c
   gnucash/trunk/src/business/business-core/gncOrder.c
   gnucash/trunk/src/business/business-core/gncTaxTable.c
   gnucash/trunk/src/business/business-core/gncVendor.c
Log:
MSVC compatibility: Disable "C99 designated initializers" by a compiler-dependent macro

Same as r18755.

Modified: gnucash/trunk/src/business/business-core/gncAddress.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncAddress.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncAddress.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -457,17 +457,17 @@
 
 static QofObject GncAddressDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = GNC_ID_ADDRESS,
-    .type_label        = "Address",
-    .create            = (gpointer)qofAddressCreate,
-    .book_begin        = NULL,
-    .book_end          = NULL,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = NULL,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) GNC_ID_ADDRESS,
+    DI(.type_label        =) "Address",
+    DI(.create            =) (gpointer)qofAddressCreate,
+    DI(.book_begin        =) NULL,
+    DI(.book_end          =) NULL,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) NULL,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncAddressRegister (void)

Modified: gnucash/trunk/src/business/business-core/gncBillTerm.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncBillTerm.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncBillTerm.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -793,17 +793,17 @@
 
 static QofObject gncBillTermDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Billing Term",
-    .create            = (gpointer)gncBillTermCreate,
-    .book_begin        = _gncBillTermCreate,
-    .book_end          = _gncBillTermDestroy,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = NULL,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Billing Term",
+    DI(.create            =) (gpointer)gncBillTermCreate,
+    DI(.book_begin        =) _gncBillTermCreate,
+    DI(.book_end          =) _gncBillTermDestroy,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) NULL,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncBillTermRegister (void)

Modified: gnucash/trunk/src/business/business-core/gncBusiness.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncBusiness.h	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncBusiness.h	2010-03-05 19:57:04 UTC (rev 18840)
@@ -47,4 +47,14 @@
 #define GNC_TAXTABLE_MODULE_NAME GNC_ID_TAXTABLE
 #define GNC_VENDOR_MODULE_NAME   GNC_ID_VENDOR
 
+#ifndef DI
+# ifdef _MSC_VER
+/* MSVC compiler doesn't have C99 "designated initializers"
+ * so we wrap them in a macro that is empty on MSVC. */
+#  define DI(x) /* */
+# else
+#  define DI(x) x
+# endif
+#endif
+
 #endif /* GNC_BUSINESS_H_ */

Modified: gnucash/trunk/src/business/business-core/gncCustomer.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncCustomer.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncCustomer.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -715,17 +715,17 @@
 
 static QofObject gncCustomerDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Customer",
-    .create            = (gpointer)gncCustomerCreate,
-    .book_begin        = NULL,
-    .book_end          = NULL,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = (const char * (*)(gpointer))gncCustomerGetName,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Customer",
+    DI(.create            =) (gpointer)gncCustomerCreate,
+    DI(.book_begin        =) NULL,
+    DI(.book_end          =) NULL,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) (const char * (*)(gpointer))gncCustomerGetName,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncCustomerRegister (void)

Modified: gnucash/trunk/src/business/business-core/gncEmployee.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncEmployee.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncEmployee.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -544,17 +544,17 @@
 
 static QofObject gncEmployeeDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Employee",
-    .create            = (gpointer)gncEmployeeCreate,
-    .book_begin        = NULL,
-    .book_end          = NULL,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = _gncEmployeePrintable,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Employee",
+    DI(.create            =) (gpointer)gncEmployeeCreate,
+    DI(.book_begin        =) NULL,
+    DI(.book_end          =) NULL,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) _gncEmployeePrintable,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncEmployeeRegister (void)

Modified: gnucash/trunk/src/business/business-core/gncEntry.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncEntry.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncEntry.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -1341,17 +1341,17 @@
 
 static QofObject gncEntryDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Order/Invoice/Bill Entry",
-    .create            = (gpointer)gncEntryCreate,
-    .book_begin        = NULL,
-    .book_end          = NULL,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = NULL,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Order/Invoice/Bill Entry",
+    DI(.create            =) (gpointer)gncEntryCreate,
+    DI(.book_begin        =) NULL,
+    DI(.book_end          =) NULL,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) NULL,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncEntryRegister (void)

Modified: gnucash/trunk/src/business/business-core/gncInvoice.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncInvoice.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncInvoice.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -1829,17 +1829,17 @@
 
 static QofObject gncInvoiceDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Invoice",
-    .create            = (gpointer)gncInvoiceCreate,
-    .book_begin        = NULL,
-    .book_end          = NULL,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = _gncInvoicePrintable,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Invoice",
+    DI(.create            =) (gpointer)gncInvoiceCreate,
+    DI(.book_begin        =) NULL,
+    DI(.book_end          =) NULL,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) _gncInvoicePrintable,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 static void

Modified: gnucash/trunk/src/business/business-core/gncJob.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncJob.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncJob.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -455,17 +455,17 @@
 
 static QofObject gncJobDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Job",
-    .create            = (gpointer)gncJobCreate,
-    .book_begin        = NULL,
-    .book_end          = NULL,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = _gncJobPrintable,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Job",
+    DI(.create            =) (gpointer)gncJobCreate,
+    DI(.book_begin        =) NULL,
+    DI(.book_end          =) NULL,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) _gncJobPrintable,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncJobRegister (void)

Modified: gnucash/trunk/src/business/business-core/gncOrder.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncOrder.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncOrder.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -502,17 +502,17 @@
 
 static QofObject gncOrderDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Order",
-    .create            = (gpointer)gncOrderCreate,
-    .book_begin        = NULL,
-    .book_end          = NULL,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = _gncOrderPrintable,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Order",
+    DI(.create            =) (gpointer)gncOrderCreate,
+    DI(.book_begin        =) NULL,
+    DI(.book_end          =) NULL,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) _gncOrderPrintable,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncOrderRegister (void)

Modified: gnucash/trunk/src/business/business-core/gncTaxTable.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncTaxTable.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncTaxTable.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -890,17 +890,17 @@
 
 static QofObject gncTaxTableDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Tax Table",
-    .create            = (gpointer)gncTaxTableCreate,
-    .book_begin        = _gncTaxTableCreate,
-    .book_end          = _gncTaxTableDestroy,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = NULL,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Tax Table",
+    DI(.create            =) (gpointer)gncTaxTableCreate,
+    DI(.book_begin        =) _gncTaxTableCreate,
+    DI(.book_end          =) _gncTaxTableDestroy,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) NULL,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncTaxTableRegister (void)

Modified: gnucash/trunk/src/business/business-core/gncVendor.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncVendor.c	2010-03-05 19:56:43 UTC (rev 18839)
+++ gnucash/trunk/src/business/business-core/gncVendor.c	2010-03-05 19:57:04 UTC (rev 18840)
@@ -653,17 +653,17 @@
 
 static QofObject gncVendorDesc =
 {
-    .interface_version = QOF_OBJECT_VERSION,
-    .e_type            = _GNC_MOD_NAME,
-    .type_label        = "Vendor",
-    .create            = (gpointer)gncVendorCreate,
-    .book_begin        = NULL,
-    .book_end          = NULL,
-    .is_dirty          = qof_collection_is_dirty,
-    .mark_clean        = qof_collection_mark_clean,
-    .foreach           = qof_collection_foreach,
-    .printable         = _gncVendorPrintable,
-    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    DI(.interface_version =) QOF_OBJECT_VERSION,
+    DI(.e_type            =) _GNC_MOD_NAME,
+    DI(.type_label        =) "Vendor",
+    DI(.create            =) (gpointer)gncVendorCreate,
+    DI(.book_begin        =) NULL,
+    DI(.book_end          =) NULL,
+    DI(.is_dirty          =) qof_collection_is_dirty,
+    DI(.mark_clean        =) qof_collection_mark_clean,
+    DI(.foreach           =) qof_collection_foreach,
+    DI(.printable         =) _gncVendorPrintable,
+    DI(.version_cmp       =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncVendorRegister (void)



More information about the gnucash-changes mailing list