Fix building with the Intel C++ compiler.

- Fix adding -Wshadow in the compiler flags twice.
- Detect the new Clang-based Intel compiler as well as the old one.
- Silence some deprecation warnings using Intel syntax.
This commit is contained in:
Sadie Powell 2022-12-10 06:46:18 +00:00
parent c3294e9f64
commit 513309fc68
5 changed files with 14 additions and 7 deletions

View File

@ -23,7 +23,9 @@
#pragma once
#ifdef __GNUC__
#if defined __INTEL_COMPILER
# pragma warning(disable:1478)
#elif defined __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
@ -155,7 +157,9 @@ class ServerEventListener
}
};
#ifdef __GNUC__
#if defined __INTEL_COMPILER
# pragma warning(enable:1478)
#elif defined __GNUC__
# pragma GCC diagnostic pop
#endif

View File

@ -176,7 +176,7 @@ non-interactive configuration is started and any omitted values are defaulted.
<|BOLD CXX=<NAME>|> Sets the C++ compiler to use when building the
server. If not specified then the build system
will search for c++, g++, clang++ or icpc.
will search for c++, g++, clang++, icpx, or icpc.
<|BOLD INSPIRCD_VERBOSE=<0|1>|> Shows additional information for debugging.
If you have any problems with configuring InspIRCd then visit our IRC channel
@ -266,7 +266,7 @@ sub get_compiler_info($) {
}
sub find_compiler {
my @compilers = qw(c++ g++ clang++ icpc);
my @compilers = qw(c++ g++ clang++ icpx icpc);
for my $compiler (shift // @compilers) {
return $compiler if __test_compiler $compiler;
return "xcrun $compiler" if $^O eq 'darwin' && __test_compiler "xcrun $compiler";

View File

@ -45,7 +45,7 @@ SYSTEM = @SYSTEM_NAME@
SOURCEPATH = @SOURCE_DIR@
BUILDPATH ?= $(SOURCEPATH)/build/@COMPILER_NAME@-@COMPILER_VERSION@
SOCKETENGINE = @SOCKETENGINE@
CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow
CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter
LDLIBS = -lstdc++
CORELDFLAGS = -rdynamic -L.
PICLDFLAGS = -fPIC -shared -rdynamic

View File

@ -19,9 +19,12 @@
#include <iostream>
#if defined __INTEL_COMPILER // Also defines __clang__ and __GNUC__
#if defined __INTEL_COMPILER // Also defines __GNUC__
# define INSPIRCD_COMPILER_NAME "Intel"
# define INSPIRCD_COMPILER_VERSION (__INTEL_COMPILER / 100) << '.' << (__INTEL_COMPILER % 100)
#elif defined __INTEL_CLANG_COMPILER // Also defines __clang__
# define INSPIRCD_COMPILER_NAME "IntelClang"
# define INSPIRCD_COMPILER_VERSION (__INTEL_CLANG_COMPILER / 10000) << '.' << ((__INTEL_CLANG_COMPILER % 10000) / 100)
#elif defined __clang__ // Also defines __GNUC__
# if defined __apple_build_version__
# define INSPIRCD_COMPILER_NAME "AppleClang"

View File

@ -35,7 +35,7 @@ $ENV{INSPIRCD_VERBOSE} = 1;
execute 'git', 'clean', '-dfx';
my $root = dirname $RealDir;
my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpx icpc);
for my $compiler (@compilers) {
if (system "$compiler -v > /dev/null 2>&1") {
say STDERR "Skipping $compiler as it is not installed on this system!";