mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-29 12:14:31 -06:00
MSVC compatibility: Microsoft doesn't have C99 "designated initializers".
Those were introduced in r17724, bug#539957, but apparently this C99 is not supported by MSVC and won't be for some time to come. Hence, for MSVC we need the workaround to define a macro that will shadow the member names. However, the initialization itself works fine and non-MSVC code is unchanged, so I think we can live with that. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18755 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
9d6160cfd4
commit
1ddcb88d0c
@ -4674,19 +4674,25 @@ xaccAccountForEachTransaction(const Account *acc, TransactionCallback proc,
|
||||
|
||||
/* ================================================================ */
|
||||
/* QofObject function implementation and registration */
|
||||
|
||||
#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
|
||||
static QofObject account_object_def = {
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_ACCOUNT,
|
||||
.type_label = "Account",
|
||||
.create = (gpointer)xaccMallocAccount,
|
||||
.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)) xaccAccountGetName,
|
||||
.version_cmp = (int (*)(gpointer,gpointer)) qof_instance_version_cmp,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_ACCOUNT,
|
||||
DI(.type_label =) "Account",
|
||||
DI(.create =) (gpointer)xaccMallocAccount,
|
||||
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)) xaccAccountGetName,
|
||||
DI(.version_cmp =) (int (*)(gpointer,gpointer)) qof_instance_version_cmp,
|
||||
};
|
||||
|
||||
gboolean xaccAccountRegister (void)
|
||||
|
@ -161,17 +161,24 @@ sxtg_mark_clean(QofCollection *col)
|
||||
g_list_free(descendants);
|
||||
}
|
||||
|
||||
#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
|
||||
static QofObject sxtg_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_SXTG,
|
||||
.type_label = "Scheduled Transaction Templates",
|
||||
.book_begin = sxtg_book_begin,
|
||||
.book_end = sxtg_book_end,
|
||||
.is_dirty = sxtg_is_dirty,
|
||||
.mark_clean = sxtg_mark_clean,
|
||||
.foreach = NULL,
|
||||
.printable = NULL,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_SXTG,
|
||||
DI(.type_label =) "Scheduled Transaction Templates",
|
||||
DI(.book_begin =) sxtg_book_begin,
|
||||
DI(.book_end =) sxtg_book_end,
|
||||
DI(.is_dirty =) sxtg_is_dirty,
|
||||
DI(.mark_clean =) sxtg_mark_clean,
|
||||
DI(.foreach =) NULL,
|
||||
DI(.printable =) NULL,
|
||||
};
|
||||
|
||||
/* ====================================================================== */
|
||||
@ -307,32 +314,32 @@ book_sxlist_notsaved(const QofCollection *col)
|
||||
|
||||
static QofObject sxes_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_SXES,
|
||||
.type_label = "Scheduled Transactions List",
|
||||
.create = NULL,
|
||||
.book_begin = book_sxes_setup,
|
||||
.book_end = book_sxes_end,
|
||||
.is_dirty = book_sxlist_notsaved,
|
||||
.mark_clean = book_sxns_mark_saved,
|
||||
.foreach = NULL,
|
||||
.printable = NULL,
|
||||
.version_cmp = NULL
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_SXES,
|
||||
DI(.type_label =) "Scheduled Transactions List",
|
||||
DI(.create =) NULL,
|
||||
DI(.book_begin =) book_sxes_setup,
|
||||
DI(.book_end =) book_sxes_end,
|
||||
DI(.is_dirty =) book_sxlist_notsaved,
|
||||
DI(.mark_clean =) book_sxns_mark_saved,
|
||||
DI(.foreach =) NULL,
|
||||
DI(.printable =) NULL,
|
||||
DI(.version_cmp =) NULL
|
||||
};
|
||||
|
||||
static QofObject sxtt_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_SXTT,
|
||||
.type_label = "Scheduled Transaction Templates",
|
||||
.create = NULL,
|
||||
.book_begin = NULL,
|
||||
.book_end = NULL,
|
||||
.is_dirty = NULL,
|
||||
.mark_clean = NULL,
|
||||
.foreach = NULL,
|
||||
.printable = NULL,
|
||||
.version_cmp = NULL,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_SXTT,
|
||||
DI(.type_label =) "Scheduled Transaction Templates",
|
||||
DI(.create =) NULL,
|
||||
DI(.book_begin =) NULL,
|
||||
DI(.book_end =) NULL,
|
||||
DI(.is_dirty =) NULL,
|
||||
DI(.mark_clean =) NULL,
|
||||
DI(.foreach =) NULL,
|
||||
DI(.printable =) NULL,
|
||||
DI(.version_cmp =) NULL,
|
||||
};
|
||||
|
||||
gboolean
|
||||
|
@ -859,19 +859,26 @@ gnc_sx_get_defer_instances( SchedXaction *sx )
|
||||
return sx->deferredList;
|
||||
}
|
||||
|
||||
#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
|
||||
static QofObject SXDesc =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_SX_ID,
|
||||
.type_label = "Scheduled Transaction",
|
||||
.create = (gpointer)xaccSchedXactionMalloc,
|
||||
.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_SX_ID,
|
||||
DI(.type_label =) "Scheduled Transaction",
|
||||
DI(.create =) (gpointer)xaccSchedXactionMalloc,
|
||||
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
|
||||
|
@ -1780,18 +1780,25 @@ xaccSplitUnvoid(Split *split)
|
||||
|
||||
/* Hook into the QofObject registry */
|
||||
|
||||
#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
|
||||
static QofObject split_object_def = {
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_SPLIT,
|
||||
.type_label = "Split",
|
||||
.create = (gpointer)xaccMallocSplit,
|
||||
.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)) xaccSplitGetMemo,
|
||||
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_SPLIT,
|
||||
DI(.type_label =) "Split",
|
||||
DI(.create =) (gpointer)xaccMallocSplit,
|
||||
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)) xaccSplitGetMemo,
|
||||
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
|
||||
};
|
||||
|
||||
static gpointer
|
||||
|
@ -2028,19 +2028,27 @@ xaccTransFindSplitByAccount(const Transaction *trans, const Account *acc)
|
||||
\********************************************************************/
|
||||
/* QofObject function implementation */
|
||||
|
||||
#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
|
||||
|
||||
/* Hook into the QofObject registry */
|
||||
static QofObject trans_object_def = {
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_TRANS,
|
||||
.type_label = "Transaction",
|
||||
.create = (gpointer)xaccMallocTransaction,
|
||||
.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)) xaccTransGetDescription,
|
||||
.version_cmp = (int (*)(gpointer,gpointer)) qof_instance_version_cmp,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_TRANS,
|
||||
DI(.type_label =) "Transaction",
|
||||
DI(.create =) (gpointer)xaccMallocTransaction,
|
||||
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)) xaccTransGetDescription,
|
||||
DI(.version_cmp =) (int (*)(gpointer,gpointer)) qof_instance_version_cmp,
|
||||
};
|
||||
|
||||
static gboolean
|
||||
|
@ -600,20 +600,28 @@ gnc_budget_get_default (QofBook *book)
|
||||
return bgt;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
/* Define the QofObject. */
|
||||
static QofObject budget_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_BUDGET,
|
||||
.type_label = "Budget",
|
||||
.create = (gpointer)gnc_budget_new,
|
||||
.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)) gnc_budget_get_name,
|
||||
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_BUDGET,
|
||||
DI(.type_label =) "Budget",
|
||||
DI(.create =) (gpointer)gnc_budget_new,
|
||||
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)) gnc_budget_get_name,
|
||||
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
|
||||
};
|
||||
|
||||
|
||||
|
@ -2312,30 +2312,37 @@ gnc_commodity_table_add_default_data(gnc_commodity_table *table, QofBook *book)
|
||||
********************************************************************/
|
||||
/* QofObject function implementation and registration */
|
||||
|
||||
#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
|
||||
static QofObject commodity_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_COMMODITY,
|
||||
.type_label = "Commodity",
|
||||
.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)) gnc_commodity_get_fullname,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_COMMODITY,
|
||||
DI(.type_label =) "Commodity",
|
||||
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)) gnc_commodity_get_fullname,
|
||||
};
|
||||
|
||||
static QofObject namespace_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_COMMODITY_NAMESPACE,
|
||||
.type_label = "Namespace",
|
||||
.book_begin = NULL,
|
||||
.book_end = NULL,
|
||||
.is_dirty = NULL,
|
||||
.mark_clean = NULL,
|
||||
.foreach = NULL,
|
||||
.printable = NULL,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_COMMODITY_NAMESPACE,
|
||||
DI(.type_label =) "Namespace",
|
||||
DI(.book_begin =) NULL,
|
||||
DI(.book_end =) NULL,
|
||||
DI(.is_dirty =) NULL,
|
||||
DI(.mark_clean =) NULL,
|
||||
DI(.foreach =) NULL,
|
||||
DI(.printable =) NULL,
|
||||
};
|
||||
|
||||
static void
|
||||
@ -2370,17 +2377,17 @@ commodity_table_book_end (QofBook *book)
|
||||
|
||||
static QofObject commodity_table_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_COMMODITY_TABLE,
|
||||
.type_label = "CommodityTable",
|
||||
.create = NULL,
|
||||
.book_begin = commodity_table_book_begin,
|
||||
.book_end = commodity_table_book_end,
|
||||
.is_dirty = qof_collection_is_dirty,
|
||||
.mark_clean = qof_collection_mark_clean,
|
||||
.foreach = NULL,
|
||||
.printable = NULL,
|
||||
.version_cmp = NULL,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_COMMODITY_TABLE,
|
||||
DI(.type_label =) "CommodityTable",
|
||||
DI(.create =) NULL,
|
||||
DI(.book_begin =) commodity_table_book_begin,
|
||||
DI(.book_end =) commodity_table_book_end,
|
||||
DI(.is_dirty =) qof_collection_is_dirty,
|
||||
DI(.mark_clean =) qof_collection_mark_clean,
|
||||
DI(.foreach =) NULL,
|
||||
DI(.printable =) NULL,
|
||||
DI(.version_cmp =) NULL,
|
||||
};
|
||||
|
||||
gboolean
|
||||
|
@ -610,19 +610,26 @@ gnc_lot_get_latest_split (GNCLot *lot)
|
||||
|
||||
/* ============================================================= */
|
||||
|
||||
#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
|
||||
static QofObject gncLotDesc =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_LOT,
|
||||
.type_label = "Lot",
|
||||
.create = (gpointer)gnc_lot_new,
|
||||
.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_LOT,
|
||||
DI(.type_label =) "Lot",
|
||||
DI(.create =) (gpointer)gnc_lot_new,
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
|
@ -2479,34 +2479,41 @@ price_printable(gpointer obj)
|
||||
return buff;
|
||||
}
|
||||
|
||||
#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
|
||||
static QofObject price_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_PRICE,
|
||||
.type_label = "Price",
|
||||
.create = price_create,
|
||||
.book_begin = NULL,
|
||||
.book_end = NULL,
|
||||
.is_dirty = qof_collection_is_dirty,
|
||||
.mark_clean = qof_collection_mark_clean,
|
||||
.foreach = price_foreach,
|
||||
.printable = price_printable,
|
||||
.version_cmp = NULL,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_PRICE,
|
||||
DI(.type_label =) "Price",
|
||||
DI(.create =) price_create,
|
||||
DI(.book_begin =) NULL,
|
||||
DI(.book_end =) NULL,
|
||||
DI(.is_dirty =) qof_collection_is_dirty,
|
||||
DI(.mark_clean =) qof_collection_mark_clean,
|
||||
DI(.foreach =) price_foreach,
|
||||
DI(.printable =) price_printable,
|
||||
DI(.version_cmp =) NULL,
|
||||
};
|
||||
|
||||
static QofObject pricedb_object_def =
|
||||
{
|
||||
.interface_version = QOF_OBJECT_VERSION,
|
||||
.e_type = GNC_ID_PRICEDB,
|
||||
.type_label = "PriceDB",
|
||||
.create = NULL,
|
||||
.book_begin = pricedb_book_begin,
|
||||
.book_end = pricedb_book_end,
|
||||
.is_dirty = qof_collection_is_dirty,
|
||||
.mark_clean = qof_collection_mark_clean,
|
||||
.foreach = NULL,
|
||||
.printable = NULL,
|
||||
.version_cmp = NULL,
|
||||
DI(.interface_version =) QOF_OBJECT_VERSION,
|
||||
DI(.e_type =) GNC_ID_PRICEDB,
|
||||
DI(.type_label =) "PriceDB",
|
||||
DI(.create =) NULL,
|
||||
DI(.book_begin =) pricedb_book_begin,
|
||||
DI(.book_end =) pricedb_book_end,
|
||||
DI(.is_dirty =) qof_collection_is_dirty,
|
||||
DI(.mark_clean =) qof_collection_mark_clean,
|
||||
DI(.foreach =) NULL,
|
||||
DI(.printable =) NULL,
|
||||
DI(.version_cmp =) NULL,
|
||||
};
|
||||
|
||||
gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user