summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2017-05-10 13:10:23 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-05-12 09:22:25 +0000
commit6b1069c4073ba51bdd18a716955ee37915ef89dd (patch)
tree580f53283fc21118d1393c56ded54f2ee4e88105 /src/sim
parent32d99f43199ab9a5223c7ba90a63ed224e18e6bb (diff)
downloadgem5-6b1069c4073ba51bdd18a716955ee37915ef89dd.tar.xz
syscall_emul: Fix undefined macro behavior
Clang's UBSAN implementation complains about macros that expand to expressions that contain 'defined'. Explicitly set the various feature macros to 1 or 0 to avoid this issue. Change-Id: Iba239dacfe526c43ab9c5da5183a350fc4fdc57d Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Andreas Hansson <andreas.hansson@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3241
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/syscall_emul.hh26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index a1c3b2905..53c053f05 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -45,15 +45,27 @@
#ifndef __SIM_SYSCALL_EMUL_HH__
#define __SIM_SYSCALL_EMUL_HH__
-#define NO_STAT64 (defined(__APPLE__) || defined(__OpenBSD__) || \
- defined(__FreeBSD__) || defined(__CYGWIN__) || \
- defined(__NetBSD__))
+#if (defined(__APPLE__) || defined(__OpenBSD__) || \
+ defined(__FreeBSD__) || defined(__CYGWIN__) || \
+ defined(__NetBSD__))
+#define NO_STAT64 1
+#else
+#define NO_STAT64 0
+#endif
-#define NO_STATFS (defined(__APPLE__) || defined(__OpenBSD__) || \
- defined(__FreeBSD__) || defined(__NetBSD__))
+#if (defined(__APPLE__) || defined(__OpenBSD__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__))
+#define NO_STATFS 1
+#else
+#define NO_STATFS 0
+#endif
-#define NO_FALLOCATE (defined(__APPLE__) || defined(__OpenBSD__) || \
- defined(__FreeBSD__) || defined(__NetBSD__))
+#if (defined(__APPLE__) || defined(__OpenBSD__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__))
+#define NO_FALLOCATE 1
+#else
+#define NO_FALLOCATE 0
+#endif
///
/// @file syscall_emul.hh