Thread (2 messages) 2 messages, 2 authors, 2025-07-28

Re: [PATCH 2/2] xdiff: optimize xdl_hash_record_verbatim

From: Alexander Monakov <hidden>
Date: 2025-07-28 20:57:21

On Mon, 28 Jul 2025, Junio C Hamano wrote:
Alexander Monakov [off-list ref] writes:
quoted
+/*
+ * Compiler reassociation barrier: pretend to modify X and Y to disallow
+ * changing evaluation order with respect to following uses of X and Y.
+ */
+#ifdef __GNUC__
+#define REASSOC_FENCE(x, y) asm("" : "+r"(x), "+r"(y))
+#else
+#define REASSOC_FENCE(x, y)
+#endif
With gcc we can build, but with clang, we unfortunately get this:

    $ make CC=clang DEVELOPER=YesPlease
    xdiff/xutils.c:330:4: error: extension used [-Werror,-Wlanguage-extension-token]
      330 |                         REASSOC_FENCE(c0, ha);
          |                         ^
    xdiff/xutils.c:302:29: note: expanded from macro 'REASSOC_FENCE'
      302 | #define REASSOC_FENCE(x, y) asm("" : "+r"(x), "+r"(y))
          |                             ^
Sorry, wasn't aware that Clang would warn. The solution is to spell 'asm' with
double underscores, __asm__.  I'll make this change if I post a v2.

Thanks.
Alexander
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help