[pan: 3/6] This redefines NULL in order to stop clang complaining about sentinels




commit b8b3a221f2ae3984766d8680765a52afb35e3683
Author: Thomas Tanner <thosrtanner googlemail com>
Date:   Sat Jul 16 18:34:29 2022 +0100

    This redefines NULL in order to stop clang complaining about sentinels

 pan/data-impl/data-impl.cc    |  2 ++
 pan/data-impl/data-io.cc      |  2 ++
 pan/general/file-util.cc      |  2 +-
 pan/general/null.h            | 32 ++++++++++++++++++++++++++++++++
 pan/gui/body-pane.cc          |  2 ++
 pan/gui/dl-headers-ui.cc      |  2 ++
 pan/gui/group-pane.cc         |  2 ++
 pan/gui/group-prefs-dialog.cc |  2 ++
 pan/gui/gui.cc                |  2 ++
 pan/gui/header-pane.cc        |  2 ++
 pan/gui/log-ui.cc             |  2 ++
 pan/gui/pan-file-entry.cc     |  2 ++
 pan/gui/pan.cc                |  2 ++
 pan/gui/post-ui.cc            |  2 ++
 pan/gui/prefs-ui.cc           |  2 ++
 pan/gui/profiles-dialog.cc    |  2 ++
 pan/gui/save-attach-ui.cc     |  2 ++
 pan/gui/save-ui.cc            |  2 ++
 pan/gui/score-add-ui.cc       |  2 ++
 pan/gui/score-view-ui.cc      |  2 ++
 pan/gui/server-ui.cc          |  2 ++
 pan/gui/task-pane.cc          |  2 ++
 pan/tasks/decoder.cc          |  2 ++
 23 files changed, 75 insertions(+), 1 deletion(-)
---
diff --git a/pan/data-impl/data-impl.cc b/pan/data-impl/data-impl.cc
index b8dace5..048d3f4 100644
--- a/pan/data-impl/data-impl.cc
+++ b/pan/data-impl/data-impl.cc
@@ -43,6 +43,8 @@
 #endif /* GTK_CHECK_VERSION(3,0,0) */
 #endif
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 /**
diff --git a/pan/data-impl/data-io.cc b/pan/data-impl/data-io.cc
index 5b015d8..5ec1c33 100644
--- a/pan/data-impl/data-io.cc
+++ b/pan/data-impl/data-io.cc
@@ -36,6 +36,8 @@ extern "C" {
 #include <pan/general/log.h>
 #include "data-io.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace
diff --git a/pan/general/file-util.cc b/pan/general/file-util.cc
index 4b478c0..79cb66b 100644
--- a/pan/general/file-util.cc
+++ b/pan/general/file-util.cc
@@ -43,7 +43,7 @@ extern "C"
 #include "utf8-utils.h"
 #include <algorithm>
 
-
+#include <pan/general/null.h>
 
 using namespace pan;
 
diff --git a/pan/general/null.h b/pan/general/null.h
new file mode 100644
index 0000000..b46c659
--- /dev/null
+++ b/pan/general/null.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Pan - A Newsreader for Gtk+
+ * Copyright (C) 2002-2006  Charles Kerr <charles rebelbase com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef pan_general_null_h__
+#define pan_general_null_h__
+ /** Yes. this is horrible. Basically, everyone uses 'NULL' for a null pointer,
+  *  except one or two bits of buggy code that use it as 0.
+  *
+  * In particular this causes rafts of warnings with clang as it doesn't allow
+  * 0 as a sentinel where it's expecting nullptr
+  */
+
+#undef NULL
+#define NULL nullptr
+
+#endif
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index 3cc18c3..fe78320 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -47,6 +47,8 @@
   #include <webkit/webkit.h>
 #endif
 
+#include <pan/general/null.h>
+
 #define FIRST_PICTURE "first-picture"
 
 #define FACE_SIZE 48
diff --git a/pan/gui/dl-headers-ui.cc b/pan/gui/dl-headers-ui.cc
index f235c9d..9e8955d 100644
--- a/pan/gui/dl-headers-ui.cc
+++ b/pan/gui/dl-headers-ui.cc
@@ -27,6 +27,8 @@
 #include "dl-headers-ui.h"
 #include "pad.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace
diff --git a/pan/gui/group-pane.cc b/pan/gui/group-pane.cc
index 134714a..3c6437d 100644
--- a/pan/gui/group-pane.cc
+++ b/pan/gui/group-pane.cc
@@ -34,6 +34,8 @@
 #include "pad.h"
 #include "tango-colors.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace
diff --git a/pan/gui/group-prefs-dialog.cc b/pan/gui/group-prefs-dialog.cc
index d1005fd..c51afe7 100644
--- a/pan/gui/group-prefs-dialog.cc
+++ b/pan/gui/group-prefs-dialog.cc
@@ -38,6 +38,8 @@
 
 #include <iostream>
 
