summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-08-28 23:01:45 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-08-30 00:54:31 +0300
commit234cdf44eedc49fa6c9cf97fa14824a800af881b (patch)
treee4022ff579f6e345ab7dfb5fc23f1009b03edf81
parent8c9d3135b8fe78941128f126278df69a9f0807fd (diff)
downloadbdwgc-234cdf44eedc49fa6c9cf97fa14824a800af881b.tar.gz
Change EMSCRIPTEN macro for internal use to no-underscore format
(refactoring) * include/private/gcconfig.h [__EMSCRIPTEN__] (EMSCRIPTEN): New macro. * include/private/gcconfig.h [I386]: Check EMSCRIPTEN macro instead of __EMSCRIPTEN__. * mach_dep.c [!HAVE_PUSH_REGS] (GC_with_callee_saves_pushed): Likewise. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN]: Likewise. * os_dep.c [USE_MUNMAP && !USE_WINALLOC && !SN_TARGET_PS3 && !AIX && !CYGWIN32 && !HAIKU && !HPUX] (GC_unmap): Likewise. * os_dep.c [!THREADS]: Likewise. * tests/test.c (reverse_test_inner): Likewise.
-rw-r--r--include/private/gcconfig.h3
-rw-r--r--mach_dep.c2
-rw-r--r--os_dep.c6
-rw-r--r--tests/test.c6
4 files changed, 9 insertions, 8 deletions
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index b4d1772b..2b8c2145 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -693,6 +693,7 @@ EXTERN_C_BEGIN
# endif
# if defined(__EMSCRIPTEN__)
+# define EMSCRIPTEN
# define I386
# define mach_type_known
# endif
@@ -1397,7 +1398,7 @@ EXTERN_C_BEGIN
# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff))
# define STACKBOTTOM ((ptr_t)0x3ffff000)
# endif
-# if defined(__EMSCRIPTEN__)
+# ifdef EMSCRIPTEN
# define OS_TYPE "EMSCRIPTEN"
# define DATASTART (ptr_t)ALIGNMENT
# define DATAEND (ptr_t)ALIGNMENT
diff --git a/mach_dep.c b/mach_dep.c
index 18750f5d..7335d9c6 100644
--- a/mach_dep.c
+++ b/mach_dep.c
@@ -232,7 +232,7 @@ GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
# if defined(HAVE_PUSH_REGS)
GC_push_regs();
-# elif defined(__EMSCRIPTEN__)
+# elif defined(EMSCRIPTEN)
/* No-op, "registers" are pushed in GC_push_other_roots(). */
# else
# if defined(UNIX_LIKE) && !defined(NO_GETCONTEXT)
diff --git a/os_dep.c b/os_dep.c
index 18122509..6a4e2d21 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1229,7 +1229,7 @@ GC_INNER size_t GC_page_size = 0;
return (ptr_t)GC_get_main_symbian_stack_base();
}
# define GET_MAIN_STACKBASE_SPECIAL
-#elif defined(__EMSCRIPTEN__)
+#elif defined(EMSCRIPTEN)
# include <emscripten.h>
static void* emscripten_stack_base;
@@ -2645,7 +2645,7 @@ GC_INNER void GC_unmap(ptr_t start, size_t bytes)
/* with PROT_NONE seems to work fine. */
if (mprotect(start_addr, len, PROT_NONE))
ABORT("mprotect(PROT_NONE) failed");
-# elif defined(__EMSCRIPTEN__)
+# elif defined(EMSCRIPTEN)
/* Nothing to do, mmap(PROT_NONE) is not supported and */
/* mprotect() is just a no-op. */
# else
@@ -2796,7 +2796,7 @@ GC_INNER void GC_unmap_gap(ptr_t start1, size_t bytes1, ptr_t start2,
/* thread stacks. */
#ifndef THREADS
-# if defined(__EMSCRIPTEN__)
+# ifdef EMSCRIPTEN
static void scan_regs_cb(void *begin, void *end)
{
GC_push_all_stack((ptr_t)begin, (ptr_t)end);
diff --git a/tests/test.c b/tests/test.c
index aafe6a8f..04b1efd4 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -790,7 +790,7 @@ void *GC_CALLBACK reverse_test_inner(void *data)
GC_FREE((void *)e);
check_ints(b,1,50);
-# ifndef __EMSCRIPTEN__
+# ifndef EMSCRIPTEN
check_ints(a_get(),1,49);
# else
/* FIXME: gctest fails unless check_ints(a_get(), ...) are skipped. */
@@ -800,7 +800,7 @@ void *GC_CALLBACK reverse_test_inner(void *data)
b = reverse(reverse(b));
}
check_ints(b,1,50);
-# ifndef __EMSCRIPTEN__
+# ifndef EMSCRIPTEN
check_ints(a_get(),1,49);
# endif
for (i = 0; i < 10 * (NTHREADS+1); i++) {
@@ -820,7 +820,7 @@ void *GC_CALLBACK reverse_test_inner(void *data)
AO_fetch_and_add1(&realloc_count);
# endif
}
-# ifndef __EMSCRIPTEN__
+# ifndef EMSCRIPTEN
check_ints(a_get(),1,49);
# endif
check_ints(b,1,50);