Ditch the COMPILE_ASSERT and ATTRIBUTE_UNUSED macros.

Change-Id: I47ee9d9a202e6cfc59daea16c301e13a5e556533
Reviewed-on: https://code-review.googlesource.com/5505
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/onepass.cc b/re2/onepass.cc
index 2584faf..b533f17 100644
--- a/re2/onepass.cc
+++ b/re2/onepass.cc
@@ -172,11 +172,11 @@
 // Check, at compile time, that prog.h agrees with math above.
 // This function is never called.
 void OnePass_Checks() {
-  COMPILE_ASSERT((1<<kEmptyShift)-1 == kEmptyAllFlags,
-                 kEmptyShift_disagrees_with_kEmptyAllFlags);
+  static_assert((1<<kEmptyShift)-1 == kEmptyAllFlags,
+                "kEmptyShift disagrees with kEmptyAllFlags");
   // kMaxCap counts pointers, kMaxOnePassCapture counts pairs.
-  COMPILE_ASSERT(kMaxCap == Prog::kMaxOnePassCapture*2,
-                 kMaxCap_disagrees_with_kMaxOnePassCapture);
+  static_assert(kMaxCap == Prog::kMaxOnePassCapture*2,
+                "kMaxCap disagrees with kMaxOnePassCapture");
 }
 
 static bool Satisfy(uint32 cond, const StringPiece& context, const char* p) {
diff --git a/util/mutex.h b/util/mutex.h
index d54ded3..3bb0602 100644
--- a/util/mutex.h
+++ b/util/mutex.h
@@ -203,9 +203,9 @@
 };
 
 // Catch bug where variable name is omitted, e.g. MutexLock (&mu);
-#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name)
-#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name)
-#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name)
+#define MutexLock(x) static_assert(false, "MutexLock declaration missing variable name")
+#define ReaderMutexLock(x) static_assert(false, "ReaderMutexLock declaration missing variable name")
+#define WriterMutexLock(x) static_assert(false, "WriterMutexLock declaration missing variable name")
 
 }  // namespace re2
 
diff --git a/util/util.h b/util/util.h
index f70357d..b23005f 100644
--- a/util/util.h
+++ b/util/util.h
@@ -35,28 +35,10 @@
 
 typedef unsigned int uint;
 
-// Prevent the compiler from complaining about or optimizing away variables
-// that appear unused.
-#undef ATTRIBUTE_UNUSED
-#if defined(__GNUC__)
-#define ATTRIBUTE_UNUSED __attribute__ ((unused))
-#else
-#define ATTRIBUTE_UNUSED
-#endif
-
-// COMPILE_ASSERT causes a compile error about msg if expr is not true.
-#if __cplusplus >= 201103L
-#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
-#else
-template<bool> struct CompileAssert {};
-#define COMPILE_ASSERT(expr, msg) \
-  typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ATTRIBUTE_UNUSED
-#endif
-
 // DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions.
 // It goes in the private: declarations in a class.
 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-  TypeName(const TypeName&);                 \
+  TypeName(const TypeName&);               \
   void operator=(const TypeName&)
 
 #define arraysize(array) (int)(sizeof(array)/sizeof((array)[0]))