Skip to content

Commit

Permalink
Disable maybe-uninitialized warning all together.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Nov 29, 2023
1 parent d432c35 commit aa28b3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ project(capstone
VERSION 5.0
)

set(UNIX_COMPILER_OPTIONS -Werror -Wshift-negative-value -Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation)

# maybe-unitialzied is only supported by newer versions of GCC.
# Unfortunately, it is pretty unreliable and reports wrong results.
# So we disable it for all compilers versions which support it.
include(CheckCCompilerFlag)
check_c_compiler_flag("-Wno-maybe-unitialized" SUPPORTS_MU)

if (SUPPORTS_MU)
set(UNIX_COMPILER_OPTIONS ${UNIX_COMPILER_OPTIONS} -Wno-maybe-unitialized)
endif()

if (MSVC)
add_compile_options(/W1 /w14189)
else()
add_compile_options(-Werror -Wshift-negative-value -Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation)
add_compile_options(${UNIX_COMPILE_OPTIONS})
endif()


Expand Down
12 changes: 0 additions & 12 deletions arch/AArch64/AArch64AddressingModes.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,14 +823,6 @@ static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType12(uint8_t Imm)
}


#if defined( __has_warning )
# if __has_warning( "-Wmaybe-uninitialized" )
# define WARNING_SUPRESSED
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
# endif
#endif

/// Returns true if Imm is the concatenation of a repeating pattern of type T.
#define DEFINE_isSVEMaskOfIdenticalElements(T) \
static inline bool CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, T)(int64_t Imm) \
Expand All @@ -847,10 +839,6 @@ DEFINE_isSVEMaskOfIdenticalElements(int16_t);
DEFINE_isSVEMaskOfIdenticalElements(int32_t);
DEFINE_isSVEMaskOfIdenticalElements(int64_t);

#ifdef WARNING_SUPRESSED
#pragma GCC diagnostic pop
#endif

static inline bool AArch64_AM_isSVEMaskOfIdenticalElements64(int64_t Imm)
{
return true;
Expand Down

0 comments on commit aa28b3e

Please sign in to comment.