lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 857ca63 03/10: Move a pragma to a more approp


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 857ca63 03/10: Move a pragma to a more appropriate place
Date: Mon, 8 Jun 2020 19:22:00 -0400 (EDT)

branch: master
commit 857ca6366ee2ececa16420e77b58cc30f06656a4
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Move a pragma to a more appropriate place
    
    Now that '-isystem' is used for wx include paths, '-Wcast-function-type'
    needn't be ignored for all files that include wx headers. Therefore,
    moved the gcc pragma to the one function that this warning identifies.
    That function was already documented as 'inherently unsafe', and it is
    appropriate to express such a concern in a pragma.
---
 pchfile_wx.hpp |  3 ---
 wx_utility.hpp | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/pchfile_wx.hpp b/pchfile_wx.hpp
index b9b5b6c..bf77a54 100644
--- a/pchfile_wx.hpp
+++ b/pchfile_wx.hpp
@@ -35,9 +35,6 @@
 // disable some warnings which are enabled for the rest of lmi code but have to
 // be disabled for the code using wxWidgets as they occur in wxWidgets headers.
 #if defined __GNUC__ && !defined __clang__
-#   if 8 <= __GNUC__
-#       pragma GCC diagnostic ignored "-Wcast-function-type"
-#   endif // 8 <= __GNUC__
 #   pragma GCC diagnostic ignored "-Wcast-qual"
 #   if 9 <= __GNUC__
 #       pragma GCC diagnostic ignored "-Wdeprecated-copy"
diff --git a/wx_utility.hpp b/wx_utility.hpp
index 9095565..ebe3814 100644
--- a/wx_utility.hpp
+++ b/wx_utility.hpp
@@ -46,11 +46,26 @@ class jdn_t;
 /// (C++98 5.4), which is inherently unsafe. Its sole virtue is that
 /// it is easily searched for.
 
+#if defined __clang__
+#   pragma clang diagnostic push
+// Commented out--clang doesn't seem to have this diagnostic:
+// #   pragma clang diagnostic ignored "-Wcast-function-type"
+#elif defined __GNUC__
+#   pragma GCC diagnostic push
+#   if 8 <= __GNUC__
+#       pragma GCC diagnostic ignored "-Wcast-function-type"
+#   endif // 8 <= __GNUC__
+#endif // defined __GNUC__
 template<typename To, typename From>
 To c_cast(From z)
 {
     return (To)(z);
 }
+#if defined __clang__
+#   pragma clang diagnostic pop
+#elif defined __GNUC__
+#   pragma GCC diagnostic pop
+#endif // defined __GNUC__
 
 /// Encapsulate wx clipboard.
 ///



reply via email to

[Prev in Thread] Current Thread [Next in Thread]