[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.
///
- [lmi-commits] [lmi] master updated (47ba720 -> ad6ea6c), Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master 7a98051c0 01/10: Enable five more warnings, Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master eb410dd 02/10: Remove a useless cast, Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master 857ca63 03/10: Move a pragma to a more appropriate place,
Greg Chicares <=
- [lmi-commits] [lmi] master 6143242 06/10: Use a pragma to inhibit certain warnings in a single TU, Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master cddcbaa 09/10: Purge three classes of warnings that are no longer needed, Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master ad6ea6c 10/10: Remove pragmata rendered unnecessary by '-isystem', Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master 67e9fd6 04/10: Disable '-Wswitch-enum' in 'boost_regex.hpp', Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master 4b93a16 07/10: Consolidate and simplify '-Wno-' options for boost filesystem, Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master b9adeb4 08/10: Consolidate and simplify '-Wno-' options for cgicc, Greg Chicares, 2020/06/08
- [lmi-commits] [lmi] master 272d69d 05/10: Purge a class of warnings that is no longer needed, Greg Chicares, 2020/06/08