summaryrefslogtreecommitdiff
path: root/compiler.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-06-10 13:00:27 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-06-10 13:00:27 -0700
commit253a4e7a9f26facc7e266f700832a213473d05f9 (patch)
tree87a91f6dea55afe42e4c3daeb1fb0996807c4fc8 /compiler.h
parent51997d3d44a9279508b16e9f3d5e2de173ece7c2 (diff)
downloadnasm-253a4e7a9f26facc7e266f700832a213473d05f9.tar.gz
nasm-253a4e7a9f26facc7e266f700832a213473d05f9.tar.bz2
nasm-253a4e7a9f26facc7e266f700832a213473d05f9.zip
Make it possible to use "inline" and "restrict"
Put the appropriate machinery in place to be able to use the "inline" and "restrict" keywords with appropriate semantics.
Diffstat (limited to 'compiler.h')
-rw-r--r--compiler.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler.h b/compiler.h
index 51f4983..82b0d7a 100644
--- a/compiler.h
+++ b/compiler.h
@@ -22,7 +22,17 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
-#endif
+/* autoconf doesn't define these if they are redundant, but we want to
+ be able to #ifdef them... */
+#else
+/* Default these to unsupported unless we have config.h */
+# ifndef inline
+# define inline
+# endif
+# ifndef restrict
+# define restrict
+# endif
+#endif /* HAVE_CONFIG_H */
/* This is required to get the standard <inttypes.h> macros when compiling
with a C++ compiler. This must be defined *before* <inttypes.h> is
@@ -71,7 +81,9 @@ int vsnprintf(char *, size_t, const char *, va_list);
# ifdef HAVE_STDBOOL_H
# include <stdbool.h>
# else
-typedef enum { false, true } bool;
+/* This is sort of dangerous, since casts will behave different than
+ casting to the standard boolean type. Always use !!, not (bool). */
+typedef enum bool { false, true } bool;
# endif
#endif