[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master eb410dd 02/10: Remove a useless cast
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master eb410dd 02/10: Remove a useless cast |
Date: |
Mon, 8 Jun 2020 19:22:00 -0400 (EDT) |
branch: master
commit eb410dd3db85a614dfd4c21fa2e38e72fd613c31
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Remove a useless cast
* pchfile_wx.hpp: No longer disable '-Wuseless-cast' for files that
include wx headers. Using '-isystem' for wx include paths disables this
warning for wx headers themselves, and removing the warning pragma here
lets anomalies in lmi code be diagnosed.
* alert_wx.cpp: Resolved a '-Wuseless-cast' warning. The compiler deems
two types to be the same, but that is not obvious to a human, and the wx
API could someday change, making such a cast necessary. Rewrote the code
to deduce the appropriate type.
---
alert_wx.cpp | 10 +++++-----
pchfile_wx.hpp | 1 -
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/alert_wx.cpp b/alert_wx.cpp
index d60893c..33d8b78 100644
--- a/alert_wx.cpp
+++ b/alert_wx.cpp
@@ -154,11 +154,11 @@ void safe_message_alert(char const* message)
{
safely_show_on_stderr(message);
#if defined LMI_MSW
- HWND handle = nullptr;
- if(wxTheApp && wxTheApp->GetTopWindow())
- {
- handle = reinterpret_cast<HWND>(wxTheApp->GetTopWindow()->GetHandle());
- }
+ auto handle =
+ (wxTheApp && wxTheApp->GetTopWindow())
+ ? wxTheApp->GetTopWindow()->GetHandle()
+ : nullptr
+ ;
::MessageBoxA(handle, message, "Error", MB_OK | MB_ICONSTOP |
MB_TASKMODAL);
#endif // defined LMI_MSW
}
diff --git a/pchfile_wx.hpp b/pchfile_wx.hpp
index 1001a1c..b9b5b6c 100644
--- a/pchfile_wx.hpp
+++ b/pchfile_wx.hpp
@@ -49,7 +49,6 @@
# pragma GCC diagnostic ignored "-Wformat-nonliteral"
# pragma GCC diagnostic ignored "-Wnoexcept"
# pragma GCC diagnostic ignored "-Wsign-conversion"
-# pragma GCC diagnostic ignored "-Wuseless-cast"
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif // defined __GNUC__ && !defined __clang__
- [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 <=
- [lmi-commits] [lmi] master 857ca63 03/10: Move a pragma to a more appropriate place, Greg Chicares, 2020/06/08
- [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