]> jfr.im git - irc/inspircd/inspircd.git/commitdiff
Fix building with the Intel C++ compiler.
authorSadie Powell <redacted>
Sat, 10 Dec 2022 06:46:18 +0000 (06:46 +0000)
committerSadie Powell <redacted>
Sat, 10 Dec 2022 06:58:39 +0000 (06:58 +0000)
- 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.

include/modules/server.h
make/configure.pm
make/template/main.mk
make/test/compiler_info.cpp
tools/test-build

index 63aa39e4a3e25100a51d355cdf07f72437c8c863..a7b30aee3529583183219211e244b843024d9f31 100644 (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
 
index 908980d56f596ae1fc57c4df35ec782744796a65..2b6c39df45ee0538d035ded0030a0cb0bfbdf522 100644 (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";
index 3130cbf061ba263939ea330d801bab666535d989..283574aeaaf8fb8b178791fed6a613781868289a 100644 (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
index 3563bddf07f720c32920f2bb274ba4e8f63d3f81..efd4380a36c78a24b120d7ef870bb9dad250ad1f 100644 (file)
 
 #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"
index 44452f8e60de616e2cef8d811941f44c4718c92c..0f8fc9db389b74a72c9443f1856e941f4c488f16 100755 (executable)
@@ -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!";