shithub: libmujs

Download patch

ref: e7ba87678f2f1edcb9fcb0564fa7a140ae4fe6bc
parent: 3bd234c685180c507e4eb40b1ad3689d4b9188ce
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Nov 4 08:27:25 EDT 2021

Silence harmless GCC warnings.

--- a/jsbuiltin.c
+++ b/jsbuiltin.c
@@ -98,8 +98,10 @@
 	js_pushboolean(J, isfinite(n));
 }
 
-static void Encode(js_State *J, const char *str, const char *unescaped)
+static void Encode(js_State *J, const char *str_, const char *unescaped)
 {
+	/* NOTE: volatile to silence GCC warning about longjmp clobbering a variable */
+	const char * volatile str = str_;
 	js_Buffer *sb = NULL;
 
 	static const char *HEX = "0123456789ABCDEF";
@@ -126,8 +128,10 @@
 	js_free(J, sb);
 }
 
-static void Decode(js_State *J, const char *str, const char *reserved)
+static void Decode(js_State *J, const char *str_, const char *reserved)
 {
+	/* NOTE: volatile to silence GCC warning about longjmp clobbering a variable */
+	const char * volatile str = str_;
 	js_Buffer *sb = NULL;
 	int a, b;
 
--- a/json.c
+++ b/json.c
@@ -362,7 +362,9 @@
 {
 	js_Buffer *sb = NULL;
 	char buf[12];
-	const char *s, *gap;
+	/* NOTE: volatile to silence GCC warning about longjmp clobbering a variable */
+	const char * volatile gap;
+	const char *s;
 	int n;
 
 	gap = NULL;