[gnumeric] compilation: improve -Wswitch handling
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] compilation: improve -Wswitch handling
- Date: Wed, 4 May 2011 19:39:32 +0000 (UTC)
commit 04449d84855c58ebf42cea804e13ae873dc57a7c
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed May 4 13:38:36 2011 -0600
compilation: improve -Wswitch handling
2011-05-04 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/compilation.h: new
* src/Makefile.am: add compilation.h
* src/workbook.c (workbook_sheet_state_diff): use
GNM_*_KILL_SWITCH_WARNING
2011-05-03 Andreas J. Guelzow <aguelzow pyrshep ca>
* ms-chart.c (chart_write_LEGEND): use
GNM_*_KILL_SWITCH_WARNING
ChangeLog | 7 +++++++
plugins/excel/ChangeLog | 8 +++++++-
plugins/excel/ms-chart.c | 19 +++----------------
src/Makefile.am | 2 +-
src/compilation.h | 24 ++++++++++++++++++++++++
src/workbook.c | 20 +++-----------------
6 files changed, 45 insertions(+), 35 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 52156d8..79aabe2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-04 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/compilation.h: new
+ * src/Makefile.am: add compilation.h
+ * src/workbook.c (workbook_sheet_state_diff): use
+ GNM_*_KILL_SWITCH_WARNING
+
2011-05-03 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/wbc-gtk-edit.c (wbcg_edit_start): suppress enum warning
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 4060898..e70f243 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,6 +1,12 @@
+2011-05-03 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * ms-chart.c (chart_write_LEGEND): use
+ GNM_*_KILL_SWITCH_WARNING
+
2011-05-04 Jean Brefort <jean brefort normalesup org>
- * xlsx-read-drawing.c (xlsx_chart_pop_obj): don't set a style to a NULL object,
+ * xlsx-read-drawing.c (xlsx_chart_pop_obj): don't set a style to a
+ NULL object,
(xlsx_axis_mark): pass a true boolean to make gobject happy,
(xlsx_axis_end): don't exchange radar plots axes,
(xlsx_chart_legend_pos): add new enum values not in spec, but occuring,
diff --git a/plugins/excel/ms-chart.c b/plugins/excel/ms-chart.c
index fbb32f9..2458b4a 100644
--- a/plugins/excel/ms-chart.c
+++ b/plugins/excel/ms-chart.c
@@ -18,6 +18,7 @@
#include "ms-excel-write.h"
#include "ms-escher.h"
#include "ms-formula-write.h"
+#include "compilation.h"
#include <parse-util.h>
#include <gnm-format.h>
@@ -5259,15 +5260,7 @@ chart_write_DROPBAR (XLChartWriteState *s)
g_object_unref (s->dp_style);
}
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-#pragma GCC diagnostic push
-#endif
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
-#pragma GCC diagnostic ignored "-Wswitch"
- /* Suppressing the warning about the case values not be named */
- /* GogObjectPosition enum values */
-#endif
-
+GNM_BEGIN_KILL_SWITCH_WARNING
static void
chart_write_LEGEND (XLChartWriteState *s, GogObject const *legend)
{
@@ -5301,13 +5294,7 @@ chart_write_LEGEND (XLChartWriteState *s, GogObject const *legend)
chart_write_text (s, NULL, NULL, 0);
chart_write_END (s);
}
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-#pragma GCC diagnostic pop
-#else
-#pragma GCC diagnostic warning "-Wswitch"
-#endif
-#endif
+GNM_END_KILL_SWITCH_WARNING
static void
chart_write_axis_sets (XLChartWriteState *s, GSList *sets)
diff --git a/src/Makefile.am b/src/Makefile.am
index 8dff92b..c2a1a9f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,7 +10,7 @@ bin_PROGRAMS =
check_PROGRAMS =
noinst_PROGRAMS = sstest
-noinst_HEADERS = dead-kittens.h
+noinst_HEADERS = dead-kittens.h compilation.h
if WITH_GTK
SUBDIRS += pixmaps dialogs widgets
diff --git a/src/compilation.h b/src/compilation.h
new file mode 100644
index 0000000..89a01f4
--- /dev/null
+++ b/src/compilation.h
@@ -0,0 +1,24 @@
+#ifndef GNUMERIC_GTK_COMPILATION_H
+#define GNUMERIC_GTK_COMPILATION_H
+
+#if defined(__GNUC__)
+#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__ )
+#if (GCC_VERSION >= 402)
+#if (GCC_VERSION >= 406)
+#define GNM_BEGIN_KILL_SWITCH_WARNING _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wswitch\"")
+#define GNM_END_KILL_SWITCH_WARNING _Pragma("GCC diagnostic pop")
+#else
+#define GNM_BEGIN_KILL_SWITCH_WARNING _Pragma("GCC diagnostic ignored \"-Wswitch\"")
+#define GNM_END_KILL_SWITCH_WARNING _Pragma("GCC diagnostic warning \"-Wswitch\"")
+#endif
+#endif
+#endif
+
+#ifndef GNM_BEGIN_KILL_SWITCH_WARNING
+#define GNM_BEGIN_KILL_SWITCH_WARNING
+#endif
+#ifndef GNM_END_KILL_SWITCH_WARNING
+#define GNM_END_KILL_SWITCH_WARNING
+#endif
+
+#endif
diff --git a/src/workbook.c b/src/workbook.c
index a8fa5c3..710340d 100644
--- a/src/workbook.c
+++ b/src/workbook.c
@@ -15,6 +15,7 @@
#include <gnumeric-config.h>
#include "gnumeric.h"
#include "workbook-priv.h"
+#include "compilation.h"
#include "workbook-view.h"
#include "workbook-control.h"
@@ -1331,15 +1332,7 @@ workbook_sheet_state_size (const WorkbookSheetState *wss)
return size;
}
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-#pragma GCC diagnostic push
-#endif
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
-#pragma GCC diagnostic ignored "-Wswitch"
- /* Suppressing the warning about the case values not be named */
- /* enum values */
-#endif
-
+GNM_BEGIN_KILL_SWITCH_WARNING
char *
workbook_sheet_state_diff (const WorkbookSheetState *wss_a, const WorkbookSheetState *wss_b)
{
@@ -1439,14 +1432,7 @@ workbook_sheet_state_diff (const WorkbookSheetState *wss_a, const WorkbookSheetS
return g_strdup (_("Reorganizing Sheets"));
}
}
-
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-#pragma GCC diagnostic pop
-#else
-#pragma GCC diagnostic warning "-Wswitch"
-#endif
-#endif
+GNM_END_KILL_SWITCH_WARNING
/* ------------------------------------------------------------------------- */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]