commit 52a36013a642f7f9daf675424c4ccb9754c17acb
parent b1813ad36adcfb16cc2a91206766134822c4d745
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 20 Jul 2023 17:29:25 +0200
Disable an Embree4 build warning
When included, the Embree4 rtcore_common.h header causes a compile-time
warning due to an enumerator value that exceeds the range of an int.
Note that this warning is disabled if this header is in a directory
defined by the '-isystem' option in gcc. And that's what CMake does and
that's why this warning was not visible through CMake.
The if rtcore_common.h inclusion is now surrounded by compiler
directives that disable this warning, and in fact we cannot disable it
other than by disabling the -Wpedantic option.
Diffstat:
4 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/src/suvm_backend.h b/src/suvm_backend.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 2020-2023 |Méso|Star> (contact@meso-star.com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef SUVM_BACKEND_H
+#define SUVM_BACKEND_H
+
+#include <rsys/rsys.h> /* COMPILER_<CL|GCC> */
+
+#ifdef COMPILER_GCC
+ /* Disable the "ISO C restricts enumerator values to range of 'int'" compiler
+ * warning in rtcore_common.h, line 293 (RTC_FEATURE_FLAG_ALL = 0xffffffff) */
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+
+#include <embree4/rtcore.h>
+
+#ifdef COMPILER_GCC
+ #pragma GCC diagnostic pop
+#endif
+
+#endif /* SUVM_BACKEND_H */
diff --git a/src/suvm_c.h b/src/suvm_c.h
@@ -16,8 +16,8 @@
#ifndef SUVM_C_H
#define SUVM_C_H
+#include "suvm_backend.h"
#include <rsys/rsys.h>
-#include <embree4/rtcore.h>
static FINLINE res_T
rtc_error_to_res_T(const enum RTCError err)
diff --git a/src/suvm_device.h b/src/suvm_device.h
@@ -16,8 +16,8 @@
#ifndef SUVM_DEVICE_H
#define SUVM_DEVICE_H
+#include "suvm_backend.h"
#include <rsys/ref_count.h>
-#include <embree4/rtcore.h>
struct logger;
struct mem_allocator;
diff --git a/src/suvm_volume.h b/src/suvm_volume.h
@@ -16,13 +16,13 @@
#ifndef SUVM_VOLUME_H
#define SUVM_VOLUME_H
+#include "suvm_backend.h"
+
#include <rsys/dynamic_array_u32.h>
#include <rsys/dynamic_array_float.h>
#include <rsys/float3.h>
#include <rsys/ref_count.h>
-#include <embree4/rtcore.h>
-
/*
* Tetrahedron geometric layout
*