summaryrefslogtreecommitdiff
path: root/compiler.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-02 21:53:51 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-02 21:53:51 -0700
commitfe501957c09a80347b1eb005ba1b1bc0fce14b0d (patch)
tree6747b0e256b60819125c652dd58577b12c71556e /compiler.h
parent4a8daf06074351df2588a9f5cd2b4a558bde9935 (diff)
downloadnasm-fe501957c09a80347b1eb005ba1b1bc0fce14b0d.tar.gz
Portability fixes
Concentrate compiler dependencies to compiler.h; make sure compiler.h is included first in every .c file (since some prototypes may depend on the presence of feature request macros.) Actually use the conditional inclusion of various functions (totally broken in previous releases.)
Diffstat (limited to 'compiler.h')
-rw-r--r--compiler.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/compiler.h b/compiler.h
index 798466fe..0f7261c8 100644
--- a/compiler.h
+++ b/compiler.h
@@ -13,15 +13,25 @@
*
* Compiler-specific macros for NASM. Feel free to add support for
* other compilers in here.
+ *
+ * This header file should be included before any other header.
*/
-#ifndef COMPILER_H
-#define COMPILER_H 1
+#ifndef NASM_COMPILER_H
+#define NASM_COMPILER_H 1
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+/* Request as many features as we can */
+#define _GNU_SOURCE
+#define _ISO99_SOURCE
+#define _POSIX_SOURCE
+#define _POSIX_C_SOURCE 200112L
+#define _XOPEN_SOURCE 600
+#define _XOPEN_SOURCE_EXTENDED
+
#ifdef __GNUC__
# if __GNUC__ >= 4
# define HAVE_GNUC_4
@@ -38,9 +48,9 @@
#endif
/* Some versions of MSVC have these only with underscores in front */
-#include <stdio.h>
#include <stddef.h>
#include <stdarg.h>
+#include <stdio.h>
#ifndef HAVE_SNPRINTF
# ifdef HAVE__SNPRINTF
@@ -58,4 +68,4 @@ int vsnprintf(char *, size_t, const char *, va_list);
# endif
#endif
-#endif /* COMPILER_H */
+#endif /* NASM_COMPILER_H */