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 <oda...@yahoo.com.br>
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Maintainer: Gabe Black <gabebl...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
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 <gabebl...@google.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
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

Reply via email to