summaryrefslogtreecommitdiff
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
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.)
-rw-r--r--assemble.c2
-rw-r--r--compiler.h18
-rw-r--r--configure.in7
-rw-r--r--crc64.c1
-rw-r--r--disasm.c2
-rw-r--r--eval.c2
-rw-r--r--float.c2
-rw-r--r--hashtbl.c2
-rw-r--r--labels.c2
-rw-r--r--lib/snprintf.c2
-rw-r--r--lib/vsnprintf.c2
-rw-r--r--listing.c2
-rw-r--r--macros.pl2
-rw-r--r--nasm.c2
-rw-r--r--nasm.h3
-rw-r--r--nasmlib.c8
-rw-r--r--nasmlib.h25
-rw-r--r--ndisasm.c2
-rw-r--r--outform.c2
-rw-r--r--output/outaout.c2
-rw-r--r--output/outas86.c2
-rw-r--r--output/outbin.c2
-rw-r--r--output/outcoff.c2
-rw-r--r--output/outdbg.c2
-rw-r--r--output/outelf32.c2
-rw-r--r--output/outelf64.c2
-rw-r--r--output/outieee.c2
-rw-r--r--output/outmacho.c2
-rw-r--r--output/outobj.c2
-rw-r--r--output/outrdf.c2
-rw-r--r--output/outrdf2.c2
-rw-r--r--parser.c2
-rwxr-xr-xpptok.pl1
-rw-r--r--preproc.c2
-rw-r--r--rdoff/collectn.c3
-rw-r--r--rdoff/hash.c2
-rw-r--r--rdoff/ldrdf.c2
-rw-r--r--rdoff/rdf2bin.c2
-rw-r--r--rdoff/rdf2ihx.c2
-rw-r--r--rdoff/rdfdump.c2
-rw-r--r--rdoff/rdflib.c2
-rw-r--r--rdoff/rdfload.c2
-rw-r--r--rdoff/rdlar.c2
-rw-r--r--rdoff/rdlib.c2
-rw-r--r--rdoff/rdoff.c2
-rw-r--r--rdoff/rdx.c2
-rw-r--r--rdoff/segtab.c2
-rw-r--r--rdoff/symtab.c3
-rwxr-xr-xregs.pl5
-rw-r--r--stdscan.c2
-rw-r--r--sync.c2
-rwxr-xr-xtokhash.pl1
52 files changed, 133 insertions, 24 deletions
diff --git a/assemble.c b/assemble.c
index 6adaec6a..c3a90492 100644
--- a/assemble.c
+++ b/assemble.c
@@ -82,6 +82,8 @@
* used for conditional jump over longer jump
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
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 */
diff --git a/configure.in b/configure.in
index b97f536c..009720a2 100644
--- a/configure.in
+++ b/configure.in
@@ -82,6 +82,9 @@ fi
dnl Check for <inttypes.h> or add a substitute version
AC_CHECK_HEADERS(inttypes.h, , CFLAGS="$CFLAGS -I\$(top_srcdir)/inttypes")
+dnl The standard header for str*casecmp is <strings.h>
+AC_CHECK_HEADERS(strings.h)
+
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
@@ -107,6 +110,10 @@ if $missing; then
XOBJS="$XOBJS lib/snprintf.o"
fi
+AC_CHECK_FUNCS(strcasecmp stricmp)
+AC_CHECK_FUNCS(strncasecmp strnicmp)
+AC_CHECK_FUNCS(strsep)
+
AC_CHECK_FUNCS(getuid)
AC_CHECK_FUNCS(getgid)
diff --git a/crc64.c b/crc64.c
index da41e7db..fc165b78 100644
--- a/crc64.c
+++ b/crc64.c
@@ -1,3 +1,4 @@
+#include "compiler.h"
#include <inttypes.h>
#include <ctype.h>
diff --git a/disasm.c b/disasm.c
index 724d0bf6..dc754707 100644
--- a/disasm.c
+++ b/disasm.c
@@ -8,6 +8,8 @@
* initial version 27/iii/95 by Simon Tatham
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <string.h>
#include <limits.h>
diff --git a/eval.c b/eval.c
index a75c5bae..aa564e2f 100644
--- a/eval.c
+++ b/eval.c
@@ -8,6 +8,8 @@
* initial version 27/iii/95 by Simon Tatham
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/float.c b/float.c
index 357bcb74..64a77b86 100644
--- a/float.c
+++ b/float.c
@@ -8,6 +8,8 @@
* initial version 13/ix/96 by Simon Tatham
*/
+#include "compiler.h"
+
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/hashtbl.c b/hashtbl.c
index cbe2a1b9..5dd743db 100644
--- a/hashtbl.c
+++ b/hashtbl.c
@@ -4,6 +4,8 @@
* Efficient dictionary hash table class.
*/
+#include "compiler.h"
+
#include <inttypes.h>
#include <string.h>
#include "nasm.h"
diff --git a/labels.c b/labels.c
index 5a1fd132..2d2630d9 100644
--- a/labels.c
+++ b/labels.c
@@ -6,6 +6,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
diff --git a/lib/snprintf.c b/lib/snprintf.c
index f56a492a..de4d96da 100644
--- a/lib/snprintf.c
+++ b/lib/snprintf.c
@@ -4,6 +4,8 @@
* Implement snprintf() in terms of vsnprintf()
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c
index 2c9399a0..976b0eac 100644
--- a/lib/vsnprintf.c
+++ b/lib/vsnprintf.c
@@ -5,6 +5,8 @@
* that don't have them...
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
diff --git a/listing.c b/listing.c
index 1d432e55..226a026e 100644
--- a/listing.c
+++ b/listing.c
@@ -8,6 +8,8 @@
* initial version 2/vii/97 by Simon Tatham
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/macros.pl b/macros.pl
index 0934d174..596277dc 100644
--- a/macros.pl
+++ b/macros.pl
@@ -19,7 +19,7 @@ undef $tasm_count;
open(OUTPUT,">macros.c") or die "unable to open macros.c\n";
print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" .
-" - don't edit it */\n\n#include <stddef.h>\n\nstatic const char *stdmac[] = {\n";
+" - don't edit it */\n\n#include \"compiler.h\"\n\nstatic const char *stdmac[] = {\n";
foreach $fname ( @ARGV ) {
open(INPUT,$fname) or die "unable to open $fname\n";
diff --git a/nasm.c b/nasm.c
index 7a4ac550..b28f4f77 100644
--- a/nasm.c
+++ b/nasm.c
@@ -6,6 +6,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
diff --git a/nasm.h b/nasm.h
index a120ccda..3c491306 100644
--- a/nasm.h
+++ b/nasm.h
@@ -11,10 +11,11 @@
#ifndef NASM_NASM_H
#define NASM_NASM_H
+#include "compiler.h"
+
#include <stdio.h>
#include <inttypes.h>
#include "version.h" /* generated NASM version macros */
-#include "compiler.h"
#include "nasmlib.h"
#include "insnsi.h" /* For enum opcode */
diff --git a/nasmlib.c b/nasmlib.c
index 6f0e6afd..d045a2ae 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -6,6 +6,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -144,7 +146,7 @@ char *nasm_strndup(char *s, size_t len)
return p;
}
-#if !defined(stricmp) && !defined(strcasecmp)
+#ifndef nasm_stricmp
int nasm_stricmp(const char *s1, const char *s2)
{
while (*s1 && tolower(*s1) == tolower(*s2))
@@ -158,7 +160,7 @@ int nasm_stricmp(const char *s1, const char *s2)
}
#endif
-#if !defined(strnicmp) && !defined(strncasecmp)
+#ifndef nasm_strnicmp
int nasm_strnicmp(const char *s1, const char *s2, int n)
{
while (n > 0 && *s1 && tolower(*s1) == tolower(*s2))
@@ -172,7 +174,7 @@ int nasm_strnicmp(const char *s1, const char *s2, int n)
}
#endif
-#if !defined(strsep)
+#ifndef nasm_strsep
char *nasm_strsep(char **stringp, const char *delim)
{
char *s = *stringp;
diff --git a/nasmlib.h b/nasmlib.h
index a2544fc1..64afa450 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -9,9 +9,14 @@
#ifndef NASM_NASMLIB_H
#define NASM_NASMLIB_H
+#include "compiler.h"
+
#include <inttypes.h>
#include <stdio.h>
-#include "compiler.h"
+#include <string.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
/*
* If this is defined, the wrappers around malloc et al will
@@ -98,27 +103,23 @@ char *nasm_strndup_log(char *, int, char *, size_t);
* ANSI doesn't guarantee the presence of `stricmp' or
* `strcasecmp'.
*/
-#if defined(stricmp) || defined(strcasecmp)
-#if defined(stricmp)
-#define nasm_stricmp stricmp
-#else
+#if defined(HAVE_STRCASECMP)
#define nasm_stricmp strcasecmp
-#endif
+#elif defined(HAVE_STRICMP)
+#define nasm_stricmp stricmp
#else
int nasm_stricmp(const char *, const char *);
#endif
-#if defined(strnicmp) || defined(strncasecmp)
-#if defined(strnicmp)
-#define nasm_strnicmp strnicmp
-#else
+#if defined(HAVE_STRNCASECMP)
#define nasm_strnicmp strncasecmp
-#endif
+#elif defined(HAVE_STRNICMP)
+#define nasm_strnicmp strnicmp
#else
int nasm_strnicmp(const char *, const char *, int);
#endif
-#if defined(strsep)
+#if defined(HAVE_STRSEP)
#define nasm_strsep strsep
#else
char *nasm_strsep(char **stringp, const char *delim);
diff --git a/ndisasm.c b/ndisasm.c
index ea4dc537..a6664315 100644
--- a/ndisasm.c
+++ b/ndisasm.c
@@ -6,6 +6,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
diff --git a/outform.c b/outform.c
index 1cdd5be8..3f4d18ff 100644
--- a/outform.c
+++ b/outform.c
@@ -9,6 +9,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
diff --git a/output/outaout.c b/output/outaout.c
index d5358b4c..6c9bf242 100644
--- a/output/outaout.c
+++ b/output/outaout.c
@@ -7,6 +7,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outas86.c b/output/outas86.c
index 135ddda3..4bfbb04b 100644
--- a/output/outas86.c
+++ b/output/outas86.c
@@ -7,6 +7,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outbin.c b/output/outbin.c
index a1c51c8f..b5a7524c 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -44,6 +44,8 @@
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outcoff.c b/output/outcoff.c
index 8eb8c061..44a41e5a 100644
--- a/output/outcoff.c
+++ b/output/outcoff.c
@@ -7,6 +7,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outdbg.c b/output/outdbg.c
index 0dda75a6..43c6504a 100644
--- a/output/outdbg.c
+++ b/output/outdbg.c
@@ -7,6 +7,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outelf32.c b/output/outelf32.c
index fbc98d60..ca918487 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -7,6 +7,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outelf64.c b/output/outelf64.c
index e87d8bdc..5f77bb12 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -7,6 +7,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outieee.c b/output/outieee.c
index 19b25755..145fcafe 100644
--- a/output/outieee.c
+++ b/output/outieee.c
@@ -36,6 +36,8 @@
*
* David Lindauer, LADsoft
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outmacho.c b/output/outmacho.c
index 86700f8e..545fa27f 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -10,6 +10,8 @@
/* Most of this file is, like Mach-O itself, based on a.out. For more
* guidelines see outaout.c. */
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outobj.c b/output/outobj.c
index c411edd9..2f7079ef 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -7,6 +7,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outrdf.c b/output/outrdf.c
index cd311de5..d3fbb927 100644
--- a/output/outrdf.c
+++ b/output/outrdf.c
@@ -12,6 +12,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/output/outrdf2.c b/output/outrdf2.c
index c98beadd..82ac0ecb 100644
--- a/output/outrdf2.c
+++ b/output/outrdf2.c
@@ -9,6 +9,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/parser.c b/parser.c
index 31c3612a..fc1f0cf3 100644
--- a/parser.c
+++ b/parser.c
@@ -8,6 +8,8 @@
* initial version 27/iii/95 by Simon Tatham
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/pptok.pl b/pptok.pl
index f918e356..ee49648e 100755
--- a/pptok.pl
+++ b/pptok.pl
@@ -138,6 +138,7 @@ if ($what eq 'c') {
die if ($n & ($n-1));
+ print OUT "#include \"compiler.h\"\n";
print OUT "#include <inttypes.h>\n";
print OUT "#include <ctype.h>\n";
print OUT "#include \"nasmlib.h\"\n";
diff --git a/preproc.c b/preproc.c
index 1ee07ad6..5d97d1ec 100644
--- a/preproc.c
+++ b/preproc.c
@@ -34,6 +34,8 @@
* detoken is used to convert the line back to text
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
diff --git a/rdoff/collectn.c b/rdoff/collectn.c
index ad43d856..317c5286 100644
--- a/rdoff/collectn.c
+++ b/rdoff/collectn.c
@@ -4,8 +4,9 @@
* This file is public domain.
*/
-#include "collectn.h"
+#include "compiler.h"
#include <stdlib.h>
+#include "collectn.h"
void collection_init(Collection * c)
{
diff --git a/rdoff/hash.c b/rdoff/hash.c
index 34a8edc1..8b1d3cf8 100644
--- a/rdoff/hash.c
+++ b/rdoff/hash.c
@@ -8,6 +8,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include "hash.h"
const uint32_t consttab[] = {
diff --git a/rdoff/ldrdf.c b/rdoff/ldrdf.c
index e28f2842..cd07fe72 100644
--- a/rdoff/ldrdf.c
+++ b/rdoff/ldrdf.c
@@ -24,6 +24,8 @@
* under DOS. '#define STINGY_MEMORY' may help a little.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/rdoff/rdf2bin.c b/rdoff/rdf2bin.c
index e5561863..0b3f9999 100644
--- a/rdoff/rdf2bin.c
+++ b/rdoff/rdf2bin.c
@@ -2,6 +2,8 @@
* rdf2bin.c - convert an RDOFF object file to flat binary
*/
+#include "compiler.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/rdoff/rdf2ihx.c b/rdoff/rdf2ihx.c
index a0238dad..94ba1cb3 100644
--- a/rdoff/rdf2ihx.c
+++ b/rdoff/rdf2ihx.c
@@ -4,6 +4,8 @@
* Note that this program only writes 16-bit HEX.
*/
+#include "compiler.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/rdoff/rdfdump.c b/rdoff/rdfdump.c
index 691241d5..83305570 100644
--- a/rdoff/rdfdump.c
+++ b/rdoff/rdfdump.c
@@ -2,6 +2,8 @@
* rdfdump.c - dump RDOFF file header.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/rdoff/rdflib.c b/rdoff/rdflib.c
index 6abd13cf..b4bf6d60 100644
--- a/rdoff/rdflib.c
+++ b/rdoff/rdflib.c
@@ -23,6 +23,8 @@
* content size, followed by data.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
diff --git a/rdoff/rdfload.c b/rdoff/rdfload.c
index cd24c2de..063724e7 100644
--- a/rdoff/rdfload.c
+++ b/rdoff/rdfload.c
@@ -17,6 +17,8 @@
* - support for segment relocations (hard to do in ANSI C)
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/rdoff/rdlar.c b/rdoff/rdlar.c
index df813d12..1d4cd431 100644
--- a/rdoff/rdlar.c
+++ b/rdoff/rdlar.c
@@ -3,6 +3,8 @@
* Copyright (c) 2002 RET & COM Research.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
diff --git a/rdoff/rdlib.c b/rdoff/rdlib.c
index c094a565..a6ae1568 100644
--- a/rdoff/rdlib.c
+++ b/rdoff/rdlib.c
@@ -2,6 +2,8 @@
* rdlib.c - routines for manipulating RDOFF libraries (.rdl)
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/rdoff/rdoff.c b/rdoff/rdoff.c
index ac722795..25394996 100644
--- a/rdoff/rdoff.c
+++ b/rdoff/rdoff.c
@@ -15,6 +15,8 @@
* make it portable.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/rdoff/rdx.c b/rdoff/rdx.c
index 82210a65..26be0c41 100644
--- a/rdoff/rdx.c
+++ b/rdoff/rdx.c
@@ -12,6 +12,8 @@
files. You can use these files in your own program to load RDOFF objects
and execute the code in them in a similar way to what is shown here. */
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
diff --git a/rdoff/segtab.c b/rdoff/segtab.c
index 8ee1b7b3..e1a3ddf2 100644
--- a/rdoff/segtab.c
+++ b/rdoff/segtab.c
@@ -1,3 +1,5 @@
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include "segtab.h"
diff --git a/rdoff/symtab.c b/rdoff/symtab.c
index 6026ccd8..ce54d8ea 100644
--- a/rdoff/symtab.c
+++ b/rdoff/symtab.c
@@ -7,6 +7,9 @@
* redistributable under the licence given in the file "Licence"
* distributed in the NASM archive.
*/
+
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/regs.pl b/regs.pl
index 9dde6827..404c2f62 100755
--- a/regs.pl
+++ b/regs.pl
@@ -78,7 +78,7 @@ close(REGS);
if ( $fmt eq 'h' ) {
# Output regs.h
- print "/* automatically generated from $file - do not edit */\n";
+ print "/* automatically generated from $file - do not edit */\n\n";
$expr_regs = 1;
printf "#define EXPR_REG_START %d\n", $expr_regs;
print "enum reg_enum {\n";
@@ -101,7 +101,8 @@ if ( $fmt eq 'h' ) {
print "\n";
} elsif ( $fmt eq 'c' ) {
# Output regs.c
- print "/* automatically generated from $file - do not edit */\n";
+ print "/* automatically generated from $file - do not edit */\n\n";
+ print "#include \"compiler.h\"\n\n";
print "static const char * const reg_names[] = "; $ch = '{';
# This one has no dummy entry for 0
foreach $reg ( sort(keys(%regs)) ) {
diff --git a/stdscan.c b/stdscan.c
index aecbd4a7..934fdf54 100644
--- a/stdscan.c
+++ b/stdscan.c
@@ -1,3 +1,5 @@
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/sync.c b/sync.c
index 562c59d6..b60d2a4a 100644
--- a/sync.c
+++ b/sync.c
@@ -6,6 +6,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
diff --git a/tokhash.pl b/tokhash.pl
index 2265bd0e..b5e85aaf 100755
--- a/tokhash.pl
+++ b/tokhash.pl
@@ -168,6 +168,7 @@ if ($output eq 'h') {
print " */\n";
print "\n";
+ print "#include \"compiler.h\"\n";
print "#include <string.h>\n";
print "#include \"nasm.h\"\n";
print "#include \"hashtbl.h\"\n";