Fix stringification of macro value
level of indirection because STRINGIFY(X) produces "X" regardless of
what value X is defined to be.
Bug: b/174801963
Change-Id: I1b2c1c987417ee1a97e109b52f41bdc865db8c77
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/50908
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/ExecutableMemory.cpp b/src/Reactor/ExecutableMemory.cpp
index a66bc6d..504dceb 100644
--- a/src/Reactor/ExecutableMemory.cpp
+++ b/src/Reactor/ExecutableMemory.cpp
@@ -42,6 +42,9 @@
# define __x86__
#endif
+#define STRINGIFY(x) #x
+#define MACRO_STRINGIFY(x) STRINGIFY(x)
+
namespace rr {
namespace {
@@ -159,7 +162,7 @@
// MAP_PRIVATE so that underlying pages aren't shared.
int anonymousFd()
{
- static int fd = memfd_create(#REACTOR_ANONYMOUS_MMAP_NAME, 0);
+ static int fd = memfd_create(MACRO_STRINGIFY(REACTOR_ANONYMOUS_MMAP_NAME), 0);
return fd;
}