+#include <pan/general/null.h>
+
 namespace pan {
 
 namespace
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index b897379..5e3c7e3 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -74,6 +74,8 @@ extern "C" {
 
 #include <pan/usenet-utils/gpg.h>
 
+#include <pan/general/null.h>
+
 namespace
 {
   std::string get_accel_filename () {
diff --git a/pan/gui/header-pane.cc b/pan/gui/header-pane.cc
index 1195e16..2148e16 100644
--- a/pan/gui/header-pane.cc
+++ b/pan/gui/header-pane.cc
@@ -40,6 +40,8 @@
 #include "tango-colors.h"
 #include "gtk-compat.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 /****
diff --git a/pan/gui/log-ui.cc b/pan/gui/log-ui.cc
index 8846e1d..760e88a 100644
--- a/pan/gui/log-ui.cc
+++ b/pan/gui/log-ui.cc
@@ -29,6 +29,8 @@
 #include "log-ui.h"
 #include "pad.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace
diff --git a/pan/gui/pan-file-entry.cc b/pan/gui/pan-file-entry.cc
index f86c845..6b01476 100644
--- a/pan/gui/pan-file-entry.cc
+++ b/pan/gui/pan-file-entry.cc
@@ -25,6 +25,8 @@
 #include "pad.h"
 #include "pan-file-entry.h"
 
+#include <pan/general/null.h>
+
 namespace
 {
   void
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index 73c7642..7982398 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -83,6 +83,8 @@ extern "C" {
 //#define DEBUG_LOCALE 1
 //#define DEBUG_PARALLEL 1
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 53f0b69..16e4560 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -58,6 +58,8 @@ extern "C" {
 #include "url.h"
 #include "gtk-compat.h"
 
+#include <pan/general/null.h>
+
 #ifdef HAVE_GTKSPELL
 #define DEFAULT_SPELLCHECK_FLAG true
 #else
diff --git a/pan/gui/prefs-ui.cc b/pan/gui/prefs-ui.cc
index b4dfe15..5746d93 100644
--- a/pan/gui/prefs-ui.cc
+++ b/pan/gui/prefs-ui.cc
@@ -40,6 +40,8 @@ extern "C" {
 
 #include <algorithm>
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace pan
diff --git a/pan/gui/profiles-dialog.cc b/pan/gui/profiles-dialog.cc
index f7a8dd3..82fe588 100644
--- a/pan/gui/profiles-dialog.cc
+++ b/pan/gui/profiles-dialog.cc
@@ -35,6 +35,8 @@
 
 #include <pan/usenet-utils/gpg.h>
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 /***
diff --git a/pan/gui/save-attach-ui.cc b/pan/gui/save-attach-ui.cc
index b2931b7..70456a6 100644
--- a/pan/gui/save-attach-ui.cc
+++ b/pan/gui/save-attach-ui.cc
@@ -33,6 +33,8 @@
 #include "save-attach-ui.h"
 #include "gtk-compat.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace
diff --git a/pan/gui/save-ui.cc b/pan/gui/save-ui.cc
index cdee626..b303e49 100644
--- a/pan/gui/save-ui.cc
+++ b/pan/gui/save-ui.cc
@@ -33,6 +33,8 @@
 #include "save-ui.h"
 #include "gtk-compat.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace
diff --git a/pan/gui/score-add-ui.cc b/pan/gui/score-add-ui.cc
index 02603a5..fee0e58 100644
--- a/pan/gui/score-add-ui.cc
+++ b/pan/gui/score-add-ui.cc
@@ -29,6 +29,8 @@
 #include "score-view-ui.h"
 #include "gtk-compat.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 /**
diff --git a/pan/gui/score-view-ui.cc b/pan/gui/score-view-ui.cc
index 08da61e..88d3750 100644
--- a/pan/gui/score-view-ui.cc
+++ b/pan/gui/score-view-ui.cc
@@ -26,6 +26,8 @@
 #include "score-view-ui.h"
 #include "gtk-compat.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 namespace
diff --git a/pan/gui/server-ui.cc b/pan/gui/server-ui.cc
index e76ebf7..261fae8 100644
--- a/pan/gui/server-ui.cc
+++ b/pan/gui/server-ui.cc
@@ -50,6 +50,8 @@
 #endif /* GTK_CHECK_VERSION(3,0,0) */
 #endif
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 /************
diff --git a/pan/gui/task-pane.cc b/pan/gui/task-pane.cc
index f88e8b8..ed696ed 100644
--- a/pan/gui/task-pane.cc
+++ b/pan/gui/task-pane.cc
@@ -34,6 +34,8 @@
 #include "task-pane.h"
 #include "taskpane.ui.h"
 
+#include <pan/general/null.h>
+
 extern "C" {
   #include <sys/stat.h>
 }
diff --git a/pan/tasks/decoder.cc b/pan/tasks/decoder.cc
index 7b3eb8a..848a0cb 100644
--- a/pan/tasks/decoder.cc
+++ b/pan/tasks/decoder.cc
@@ -35,6 +35,8 @@
 #include <pan/general/utf8-utils.h>
 #include "decoder.h"
 
+#include <pan/general/null.h>
+
 using namespace pan;
 
 Decoder :: Decoder (WorkerPool& pool):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]