From 433c1ba079fcb09de12cfa5bdbd2ce6eda333fb7 Mon Sep 17 00:00:00 2001 From: Mika Lindqvist Date: Thu, 15 Feb 2024 02:38:41 +0200 Subject: [PATCH] Initial support for compiling with Intel C++ Compiler (icc/icpc). --- CMakeLists.txt | 12 +++++++++++- src/CryptoNoteCore/AddBlockErrorCondition.h | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6a3c993..cff801f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,8 @@ else() set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=unused-function -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wno-error=unused-result") if(CMAKE_C_COMPILER_ID STREQUAL "Clang") set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration -Wno-error=unused-function -Wno-error=missing-braces") + elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") + set(WARNINGS "${WARNINGS} -Wno-error=maybe-uninitialized -Wno-error=clobbered -Wno-error=unused-but-set-variable -diag-disable=10441 -diag-disable 11074 -diag-disable 11076") else() set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=clobbered -Wno-error=unused-but-set-variable") endif() @@ -137,7 +139,11 @@ else() if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0) set(CXX_WARNINGS "${CXX_WARNINGS} -Wno-redundant-move") endif() - set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes") + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + set(C_WARNINGS "-Wold-style-definition -Wstrict-prototypes") + else() + set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes") + endif() set(CXX_WARNINGS "${CXX_WARNINGS} -Wno-reorder -Wno-missing-field-initializers") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${MINGW_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG}") if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") @@ -199,6 +205,10 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT ANDROID) set(CMAKE_EXE_LINKER_FLAGS "-pthread") endif() +if(CMAKE_C_COMPILER_ID MATCHES "Intel") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -diag-disable=10441") +endif() + set(OLD_LIB_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) if(STATIC) if(STATIC AND MINGW) diff --git a/src/CryptoNoteCore/AddBlockErrorCondition.h b/src/CryptoNoteCore/AddBlockErrorCondition.h index a4ff490a..4a74a7f0 100644 --- a/src/CryptoNoteCore/AddBlockErrorCondition.h +++ b/src/CryptoNoteCore/AddBlockErrorCondition.h @@ -1,4 +1,5 @@ // Copyright (c) 2012-2017, The CryptoNote developers, The Bytecoin developers +// Copyright (c) 2024, The Talleo developers // // This file is part of Bytecoin. // @@ -59,7 +60,11 @@ class AddBlockErrorConditionCategory: public std::error_category { } } - virtual bool equivalent(const std::error_code& errorCode, int condition) const throw() override { + virtual bool equivalent(int code, const std::error_condition& condition) const noexcept override { + return default_error_condition(code) == condition; + } + + virtual bool equivalent(const std::error_code& errorCode, int condition) const throw() override { AddBlockErrorCondition code = static_cast(condition); switch(code) {