diff options
author | H. Peter Anvin <hpa@zytor.com> | 2016-02-08 10:05:49 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2016-02-08 10:05:49 -0800 |
commit | c2f6baabc35632e566e47447114d47f192b46dee (patch) | |
tree | c10bac4686acc14368571857b2cf6f1dc177ca7b | |
parent | c5123e9482fff0b86b30bda74e94ae2d66ef01bf (diff) | |
parent | f0d92fd19ad01b99a93a766f482d2ecaa3ca91a8 (diff) | |
download | nasm-c2f6baabc35632e566e47447114d47f192b46dee.tar.gz |
Merge branch 'master' of ssh://repo.or.cz/srv/git/nasm
-rw-r--r-- | compiler.h | 9 | ||||
-rwxr-xr-x | directiv.pl | 2 | ||||
-rwxr-xr-x | macros.pl | 2 | ||||
-rw-r--r-- | nasmlib.c | 11 | ||||
-rw-r--r-- | nasmlib.h | 8 | ||||
-rwxr-xr-x | pptok.pl | 2 | ||||
-rwxr-xr-x | tokhash.pl | 2 |
7 files changed, 26 insertions, 10 deletions
@@ -188,4 +188,13 @@ char *strsep(char **, const char *); # define no_return void #endif +/* + * How to tell the compiler that a function takes a printf-like string + */ +#ifdef __GNUC__ +# define printf_func(fmt, list) __attribute__((format(printf, fmt, list))) +#else +# define printf_func(fmt, list) +#endif + #endif /* NASM_COMPILER_H */ diff --git a/directiv.pl b/directiv.pl index 51d0ec38..b567aff9 100755 --- a/directiv.pl +++ b/directiv.pl @@ -143,7 +143,7 @@ if ($output eq 'h') { # Put a large value in unused slots. This makes it extremely unlikely # that any combination that involves unused slot will pass the range test. # This speeds up rejection of unrecognized tokens, i.e. identifiers. - print C "#define UNUSED 16383\n"; + print C "#define UNUSED (65535/3)\n"; print C " static const int16_t hash1[$n] = {\n"; for ($i = 0; $i < $n; $i++) { @@ -225,7 +225,7 @@ print OUT " };\n"; # Put a large value in unused slots. This makes it extremely unlikely # that any combination that involves unused slot will pass the range test. # This speeds up rejection of unrecognized tokens, i.e. identifiers. -print OUT "#define UNUSED 16383\n"; +print OUT "#define UNUSED (65535/3)\n"; print OUT " static const int16_t hash1[$n] = {\n"; for ($i = 0; $i < $n; $i++) { @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2014 The NASM Authors - All Rights Reserved + * Copyright 1996-2016 The NASM Authors - All Rights Reserved * See the file AUTHORS included with the NASM distribution for * the specific copyright holders. * @@ -83,6 +83,15 @@ void nasm_error(int severity, const char *fmt, ...) va_end(ap); } +no_return nasm_panic(int flags, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + nasm_verror(flags | ERR_PANIC, fmt, ap); + abort(); /* We should never get here */ +} + void *nasm_malloc(size_t size) { void *p = malloc(size); @@ -75,12 +75,10 @@ extern unsigned char nasm_tolower_tab[256]; */ typedef void (*efunc) (int severity, const char *fmt, ...); typedef void (*vefunc) (int severity, const char *fmt, va_list ap); -#ifdef __GNUC__ -void nasm_error(int severity, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -#else -void nasm_error(int severity, const char *fmt, ...); -#endif +void printf_func(2, 3) nasm_error(int severity, const char *fmt, ...); void nasm_set_verror(vefunc); +no_return printf_func(2, 3) nasm_panic(int flags, const char *fmt, ...); +#define panic() nasm_panic(ERR_NOFILE, "Internal error at %s:%d\n", __FILE__, __LINE__); /* * These are the error severity codes which get passed as the first @@ -207,7 +207,7 @@ if ($what eq 'c') { # Put a large value in unused slots. This makes it extremely unlikely # that any combination that involves unused slot will pass the range test. # This speeds up rejection of unrecognized tokens, i.e. identifiers. - print OUT "#define UNUSED 16383\n"; + print OUT "#define UNUSED (65535/3)\n"; print OUT " static const int16_t hash1[$n] = {\n"; for ($i = 0; $i < $n; $i++) { @@ -232,7 +232,7 @@ if ($output eq 'h') { # Put a large value in unused slots. This makes it extremely unlikely # that any combination that involves unused slot will pass the range test. # This speeds up rejection of unrecognized tokens, i.e. identifiers. - print "#define UNUSED 16383\n"; + print "#define UNUSED (65535/3)\n"; print " static const int16_t hash1[$n] = {\n"; for ($i = 0; $i < $n; $i++) { |