# HG changeset patch
# User Petter T. <petter.vilhelm@gmail.com>
# Date 1701729432 -3600
#      Mon Dec 04 23:37:12 2023 +0100
# Node ID 7bb47b0035c2886bf357b136f4aa5ec5ecc714fb
# Parent  17c289a7a8e495ae3ed1da8cbc9ca3a7d26168f7
if-guard function attributes in ov-vm.h (bug #64977)

To avoid possible problems with non GNU compatible compilers.

* ov-vm.h: (~octave_value_vm): Guard function attributes
           (vm_need_dispatch_push): ...
           (vm_need_dispatch_assign_rhs)
           (vm_need_dispatch_assign_lhs)
           (type_id)
           (is_matrix_type)

diff -r 17c289a7a8e4 -r 7bb47b0035c2 libinterp/octave-value/ov-vm.h
--- a/libinterp/octave-value/ov-vm.h	Mon Dec 04 17:14:52 2023 +0100
+++ b/libinterp/octave-value/ov-vm.h	Mon Dec 04 23:37:12 2023 +0100
@@ -79,7 +79,13 @@
       a.m_rep = nullptr;
   }
 
-  ~octave_value_vm () __attribute__ ((always_inline))
+#if defined (__GNUC__)
+#define OCTAVE_VALUE_VM_ALWAYSINLINE_FN_ATTR __attribute__ ((always_inline))
+#else
+#define OCTAVE_VALUE_VM_ALWAYSINLINE_FN_ATTR
+#endif
+
+  ~octave_value_vm () OCTAVE_VALUE_VM_ALWAYSINLINE_FN_ATTR
   {
       // Because we define a move constructor and a move assignment
       // operator, rep may be a nullptr here.  We should only need to
@@ -149,19 +155,26 @@
     return *this;
   }
 
-  bool vm_need_dispatch_push () __attribute__ ((pure, always_inline, nothrow))
+#if defined (__GNUC__)
+#define OCTAVE_VALUE_VM_PURE_ETC_FN_ATTR __attribute__ ((pure, always_inline, nothrow))
+#else
+#define OCTAVE_VALUE_VM_PURE_ETC_FN_ATTR
+#endif
+
+
+  bool vm_need_dispatch_push () OCTAVE_VALUE_VM_PURE_ETC_FN_ATTR
   { return m_rep->vm_need_dispatch_push (); }
 
-  bool vm_need_dispatch_assign_rhs () __attribute__ ((pure, always_inline, nothrow))
+  bool vm_need_dispatch_assign_rhs () OCTAVE_VALUE_VM_PURE_ETC_FN_ATTR
   { return m_rep->vm_need_dispatch_assign_rhs (); }
 
-  bool vm_need_dispatch_assign_lhs () __attribute__ ((pure, always_inline, nothrow))
+  bool vm_need_dispatch_assign_lhs () OCTAVE_VALUE_VM_PURE_ETC_FN_ATTR
   { return m_rep->vm_need_dispatch_assign_lhs (); }
 
-  int type_id() const __attribute__ ((pure, always_inline, nothrow))
+  int type_id() const OCTAVE_VALUE_VM_PURE_ETC_FN_ATTR
   { return m_rep->type_id (); }
 
-  bool is_matrix_type () const __attribute__ ((pure, always_inline, nothrow))
+  bool is_matrix_type () const OCTAVE_VALUE_VM_PURE_ETC_FN_ATTR
   { return m_rep->is_matrix_type (); }
 
   octave_base_value *m_rep;
