aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-13 21:48:21 -0800
committerMichael Forney <mforney@mforney.org>2019-02-13 21:49:25 -0800
commit84ef3f01055c3a5177f5d0ad90e826bab2eb81bd (patch)
treefcc0897fd103ab204a3cde84311abb76341d6cc8
parent0dd40e7482785238968dc2c9a36bc2bfd7896df4 (diff)
Make __builtin_va_list a built-in declaration, not keyword
-rw-r--r--decl.c6
-rw-r--r--decl.h6
-rw-r--r--main.c1
-rw-r--r--pp.c1
-rw-r--r--token.c1
-rw-r--r--token.h1
6 files changed, 7 insertions, 9 deletions
diff --git a/decl.c b/decl.c
index 4c89753..1699e3e 100644
--- a/decl.c
+++ b/decl.c
@@ -18,6 +18,7 @@
#include "token.h"
#include "type.h"
+struct declaration builtinvalist = {.kind = DECLTYPE, .type = &typevalist};
struct declaration builtinvastart = {.kind = DECLBUILTIN};
struct declaration builtinvaarg = {.kind = DECLBUILTIN};
struct declaration builtinvaend = {.kind = DECLBUILTIN};
@@ -309,11 +310,6 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspecifier *fs, int *a
case T_ATOMIC:
fatal("_Atomic is not yet supported");
break;
- case T__BUILTIN_VA_LIST:
- t = &typevalist;
- ++ntypes;
- next();
- break;
case TSTRUCT:
case TUNION:
case TENUM:
diff --git a/decl.h b/decl.h
index 3e3c5af..024d78a 100644
--- a/decl.h
+++ b/decl.h
@@ -25,7 +25,11 @@ struct declaration {
struct scope;
struct function;
-extern struct declaration builtinvastart, builtinvaarg, builtinvaend, builtinoffsetof;
+extern struct declaration builtinvalist;
+extern struct declaration builtinvastart;
+extern struct declaration builtinvaarg;
+extern struct declaration builtinvaend;
+extern struct declaration builtinoffsetof;
struct declaration *mkdecl(enum declarationkind, struct type *, enum linkage);
_Bool decl(struct scope *, struct function *);
diff --git a/main.c b/main.c
index c8491eb..4402730 100644
--- a/main.c
+++ b/main.c
@@ -53,6 +53,7 @@ main(int argc, char *argv[])
next();
}
} else {
+ scopeputdecl(&filescope, "__builtin_va_list", &builtinvalist);
scopeputdecl(&filescope, "__builtin_va_start", &builtinvastart);
scopeputdecl(&filescope, "__builtin_va_arg", &builtinvaarg);
scopeputdecl(&filescope, "__builtin_va_end", &builtinvaend);
diff --git a/pp.c b/pp.c
index 0ca7a28..41b67ed 100644
--- a/pp.c
+++ b/pp.c
@@ -28,7 +28,6 @@ keyword(struct token *tok)
{"_Noreturn", T_NORETURN},
{"_Static_assert", T_STATIC_ASSERT},
{"_Thread_local", T_THREAD_LOCAL},
- {"__builtin_va_list", T__BUILTIN_VA_LIST},
{"auto", TAUTO},
{"break", TBREAK},
{"case", TCASE},
diff --git a/token.c b/token.c
index 7b079f7..d118fd7 100644
--- a/token.c
+++ b/token.c
@@ -52,7 +52,6 @@ static char *tokstr[] = {
[T_NORETURN] = "_Noreturn",
[T_STATIC_ASSERT] = "_Static_assert",
[T_THREAD_LOCAL] = "_Thread_local",
- [T__BUILTIN_VA_LIST] = "__builtin_va_list",
/* punctuator */
[TLBRACK] = "[",
diff --git a/token.h b/token.h
index ecede55..3b0fbb7 100644
--- a/token.h
+++ b/token.h
@@ -54,7 +54,6 @@ enum tokenkind {
T_NORETURN,
T_STATIC_ASSERT,
T_THREAD_LOCAL,
- T__BUILTIN_VA_LIST,
/* punctuator */
TLBRACK,