From dd4ce37a090851365dbb13a753bd280d073ce13b Mon Sep 17 00:00:00 2001 From: Alex Alabuzhev Date: Sat, 16 Dec 2023 16:38:46 +0000 Subject: [PATCH] Minor fixes & remove old workarounds --- _build/vc/all.sln.DotSettings | 1 + far/cddrv.cpp | 22 ++------------- far/color_picker.cpp | 2 +- far/common/view/zip.hpp | 5 ++-- far/platform.headers.hpp | 50 +++++++++++++++++------------------ far/scripts/mkdep.awk | 8 +++--- logo.svg | 2 +- 7 files changed, 35 insertions(+), 55 deletions(-) diff --git a/_build/vc/all.sln.DotSettings b/_build/vc/all.sln.DotSettings index 52346c5f1b..b12313c13a 100644 --- a/_build/vc/all.sln.DotSettings +++ b/_build/vc/all.sln.DotSettings @@ -1,5 +1,6 @@  False + False SOLUTION True HINT diff --git a/far/cddrv.cpp b/far/cddrv.cpp index 097e025fcb..81945d9808 100644 --- a/far/cddrv.cpp +++ b/far/cddrv.cpp @@ -196,30 +196,12 @@ static auto capatibilities_from_scsi_configuration(const os::fs::file& Device) auto Spt = InitSCSIPassThrough(); #if !IS_MICROSOFT_SDK() - // GCC headers incorrectly reserve only one bit for RequestType - struct CDB_FIXED - { - struct - { - UCHAR OperationCode; - UCHAR RequestType : 2; - UCHAR Reserved1 : 6; - UCHAR StartingFeature[2]; - UCHAR Reserved2[3]; - UCHAR AllocationLength[2]; - UCHAR Control; - } - GET_CONFIGURATION; - }; -#define CDB CDB_FIXED + // Old GCC headers incorrectly reserve only one bit for RequestType + static_assert(decltype(CDB::GET_CONFIGURATION){.RequestType = 0b11 }.RequestType == 0b11); #endif auto& GetConfiguration = edit_as(Spt.Cdb).GET_CONFIGURATION; -#if !IS_MICROSOFT_SDK() -#undef CDB -#endif - GetConfiguration.OperationCode = SCSIOP_GET_CONFIGURATION; GetConfiguration.RequestType = SCSI_GET_CONFIGURATION_REQUEST_TYPE_ONE; write_value_to_big_endian(GetConfiguration.StartingFeature, FeatureProfileList); diff --git a/far/color_picker.cpp b/far/color_picker.cpp index 7fddc5a860..15d652877d 100644 --- a/far/color_picker.cpp +++ b/far/color_picker.cpp @@ -556,7 +556,7 @@ static void disable_if_needed(COLORREF const Color, span ColorDlgI { ColorDlgItems[Offset + cb::color_active_checkbox].Selected = BSTATE_CHECKED; } -}; +} static bool pick_color_single(colors::single_color& Color, colors::single_color const BaseColor, std::array& CustomColors) { diff --git a/far/common/view/zip.hpp b/far/common/view/zip.hpp index 9a5baf50d8..43f6c820a3 100644 --- a/far/common/view/zip.hpp +++ b/far/common/view/zip.hpp @@ -156,8 +156,7 @@ namespace detail }; } -// the size_t is a workaround for GCC -template +template class [[nodiscard]] zip { public: @@ -183,6 +182,6 @@ class [[nodiscard]] zip }; template -zip(args&&... Args) -> zip...>; +zip(args&&... Args) -> zip...>; #endif // ZIP_HPP_92A80223_8204_4A14_AACC_93D632A39884 diff --git a/far/platform.headers.hpp b/far/platform.headers.hpp index 7fa6c93e3b..96cfe22284 100644 --- a/far/platform.headers.hpp +++ b/far/platform.headers.hpp @@ -34,22 +34,35 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "common/compiler.hpp" + #include "disable_warnings_in_std_begin.hpp" //---------------------------------------------------------------------------- -#ifdef __GNUC__ +#if !IS_MICROSOFT_SDK() #include -#define _W32API_VER (100*(__W32API_MAJOR_VERSION) + (__W32API_MINOR_VERSION)) -#if _W32API_VER < 314 + +#if (100*(__W32API_MAJOR_VERSION) + (__W32API_MINOR_VERSION)) < 314 #error w32api-3.14 (or higher) required #endif -#undef WINVER -#undef _WIN32_WINNT + +#include + +#undef _WIN32_ #undef _WIN32_IE -#define WINVER 0x0603 -#define _WIN32_WINNT 0x0603 -#define _WIN32_IE 0x0700 -#endif // __GNUC__ +#undef _WIN32_WINNT +#undef _WIN32_WINDOWS_ +#undef NTDDI +#undef WINVER + +#define _WIN32_ _WIN32_MAXVER +#define _WIN32_IE _WIN32_IE_MAXVER +#define _WIN32_WINNT _WIN32_WINNT_MAXVER +#define _WIN32_WINDOWS_ _WIN32_WINDOWS_MAXVER +#define NTDDI NTDDI_MAXVER +#define WINVER WINVER_MAXVER + +#endif #define WIN32_NO_STATUS //exclude ntstatus.h macros from winnt.h #include @@ -88,27 +101,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _NTSCSI_USER_MODE_ -#ifdef _MSC_VER +#if IS_MICROSOFT_SDK() #include -#endif // _MSC_VER - -#ifdef __GNUC__ +#else #include -// Workaround for MinGW, see a66e40 -// Their loony headers are unversioned, -// so the only way to make it compatible -// with both old and new is this madness: -#include -#ifndef __INetFwProduct_FWD_DEFINED__ -#define _LBA -#define _MSF -#endif #include -#ifndef __INetFwProduct_FWD_DEFINED__ -#undef _MSF -#undef _LBA #endif -#endif // __GNUC__ #include "platform.sdk.hpp" diff --git a/far/scripts/mkdep.awk b/far/scripts/mkdep.awk index 64ca69ba8e..5851024cbc 100644 --- a/far/scripts/mkdep.awk +++ b/far/scripts/mkdep.awk @@ -4,17 +4,17 @@ BEGIN{ split(ENVIRON["FORCEINCLUDELIST"], force_include, " ") if (compiler=="gcc") { + dirsep="/"; out="$(OBJDIR)"; obj="o"; rc="rc.o" - dirsep="/"; } else { - out="$(INTDIR)"; + dirsep="\\"; + out="$(INTDIR)" dirsep; obj="obj"; rc="res" - dirsep="\\"; } } { @@ -38,7 +38,7 @@ BEGIN{ if(path_part == "" && (ext == obj || ext == rc)) { - print out dirsep filename "." ext ":"; + print out filename "." ext ":"; print " " $0; if (is_cpp) diff --git a/logo.svg b/logo.svg index 69d7af816a..79a9a0b85c 100644 --- a/logo.svg +++ b/logo.svg @@ -1,4 +1,4 @@ - +