diff options
-rw-r--r-- | assemble.c | 2 | ||||
-rw-r--r-- | compiler.h | 18 | ||||
-rw-r--r-- | configure.in | 7 | ||||
-rw-r--r-- | crc64.c | 1 | ||||
-rw-r--r-- | disasm.c | 2 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | float.c | 2 | ||||
-rw-r--r-- | hashtbl.c | 2 | ||||
-rw-r--r-- | labels.c | 2 | ||||
-rw-r--r-- | lib/snprintf.c | 2 | ||||
-rw-r--r-- | lib/vsnprintf.c | 2 | ||||
-rw-r--r-- | listing.c | 2 | ||||
-rw-r--r-- | macros.pl | 2 | ||||
-rw-r--r-- | nasm.c | 2 | ||||
-rw-r--r-- | nasm.h | 3 | ||||
-rw-r--r-- | nasmlib.c | 8 | ||||
-rw-r--r-- | nasmlib.h | 25 | ||||
-rw-r--r-- | ndisasm.c | 2 | ||||
-rw-r--r-- | outform.c | 2 | ||||
-rw-r--r-- | output/outaout.c | 2 | ||||
-rw-r--r-- | output/outas86.c | 2 | ||||
-rw-r--r-- | output/outbin.c | 2 | ||||
-rw-r--r-- | output/outcoff.c | 2 | ||||
-rw-r--r-- | output/outdbg.c | 2 | ||||
-rw-r--r-- | output/outelf32.c | 2 | ||||
-rw-r--r-- | output/outelf64.c | 2 | ||||
-rw-r--r-- | output/outieee.c | 2 | ||||
-rw-r--r-- | output/outmacho.c | 2 | ||||
-rw-r--r-- | output/outobj.c | 2 | ||||
-rw-r--r-- | output/outrdf.c | 2 | ||||
-rw-r--r-- | output/outrdf2.c | 2 | ||||
-rw-r--r-- | parser.c | 2 | ||||
-rwxr-xr-x | pptok.pl | 1 | ||||
-rw-r--r-- | preproc.c | 2 | ||||
-rw-r--r-- | rdoff/collectn.c | 3 | ||||
-rw-r--r-- | rdoff/hash.c | 2 | ||||
-rw-r--r-- | rdoff/ldrdf.c | 2 | ||||
-rw-r--r-- | rdoff/rdf2bin.c | 2 | ||||
-rw-r--r-- | rdoff/rdf2ihx.c | 2 | ||||
-rw-r--r-- | rdoff/rdfdump.c | 2 | ||||
-rw-r--r-- | rdoff/rdflib.c | 2 | ||||
-rw-r--r-- | rdoff/rdfload.c | 2 | ||||
-rw-r--r-- | rdoff/rdlar.c | 2 | ||||
-rw-r--r-- | rdoff/rdlib.c | 2 | ||||
-rw-r--r-- | rdoff/rdoff.c | 2 | ||||
-rw-r--r-- | rdoff/rdx.c | 2 | ||||
-rw-r--r-- | rdoff/segtab.c | 2 | ||||
-rw-r--r-- | rdoff/symtab.c | 3 | ||||
-rwxr-xr-x | regs.pl | 5 | ||||
-rw-r--r-- | stdscan.c | 2 | ||||
-rw-r--r-- | sync.c | 2 | ||||
-rwxr-xr-x | tokhash.pl | 1 |
52 files changed, 133 insertions, 24 deletions
@@ -82,6 +82,8 @@ * used for conditional jump over longer jump */ +#include "compiler.h" + #include <stdio.h> #include <string.h> #include <inttypes.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 b97f536..009720a 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) @@ -1,3 +1,4 @@ +#include "compiler.h" #include <inttypes.h> #include <ctype.h> @@ -8,6 +8,8 @@ * initial version 27/iii/95 by Simon Tatham */ +#include "compiler.h" + #include <stdio.h> #include <string.h> #include <limits.h> @@ -8,6 +8,8 @@ * initial version 27/iii/95 by Simon Tatham */ +#include "compiler.h" + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -8,6 +8,8 @@ * initial version 13/ix/96 by Simon Tatham */ +#include "compiler.h" + #include <ctype.h> #include <stdio.h> #include <stdlib.h> @@ -4,6 +4,8 @@ * Efficient dictionary hash table class. */ +#include "compiler.h" + #include <inttypes.h> #include <string.h> #include "nasm.h" @@ -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 f56a492..de4d96d 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 2c9399a..976b0ea 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> @@ -8,6 +8,8 @@ * initial version 2/vii/97 by Simon Tatham */ +#include "compiler.h" + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -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"; @@ -6,6 +6,8 @@ * distributed in the NASM archive. */ +#include "compiler.h" + #include <stdio.h> #include <stdarg.h> #include <stdlib.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 */ @@ -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; @@ -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); @@ -6,6 +6,8 @@ * distributed in the NASM archive. */ +#include "compiler.h" + #include <stdio.h> #include <stdarg.h> #include <stdlib.h> @@ -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 d5358b4..6c9bf24 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 135ddda..4bfbb04 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 a1c51c8..b5a7524 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 8eb8c06..44a41e5 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 0dda75a..43c6504 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 fbc98d6..ca91848 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 e87d8bd..5f77bb1 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 19b2575..145fcaf 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 86700f8..545fa27 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 c411edd..2f7079e 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 cd311de..d3fbb92 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 c98bead..82ac0ec 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> @@ -8,6 +8,8 @@ * initial version 27/iii/95 by Simon Tatham */ +#include "compiler.h" + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -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"; @@ -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 ad43d85..317c528 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 34a8edc..8b1d3cf 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 e28f284..cd07fe7 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 e556186..0b3f999 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 a0238da..94ba1cb 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 691241d..8330557 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 6abd13c..b4bf6d6 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 cd24c2d..063724e 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 df813d1..1d4cd43 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 c094a56..a6ae156 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 ac72279..2539499 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 82210a6..26be0c4 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 8ee1b7b..e1a3ddf 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 6026ccd..ce54d8e 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> @@ -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)) ) { @@ -1,3 +1,5 @@ +#include "compiler.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -6,6 +6,8 @@ * distributed in the NASM archive. */ +#include "compiler.h" + #include <stdio.h> #include <stdlib.h> #include <limits.h> @@ -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"; |