Nikos Nikoleris has uploaded this change for review. ( https://gem5-review.googlesource.com/10441

Change subject: base: Add M5 flag for [[nodiscard]] attribute
......................................................................

base: Add M5 flag for [[nodiscard]] attribute

This change adds the M5_NODISCARD keyword to allow use of the
[[nodiscard]] attribute with compilers that support C++17. Currently,
C++17 is not a requirement and therefore the M5_NODISCARD has not
effect and does not break compilation for older compilers.

Change-Id: Ifc5c8f34764da3c7291066dcb2ff908c97738c3d
---
M src/base/compiler.hh
1 file changed, 9 insertions(+), 1 deletion(-)



diff --git a/src/base/compiler.hh b/src/base/compiler.hh
index 6b00914..4765adc 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

--
To view, visit https://gem5-review.googlesource.com/10441
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ifc5c8f34764da3c7291066dcb2ff908c97738c3d
Gerrit-Change-Number: 10441
Gerrit-PatchSet: 1
Gerrit-Owner: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to