Skip to content

Commit 0ecd7c6

Browse files
committed
fix build with recent versions of clang. Small fixes
1 parent 4310fea commit 0ecd7c6

5 files changed

Lines changed: 31 additions & 14 deletions

File tree

include/MGIS/Behaviour/MaterialStateManager.hxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,12 @@ namespace mgis::behaviour {
452452
* group.
453453
*
454454
* \param[in] ctx: execution context
455+
* \param[in] b: behaviour
455456
* \param[in] g: group
456457
*/
457458
MGIS_EXPORT [[nodiscard]] std::optional<MaterialStateManagerRestoreOptions>
458459
getGreedyMaterialStateManagerRestoreOptions(Context&,
460+
const Behaviour&,
459461
const H5::Group&) noexcept;
460462
/*!
461463
* \brief restore a `MaterialStateManager` from a HDF5 group

include/MGIS/Config-c.h

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,41 @@
4646
#define MGIS_VISIBILITY_EXPORT __declspec(dllexport)
4747
#define MGIS_VISIBILITY_LOCAL
4848
#else /* defined _WIN32 || defined __CYGWIN__ */
49-
#if (defined __GNUC__) && (!defined __INTEL_COMPILER)
49+
#if (defined __GNUC__) && (!defined __INTEL_COMPILER) && \
50+
(!defined __NVCOMPILER) && (!defined __clang__)
5051
#if __GNUC__ >= 4
51-
#define MGIS_VISIBILITY_IMPORT __attribute__((visibility("default")))
52-
#define MGIS_VISIBILITY_EXPORT __attribute__((visibility("default")))
53-
#define MGIS_VISIBILITY_LOCAL __attribute__((visibility("hidden")))
54-
#else /* __GNUC__ >= 4 */
52+
#define MGIS_VISIBILITY_IMPORT [[gnu::visibility("default")]]
53+
#define MGIS_VISIBILITY_EXPORT [[gnu::visibility("default")]]
54+
#define MGIS_VISIBILITY_LOCAL [[gnu::visibility("hidden")]]
55+
#else /*__GNUC__ >= 4 */
5556
#define MGIS_VISIBILITY_IMPORT
5657
#define MGIS_VISIBILITY_EXPORT
5758
#define MGIS_VISIBILITY_LOCAL
58-
#endif /* __GNUC__ >= 4 */
59+
#endif /* LIB_MGIS_CONFIG_HXX */
5960
#elif defined __INTEL_COMPILER
61+
#define MGIS_VISIBILITY_IMPORT [[gnu::visibility("default")]]
62+
#define MGIS_VISIBILITY_EXPORT [[gnu::visibility("default")]]
63+
#define MGIS_VISIBILITY_LOCAL [[gnu::visibility("hidden")]]
64+
#elif (defined __NVCOMPILER)
6065
#define MGIS_VISIBILITY_IMPORT __attribute__((visibility("default")))
6166
#define MGIS_VISIBILITY_EXPORT __attribute__((visibility("default")))
6267
#define MGIS_VISIBILITY_LOCAL __attribute__((visibility("hidden")))
63-
#else /* defined __INTEL_COMPILER */
68+
#elif defined __clang__
69+
#if __clang_major__ >= 18
70+
#define MGIS_VISIBILITY_IMPORT [[gnu::visibility("default")]]
71+
#define MGIS_VISIBILITY_EXPORT [[gnu::visibility("default")]]
72+
#define MGIS_VISIBILITY_LOCAL [[gnu::visibility("hidden")]]
73+
#else /* __clang_major__ >= 18 */
74+
#define MGIS_VISIBILITY_IMPORT __attribute__((visibility("default")))
75+
#define MGIS_VISIBILITY_EXPORT __attribute__((visibility("default")))
76+
#define MGIS_VISIBILITY_LOCAL __attribute__((visibility("hidden")))
77+
#endif /* __clang_major__ >= 18 */
78+
#else
6479
#define MGIS_VISIBILITY_IMPORT
6580
#define MGIS_VISIBILITY_EXPORT
6681
#define MGIS_VISIBILITY_LOCAL
67-
#endif /* defined __INTEL_COMPILER */
68-
#endif /* defined _WIN32 || defined _WIN64 ||defined __CYGWIN__ */
82+
#endif /* LIB_MGIS_CONFIG_HXX */
83+
#endif /* LIB_MGIS_CONFIG_HXX */
6984

7085
#ifdef MGIS_REAL_TYPE
7186
/*! \brief alias to the numeric type used in the library */

src/HDF5Support.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,4 @@ namespace mgis::utilities::hdf5 {
393393
return false;
394394
} // end of restore
395395

396-
} // end of namespace mgis::utilities::hdf5
396+
} // end of namespace mgis::utilities::hdf5

src/MaterialStateManager.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ namespace mgis::behaviour {
877877
if ((opts.restore_stored_energies) && (s.b.computesStoredEnergy)) {
878878
if (!read(ctx, s.stored_energies, g, "stored_energies")) {
879879
return ctx.registerErrorMessage("restoring stored energies failed");
880-
return false;
881880
}
882881
}
883882
if ((opts.restore_dissipated_energies) && (s.b.computesDissipatedEnergy)) {

tests/ErrorBacktraceTest.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <utility>
12
#include <string_view>
23
#include "MGIS/Raise.hxx"
34
#include "MGIS/ErrorBacktrace.hxx"
@@ -51,7 +52,7 @@ int main() {
5152
try {
5253
raise("invalid argument");
5354
} catch (...) {
54-
registerExceptionInErrorBacktrace(e);
55+
std::ignore = registerExceptionInErrorBacktrace(e);
5556
}
5657
expect_eq(e.getRawErrorMessage(), "invalid argument");
5758
} // end of ConstructTest
@@ -62,9 +63,9 @@ int main() {
6263
} // end of ConstructTest
6364
{
6465
ErrorBacktrace e;
65-
e.registerErrorMessage(
66+
std::ignore = e.registerErrorMessage(
6667
"first error message\nwith details on multiple lines");
67-
e.registerErrorMessage("parent error message");
68+
std::ignore = e.registerErrorMessage("parent error message");
6869
expect_eq(e.getRawErrorMessage(),
6970
"parent error message\n"
7071
"* first error message\n"

0 commit comments

Comments
 (0)