From aed2ed2a595f7689e5878345d214700f63957180 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Tue, 16 Mar 2021 03:32:52 -0400
Subject: [PATCH] Fix indentation warning from Clang in JS header

It would be fine if this only warned while building JS, we're used
to ignoring that, but this bugger warns while building Synchronet
stuff.
---
 3rdp/build/GNUmakefile                         |  3 ++-
 3rdp/build/js-Wno-misleading-indentation.patch | 13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 3rdp/build/js-Wno-misleading-indentation.patch

diff --git a/3rdp/build/GNUmakefile b/3rdp/build/GNUmakefile
index 491709b24a..8e615d93a1 100644
--- a/3rdp/build/GNUmakefile
+++ b/3rdp/build/GNUmakefile
@@ -59,7 +59,7 @@ $(JS_SRC): | $(3RDPSRCDIR)
 $(JS_IDIR): | $(3RDPODIR)
 	$(QUIET)$(IFNOTEXIST) mkdir $(JS_IDIR)
 
-$(JSLIB_BUILD): $(3RDP_ROOT)$(DIRSEP)dist/libmozjs.tgz $(3RDP_ROOT)$(DIRSEP)build/js_src_jsnativestack_cpp.patch $(3RDP_ROOT)$(DIRSEP)build/js-configure.patch $(3RDP_ROOT)$(DIRSEP)build/js-configure.in.patch $(3RDP_ROOT)$(DIRSEP)build/imacro-asm-fix.patch $(3RDP_ROOT)$(DIRSEP)build/js-volatile-outside-functions.patch | $(JS_SRC) $(JS_IDIR)
+$(JSLIB_BUILD): $(3RDP_ROOT)$(DIRSEP)dist/libmozjs.tgz $(3RDP_ROOT)$(DIRSEP)build/js_src_jsnativestack_cpp.patch $(3RDP_ROOT)$(DIRSEP)build/js-configure.patch $(3RDP_ROOT)$(DIRSEP)build/js-configure.in.patch $(3RDP_ROOT)$(DIRSEP)build/imacro-asm-fix.patch $(3RDP_ROOT)$(DIRSEP)build/js-volatile-outside-functions.patch $(3RDP_ROOT)$(DIRSEP)build/js-Wno-misleading-indentation.patch | $(JS_SRC) $(JS_IDIR)
 	@echo Creating $@ ...
 	$(QUIET)-rm -rf $(JS_SRC)/*
 	$(QUIET)tar -xzC $(JS_SRC) -f $(3RDPDISTDIR)$(DIRSEP)libmozjs.tgz
@@ -69,6 +69,7 @@ $(JSLIB_BUILD): $(3RDP_ROOT)$(DIRSEP)dist/libmozjs.tgz $(3RDP_ROOT)$(DIRSEP)buil
 	$(QUIET)patch -b -p0 -d $(JS_SRC) < js-configure.in.patch
 	$(QUIET)patch -b -p0 -d $(JS_SRC) < imacro-asm-fix.patch
 	$(QUIET)patch -b -p0 -d $(JS_SRC) < js-volatile-outside-functions.patch
+	$(QUIET)patch -b -p0 -d $(JS_SRC) < js-Wno-misleading-indentation.patch
 	-$(QUIET)cd $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src && autoconf-2.13
 	$(QUIET)cd $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src && env $(JS_CONFIGURE_ENV) ./configure $(JS_CONFIGURE_ARGS)
 	$(QUIET)$(MAKE) -C $(JS_SRC)$(DIRSEP)js-1.8.5$(DIRSEP)js$(DIRSEP)src
diff --git a/3rdp/build/js-Wno-misleading-indentation.patch b/3rdp/build/js-Wno-misleading-indentation.patch
new file mode 100644
index 0000000000..9bbfdb360b
--- /dev/null
+++ b/3rdp/build/js-Wno-misleading-indentation.patch
@@ -0,0 +1,13 @@
+--- js-1.8.5/js/src/jsutil.h.orig	2021-03-16 03:30:09.825129000 -0400
++++ js-1.8.5/js/src/jsutil.h	2021-03-16 03:30:36.201546000 -0400
+@@ -301,8 +301,8 @@
+     void *memory = js_malloc(numBytes);
+     if (!memory)
+         return NULL;
+-	*(size_t *)memory = n;
+-	memory = (void*)(uintptr_t(memory) + JSMinAlignment);
++    *(size_t *)memory = n;
++    memory = (void*)(uintptr_t(memory) + JSMinAlignment);
+     return new(memory) T[n];
+ }
+ 
-- 
GitLab