summaryrefslogtreecommitdiff
path: root/compiler.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-04-13 19:58:42 +0000
committerH. Peter Anvin <hpa@zytor.com>2007-04-13 19:58:42 +0000
commitc1494ac5abcdbdb1a6b4c56eb845b0d7694a853b (patch)
tree640c70ac3d99faeef56be65b4588e97658e934de /compiler.h
parenta6dfa78b7805673b2b4955a9f34e21825730f79d (diff)
downloadnasm-c1494ac5abcdbdb1a6b4c56eb845b0d7694a853b.tar.gz
nasm-c1494ac5abcdbdb1a6b4c56eb845b0d7694a853b.tar.bz2
nasm-c1494ac5abcdbdb1a6b4c56eb845b0d7694a853b.zip
Macroize any compiler-specific code; macros defined in "compiler.h"
Move anything compiler-specific to "compiler.h". There was an unguarded use of __attribute__(()) in outmacho.c; also require gcc 4+ for __builtin_ctlz(). Speed up the open-coded version, too.
Diffstat (limited to 'compiler.h')
-rw-r--r--compiler.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/compiler.h b/compiler.h
new file mode 100644
index 0000000..0e59f52
--- /dev/null
+++ b/compiler.h
@@ -0,0 +1,36 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2007 The NASM Authors - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the license given in the file "License"
+ * distributed in the NASM archive.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * compiler.h
+ *
+ * Compiler-specific macros for NASM. Feel free to add support for
+ * other compilers in here.
+ */
+
+#ifndef COMPILER_H
+#define COMPILER_H
+
+#ifdef __GNUC__
+# if __GNUC__ >= 4
+# define HAVE_GNUC_4
+# endif
+# if __GNUC__ >= 3
+# define HAVE_GNUC_3
+# endif
+#endif
+
+#ifdef __GNUC__
+# define _unused __attribute__((unused))
+#else
+# define _unused
+#endif
+
+#endif