]> git.pond.sub.org Git - empserver/blobdiff - include/misc.h
Update copyright notice
[empserver] / include / misc.h
index 29a3671c78c8c3bda5f91675649c583a5d4b12fa..7b428f091d39f21815f873d538e4497d2878ed48 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2015, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
@@ -52,7 +52,7 @@
 #endif
 
 #ifndef bit
-#define bit(x)         (1<<(x))
+#define bit(x)         (1U<<(x))
 #endif
 
 #define minutes(x)     (60*(x))
@@ -82,6 +82,13 @@ extern void (*oops_handler)(void);
 #define BUILD_ASSERT_ONE(cond) \
     (sizeof(char[1 - 2 * !(cond)]))
 
+/*
+ * Assert constant expression @cond.
+ * If @cond is zero, force a compilation error.
+ */
+#define BUILD_ASSERT(cond) \
+    ((void)BUILD_ASSERT_ONE(cond))
+
 void exit_nomem(void) ATTRIBUTE((noreturn));
 
        /* return codes from command routines */