[gem5-dev] Change in gem5/gem5[develop]: base: Add some error handling to compiler.hh.

2020-10-01 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/35275 )


Change subject: base: Add some error handling to compiler.hh.
..

base: Add some error handling to compiler.hh.

Rather than just leaving some macros undefined if none of the scenarios
we checked for match, we should report an error so it's clear what
happened. Otherwise the places the macros are used will just not compile
properly, or worse will silently not work correctly.

Change-Id: Ie010d6b6d1b6a1496a45d9ebc0d75d1c804df12f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35275
Reviewed-by: Daniel Carvalho 
Reviewed-by: Nikos Nikoleris 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/base/compiler.hh
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved
  Daniel Carvalho: Looks good to me, but someone else must approve
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/compiler.hh b/src/base/compiler.hh
index ee9a224..ead1507 100644
--- a/src/base/compiler.hh
+++ b/src/base/compiler.hh
@@ -76,6 +76,8 @@
 // gcc and clang support a custom attribute which is essentially the same
 // thing.
 #  define M5_VAR_USED [[gnu::unused]]
+#else
+#  error "Don't know what to do for your compiler."
 #endif


@@ -106,6 +108,8 @@
 // we can't do that with direct substitution.
 #  define M5_LIKELY(cond) __builtin_expect(!!(cond), 1)
 #  define M5_UNLIKELY(cond) __builtin_expect(!!(cond), 0)
+#else
+#  error "Don't know what to do for your compiler."
 #endif

 // When a member variable may be unused, mark it with M5_CLASS_VAR_USED.  
This


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


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ie010d6b6d1b6a1496a45d9ebc0d75d1c804df12f
Gerrit-Change-Number: 35275
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: base: Add some error handling to compiler.hh.

2020-09-28 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/35275 )



Change subject: base: Add some error handling to compiler.hh.
..

base: Add some error handling to compiler.hh.

Rather than just leaving some macros undefined if none of the scenarios
we checked for match, we should report an error so it's clear what
happened. Otherwise the places the macros are used will just not compile
properly, or worse will silently not work correctly.

Change-Id: Ie010d6b6d1b6a1496a45d9ebc0d75d1c804df12f
---
M src/base/compiler.hh
1 file changed, 4 insertions(+), 0 deletions(-)



diff --git a/src/base/compiler.hh b/src/base/compiler.hh
index ee9a224..ead1507 100644
--- a/src/base/compiler.hh
+++ b/src/base/compiler.hh
@@ -76,6 +76,8 @@
 // gcc and clang support a custom attribute which is essentially the same
 // thing.
 #  define M5_VAR_USED [[gnu::unused]]
+#else
+#  error "Don't know what to do for your compiler."
 #endif


@@ -106,6 +108,8 @@
 // we can't do that with direct substitution.
 #  define M5_LIKELY(cond) __builtin_expect(!!(cond), 1)
 #  define M5_UNLIKELY(cond) __builtin_expect(!!(cond), 0)
+#else
+#  error "Don't know what to do for your compiler."
 #endif

 // When a member variable may be unused, mark it with M5_CLASS_VAR_USED.  
This


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


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ie010d6b6d1b6a1496a45d9ebc0d75d1c804df12f
Gerrit-Change-Number: 35275
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s