]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3982] Last improvements
authorFrancis Dupont <fdupont@isc.org>
Sun, 8 Mar 2026 22:26:33 +0000 (23:26 +0100)
committerFrancis Dupont <fdupont@isc.org>
Thu, 7 May 2026 14:42:59 +0000 (16:42 +0200)
compiler-checks/chrono-same-duration.cc
meson.build

index f2727ebdbed6fc0d112fd8e1e145caf16a4838ed..fa33ab01455bbd36b7a4c355c82ced130500e275 100644 (file)
@@ -2,6 +2,8 @@
 #include <type_traits>
 
 int main() {
-    return(std::is_same<std::chrono::system_clock::duration,
-                        std::chrono::steady_clock::duration>::value ? 0 : 1);
+    static_assert(std::is_same<std::chrono::system_clock::duration,
+                               std::chrono::steady_clock::duration>::value,
+                  "CHRONO_SAME_DURATION");
+    return(0);
 }
index d4d47141128c91dc5fe8d7ff71eaf45dcadc1598..5165e84782a80238b771cc98649a60d7df007f79 100644 (file)
@@ -385,8 +385,6 @@ conf_data.set('HAVE_PGSQL', POSTGRESQL_DEP.found())
 
 #### Compiler Checks
 
-# The required keyword in cpp.run() is an 1.5.0 feature.
-
 cpp_standard = cpp.get_define('__cplusplus')
 message(f'Detected C++ standard (__cplusplus value) is @cpp_standard@.')
 cpp_std_opt = get_option('cpp_std')
@@ -405,12 +403,12 @@ if cpp_standard.version_compare('<201100')
     error('\n'.join(msgs))
 endif
 if cpp_standard.version_compare('<201400')
-    result = cpp.run(
+    result = cpp.compiles(
         fs.read('compiler-checks/boost-math-cpp14.cc'),
         name: 'BOOST_MATH_REQUIRES_CPP14',
         dependencies: [boost_dep, threads_dep],
     )
-    if result.returncode() != 0
+    if not result
         msgs = ['Boost Math requires at least C++14.']
         if cpp_std_opt == 'none'
             msgs += no_cpp_std_opt_msg
@@ -455,8 +453,8 @@ if not result
 endif
 
 if cpp.has_header('boost/regex.h', dependencies: [boost_dep], required: false)
-   result = cpp.has_define(
-       'BOOST_RE_REGEX_H',
+    result = cpp.has_define(
+        'BOOST_RE_REGEX_H',
         dependencies: [boost_dep, threads_dep],
         prefix: '#include <regex.h>',
     )
@@ -465,12 +463,11 @@ if cpp.has_header('boost/regex.h', dependencies: [boost_dep], required: false)
     endif
 endif
 
-# Rewrite this one as it does not work when cross compiling.
-result = cpp.run(
+result = cpp.compiles(
     fs.read('compiler-checks/chrono-same-duration.cc'),
     name: 'CHRONO_SAME_DURATION',
 )
-conf_data.set('CHRONO_SAME_DURATION', result.returncode() == 0)
+conf_data.set('CHRONO_SAME_DURATION', result)
 
 if CRYPTO_DEP.name() == openssl.name()
     result1 = cpp.compiles(
@@ -505,7 +502,10 @@ result = cpp.links(
 )
 conf_data.set('HAVE_OPTRESET', result)
 
-result = cpp.compiles(fs.read('compiler-checks/have-sa-len.cc'), name: 'HAVE_SA_LEN')
+result = cpp.compiles(
+    fs.read('compiler-checks/have-sa-len.cc'),
+    name: 'HAVE_SA_LEN',
+)
 conf_data.set('HAVE_SA_LEN', result)
 
 result = cpp.links(
@@ -777,7 +777,8 @@ report_conf_data.set('LD_ARGS', ' '.join(link_args))
 report_conf_data.set('PYTHON_PATH', PYTHON.full_path())
 report_conf_data.set('PYTHON_VERSION', PYTHON.version())
 report_conf_data.set('PKGPYTHONDIR', PKGPYTHONDIR)
-result = cpp.get_define('BOOST_LIB_VERSION',
+result = cpp.get_define(
+    'BOOST_LIB_VERSION',
     dependencies: [boost_dep, threads_dep],
     prefix: '#include <boost/version.hpp>',
 )