[gtk/gskglrenderer-avoid-gccism] gskglrenderer.c: Avoid GCCism




commit 902f00584b5056ed748785e59715cd3fb00bd224
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jul 31 18:06:25 2020 +0800

    gskglrenderer.c: Avoid GCCism
    
    Don't unconditionally use __attribute__((always_inline)), but define a
    macro that achieves this for GCC/CLang and Visual Studio.

 gsk/gl/gskglrenderer.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index e2e5d85320..438901f0ca 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -47,6 +47,12 @@
 #define OP_PRINT(format, ...)
 #endif
 
+#if defined (__GNUC__) || defined (__clang__)
+# define ALWAYS_INLINE __attribute__((always_inline))
+#elif defined (_MSC_VER)
+# define ALWAYS_INLINE __forceinline
+#endif
+
 #define INIT_PROGRAM_UNIFORM_LOCATION(program_name, uniform_basename) \
               G_STMT_START{\
                 programs->program_name ## _program.program_name.uniform_basename ## _location = \
@@ -191,7 +197,7 @@ dump_node (GskRenderNode *node,
   cairo_surface_destroy (surface);
 }
 
-static inline bool G_GNUC_PURE __attribute__((always_inline))
+static inline bool G_GNUC_PURE ALWAYS_INLINE
 node_is_invisible (const GskRenderNode *node)
 {
   return node->bounds.size.width == 0.0f ||
@@ -200,7 +206,7 @@ node_is_invisible (const GskRenderNode *node)
          isnan (node->bounds.size.height);
 }
 
-static inline bool G_GNUC_PURE __attribute__((always_inline))
+static inline bool G_GNUC_PURE ALWAYS_INLINE
 graphene_rect_intersects (const graphene_rect_t *r1,
                           const graphene_rect_t *r2)
 {
@@ -216,7 +222,7 @@ graphene_rect_intersects (const graphene_rect_t *r1,
   return true;
 }
 
-static inline bool G_GNUC_PURE __attribute__((always_inline))
+static inline bool G_GNUC_PURE ALWAYS_INLINE
 _graphene_rect_contains_rect (const graphene_rect_t *r1,
                               const graphene_rect_t *r2)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]