summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-02-08 10:05:49 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-02-08 10:05:49 -0800
commitc2f6baabc35632e566e47447114d47f192b46dee (patch)
treec10bac4686acc14368571857b2cf6f1dc177ca7b
parentc5123e9482fff0b86b30bda74e94ae2d66ef01bf (diff)
parentf0d92fd19ad01b99a93a766f482d2ecaa3ca91a8 (diff)
downloadnasm-c2f6baabc35632e566e47447114d47f192b46dee.tar.gz
Merge branch 'master' of ssh://repo.or.cz/srv/git/nasm
-rw-r--r--compiler.h9
-rwxr-xr-xdirectiv.pl2
-rwxr-xr-xmacros.pl2
-rw-r--r--nasmlib.c11
-rw-r--r--nasmlib.h8
-rwxr-xr-xpptok.pl2
-rwxr-xr-xtokhash.pl2
7 files changed, 26 insertions, 10 deletions
diff --git a/compiler.h b/compiler.h
index de7c0e4f..e9022f86 100644
--- a/compiler.h
+++ b/compiler.h
@@ -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++) {
diff --git a/macros.pl b/macros.pl
index e64fead9..67aa08cb 100755
--- a/macros.pl
+++ b/macros.pl
@@ -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++) {
diff --git a/nasmlib.c b/nasmlib.c
index ecd6d8df..3c26546a 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -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);
diff --git a/nasmlib.h b/nasmlib.h
index e8526ab4..f480c062 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -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
diff --git a/pptok.pl b/pptok.pl
index 1ea2e7e5..2dbf0fe6 100755
--- a/pptok.pl
+++ b/pptok.pl
@@ -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++) {
diff --git a/tokhash.pl b/tokhash.pl
index 509520bb..07bc6abe 100755
--- a/tokhash.pl
+++ b/tokhash.pl
@@ -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++) {