Skip to content

Commit

Permalink
Fix build, suppress gcc & clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Aug 15, 2024
1 parent 86a3414 commit b4a0219
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 2 deletions.
5 changes: 5 additions & 0 deletions far/exception_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2169,10 +2169,15 @@ signal_handler::~signal_handler()
extern "C" void _invalid_parameter(wchar_t const*, wchar_t const*, wchar_t const*, unsigned int, uintptr_t);
#endif
#else
WARNING_PUSH()
WARNING_DISABLE_CLANG("-Wmissing-noreturn")

static void _invalid_parameter(wchar_t const*, wchar_t const*, wchar_t const*, unsigned int, uintptr_t)
{
os::process::terminate(STATUS_INVALID_CRUNTIME_PARAMETER);
}

WARNING_POP()
#endif

static void invalid_parameter_handler_impl(const wchar_t* const Expression, const wchar_t* const Function, const wchar_t* const File, unsigned int const Line, uintptr_t const Reserved)
Expand Down
6 changes: 6 additions & 0 deletions far/filefilterparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,14 @@ string MenuString(const FileFilterParams* const FF, bool const bHighlightType, w
Mask = EscapedMask;
}

WARNING_PUSH()
WARNING_DISABLE_GCC("-Warray-bounds")
WARNING_DISABLE_GCC("-Wstringop-overflow")

const auto AttrStr = AttributesString(IncludeAttr, ExcludeAttr);

WARNING_POP()

string OtherFlags;
OtherFlags.reserve(4);

Expand Down
2 changes: 1 addition & 1 deletion far/flink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ bool GetVHDInfo(string_view const RootDirectory, string &strVolumePath, VIRTUAL_
return false;

WARNING_PUSH()
WARNING_DISABLE_GCC("-Warray-bounds=")
WARNING_DISABLE_GCC("-Warray-bounds")

if(StorageType)
*StorageType = StorageDependencyInfo->Version2Entries[0].VirtualStorageType;
Expand Down
7 changes: 6 additions & 1 deletion far/makefile_gcc_common
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ ifneq ($(NO_LTO),1)
CFLAGS += -flto

ifndef CLANG
CFLAGS += -flto-odr-type-merging
CFLAGS += \
-flarge-source-files \
-flto-odr-type-merging \

endif

endif # NO_LTO
Expand All @@ -243,7 +246,9 @@ endif # DEBUG
# Compiler-specific flags
PDB_FLAGS = \
-g \
--start-no-unused-arguments \
-gcodeview \
--end-no-unused-arguments \

LLD_FLAGS = \
-fuse-ld=lld \
Expand Down
8 changes: 8 additions & 0 deletions far/platform.sdk/sdk_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
#define DEBUG_DISASM_SOURCE_LINE_NUMBER 0x00000004
#define DEBUG_DISASM_SOURCE_FILE_NAME 0x00000008

// This particular name is unrelated, it was just added soon after IID_IDebugClient5
// https://sourceforge.net/p/mingw-w64/mingw-w64/ci/aa3060039963b6e0c2950dd78b3db66faf8d79f8/
// https://sourceforge.net/p/mingw-w64/mingw-w64/ci/c37b1cd2058f25b02e8d7ffcf21db255e5cc3774/
#ifndef DBG_FRAME_DEFAULT

DEFINE_GUID(IID_IDebugClient5,0xe3acb9d7,0x7ec2,0x4f0c,0xa0,0xda,0xe8,0x1e,0x0c,0xbb,0xe6,0x28);
DEFINE_GUID(IID_IDebugOutputCallbacksWide,0x4c7fd663,0xc394,0x4e26,0x8e,0xf1,0x34,0xad,0x5e,0xd3,0x76,0x4c);

Expand Down Expand Up @@ -323,10 +328,13 @@ DECLARE_INTERFACE_(IDebugOutputCallbacksWide, IUnknown)

#endif

#endif // DBG_FRAME_DEFAULT

#ifndef STACK_FRAME_TYPE_INLINE
#define STACK_FRAME_TYPE_INLINE 0x02
#define STACK_FRAME_TYPE_IGNORE 0xFF

// dbghelp.h
#define SYM_STKWALK_DEFAULT 0x00000000

typedef union _INLINE_FRAME_CONTEXT
Expand Down
2 changes: 2 additions & 0 deletions far/sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ WARNING_DISABLE_MSC(5105) // macro expansion producing 'defined' has undefined b
WARNING_DISABLE_MSC(4191) // 'operator/operation' : unsafe conversion from 'type of expression' to 'type required'

WARNING_DISABLE_GCC("-Wpedantic")
WARNING_DISABLE_GCC("-Wcast-align")
WARNING_DISABLE_GCC("-Wcast-function-type")
WARNING_DISABLE_GCC("-Wcast-qual")
WARNING_DISABLE_GCC("-Wdouble-promotion")
Expand All @@ -65,6 +66,7 @@ WARNING_DISABLE_GCC("-Wimplicit-fallthrough")
WARNING_DISABLE_GCC("-Wmisleading-indentation")
WARNING_DISABLE_GCC("-Wmissing-declarations")
WARNING_DISABLE_GCC("-Wredundant-decls")
WARNING_DISABLE_GCC("-Wstringop-overread")
WARNING_DISABLE_GCC("-Wundef")
WARNING_DISABLE_GCC("-Wunused-but-set-variable")
#ifdef _DEBUG
Expand Down
6 changes: 6 additions & 0 deletions far/stack_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Common:

// External:

WARNING_PUSH()
WARNING_DISABLE_GCC("-Wcast-align")

#include "thirdparty/short_alloc/short_alloc.h"

WARNING_POP()

//----------------------------------------------------------------------------

template<class T, std::size_t N, std::size_t Align = alignof(std::max_align_t)>
Expand Down
2 changes: 2 additions & 0 deletions far/testing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ WARNING_DISABLE_MSC(4459) // declaration of 'identifier' hides global declaratio
WARNING_DISABLE_MSC(4800) // Implicit conversion from 'type' to bool. Possible information loss
WARNING_DISABLE_MSC(5220) // 'name': a non-static data member with a volatile qualified type no longer implies that compiler generated copy/move constructors and copy/move assignment operators are not trivial
WARNING_DISABLE_MSC(5267) // definition of implicit assignment operator for 'class' is deprecated because it has a user-provided destructor

WARNING_DISABLE_GCC("-Wctor-dtor-privacy")
WARNING_DISABLE_GCC("-Wdouble-promotion")
WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
WARNING_DISABLE_GCC("-Wredundant-decls")
WARNING_DISABLE_GCC("-Wsubobject-linkage")

WARNING_DISABLE_CLANG("-Weverything")

#define CATCH_AMALGAMATED_CUSTOM_MAIN
Expand Down

0 comments on commit b4a0219

Please sign in to comment.