summaryrefslogtreecommitdiff
path: root/src/base/compiler.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/compiler.hh')
-rw-r--r--src/base/compiler.hh10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/base/compiler.hh b/src/base/compiler.hh
index 6b0091410..4765adc36 100644
--- a/src/base/compiler.hh
+++ b/src/base/compiler.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012,2017 ARM Limited
+ * Copyright (c) 2012,2017-2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -73,9 +73,17 @@
#else
#define M5_FALLTHROUGH
#endif
+
+ #if __has_cpp_attribute(nodiscard)
+ #define M5_NODISCARD [[nodiscard]]
+ #else
+ #define M5_NODISCARD
+ #endif
#else
// Unsupported (and no warning) on GCC < 7.
#define M5_FALLTHROUGH
+
+ #define M5_NODISCARD
#endif
// std::make_unique redefined for C++11 compilers