verbosity
This commit is contained in:
+23
-3
@@ -79,6 +79,17 @@ set(SKALACOIN_IS_SANITIZED "$<OR:$<CONFIG:Debug>,$<CONFIG:Strict>>")
|
|||||||
option(SKALACOIN_WERROR "Debug/Analyzer: treat warnings as errors (always on in Strict)" OFF)
|
option(SKALACOIN_WERROR "Debug/Analyzer: treat warnings as errors (always on in Strict)" OFF)
|
||||||
option(SKALACOIN_ENABLE_SANITIZERS "Debug config: AddressSanitizer + UndefinedBehaviorSanitizer" ON)
|
option(SKALACOIN_ENABLE_SANITIZERS "Debug config: AddressSanitizer + UndefinedBehaviorSanitizer" ON)
|
||||||
option(SKALACOIN_ENABLE_ANALYZER "Analyzer config: the compiler's static analyzer (GCC -fanalyzer)" ON)
|
option(SKALACOIN_ENABLE_ANALYZER "Analyzer config: the compiler's static analyzer (GCC -fanalyzer)" ON)
|
||||||
|
|
||||||
|
# How much of the control-flow path -fanalyzer prints per report. 1 lists only
|
||||||
|
# the state transitions (opened here / first close here / leaks here), which is
|
||||||
|
# what you want while triaging; raise it when a report needs the branch-by-branch
|
||||||
|
# path that explains how it got there. GCC silently accepts out-of-range values,
|
||||||
|
# so validate here instead.
|
||||||
|
set(ANALYZER_VERBOSITY 1 CACHE STRING "Analyzer config: -fanalyzer path detail, 0 (terse) to 5 (full)")
|
||||||
|
set_property(CACHE ANALYZER_VERBOSITY PROPERTY STRINGS 0 1 2 3 4 5)
|
||||||
|
if(NOT ANALYZER_VERBOSITY MATCHES "^[0-5]$")
|
||||||
|
message(FATAL_ERROR "ANALYZER_VERBOSITY must be an integer from 0 to 5, got '${ANALYZER_VERBOSITY}'")
|
||||||
|
endif()
|
||||||
option(SKALACOIN_ENABLE_HARDENING "All configs: stack protector, _FORTIFY_SOURCE, RELRO/NOW, CFI" ON)
|
option(SKALACOIN_ENABLE_HARDENING "All configs: stack protector, _FORTIFY_SOURCE, RELRO/NOW, CFI" ON)
|
||||||
option(SKALACOIN_ENABLE_LTO "Optimized configs: link-time optimization" OFF)
|
option(SKALACOIN_ENABLE_LTO "Optimized configs: link-time optimization" OFF)
|
||||||
|
|
||||||
@@ -229,10 +240,11 @@ else()
|
|||||||
)
|
)
|
||||||
# -fanalyzer is a whole-path symbolic execution pass (leaks, double
|
# -fanalyzer is a whole-path symbolic execution pass (leaks, double
|
||||||
# free, use-after-free, NULL derefs across function boundaries).
|
# free, use-after-free, NULL derefs across function boundaries).
|
||||||
# Verbosity 1 prints just the state transitions; raise it to 2+ when a
|
|
||||||
# report needs its full control-flow path.
|
|
||||||
if(SKALACOIN_ENABLE_ANALYZER)
|
if(SKALACOIN_ENABLE_ANALYZER)
|
||||||
skalacoin_append_supported_c_flags(SKALACOIN_ANALYZER_FLAGS -fanalyzer-verbosity=1 -fanalyzer)
|
skalacoin_append_supported_c_flags(SKALACOIN_ANALYZER_FLAGS
|
||||||
|
-fanalyzer-verbosity=${ANALYZER_VERBOSITY}
|
||||||
|
-fanalyzer
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
# Clang-only diagnostics. Clang has no in-compiler equivalent of
|
# Clang-only diagnostics. Clang has no in-compiler equivalent of
|
||||||
@@ -538,6 +550,14 @@ endif()
|
|||||||
target_include_directories(node PRIVATE
|
target_include_directories(node PRIVATE
|
||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
# khash is vendored third-party code we cannot fix, and it accounts for half the
|
||||||
|
# warnings under Strict. SYSTEM turns -I into -isystem, which suppresses
|
||||||
|
# diagnostics from headers found through it. It needs its own search path: via
|
||||||
|
# ${PROJECT_SOURCE_DIR}/include the header resolves through the plain -I above
|
||||||
|
# and stays a normal header, so the sources include it as <khash.h>.
|
||||||
|
target_include_directories(node SYSTEM PRIVATE
|
||||||
|
${PROJECT_SOURCE_DIR}/include/khash
|
||||||
|
)
|
||||||
target_compile_options(node PRIVATE
|
target_compile_options(node PRIVATE
|
||||||
"${SKALACOIN_C_WARNINGS}"
|
"${SKALACOIN_C_WARNINGS}"
|
||||||
"${SKALACOIN_INSTRUMENT_COMPILE}"
|
"${SKALACOIN_INSTRUMENT_COMPILE}"
|
||||||
|
|||||||
+11
-1
@@ -6,7 +6,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <khash/khash.h>
|
#include <khash.h>
|
||||||
#include <crypto/crypto.h>
|
#include <crypto/crypto.h>
|
||||||
#include <block/transaction.h>
|
#include <block/transaction.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -33,7 +33,17 @@ typedef struct {
|
|||||||
// TODO: Additional things
|
// TODO: Additional things
|
||||||
} balance_sheet_entry_t;
|
} balance_sheet_entry_t;
|
||||||
|
|
||||||
|
// KHASH_INIT expands to khash's own implementation, which is not -Wconversion
|
||||||
|
// clean. -isystem silences the header itself but not code expanded from its
|
||||||
|
// macros, because the diagnostic is attributed to this line.
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
|
#endif
|
||||||
KHASH_INIT(balance_sheet_map_m, key32_t, balance_sheet_entry_t, 1, hash_key32, eq_key32)
|
KHASH_INIT(balance_sheet_map_m, key32_t, balance_sheet_entry_t, 1, hash_key32, eq_key32)
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
extern khash_t(balance_sheet_map_m)* sheetMap;
|
extern khash_t(balance_sheet_map_m)* sheetMap;
|
||||||
|
|
||||||
void BalanceSheet_Init();
|
void BalanceSheet_Init();
|
||||||
|
|||||||
+10
-1
@@ -2,11 +2,20 @@
|
|||||||
#define TXMEMPOOL_H
|
#define TXMEMPOOL_H
|
||||||
|
|
||||||
#include <block/transaction.h>
|
#include <block/transaction.h>
|
||||||
#include <khash/khash.h>
|
#include <khash.h>
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
|
|
||||||
|
// See balance_sheet.h: khash's macro expansion is not -Wconversion clean, and
|
||||||
|
// -isystem does not cover code expanded from a system header's macros.
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
|
#endif
|
||||||
KHASH_INIT(tx_mempool_map_m, key32_t, signed_transaction_t, 1, hash_key32, eq_key32)
|
KHASH_INIT(tx_mempool_map_m, key32_t, signed_transaction_t, 1, hash_key32, eq_key32)
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
extern khash_t(tx_mempool_map_m)* txMempool;
|
extern khash_t(tx_mempool_map_m)* txMempool;
|
||||||
|
|
||||||
void TxMempool_Init();
|
void TxMempool_Init();
|
||||||
|
|||||||
Reference in New Issue
Block a user