aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--c/lex.c11
-rw-r--r--test/07-pp.c4
2 files changed, 11 insertions, 4 deletions
diff --git a/c/lex.c b/c/lex.c
index b9b2635..e9333fc 100644
--- a/c/lex.c
+++ b/c/lex.c
@@ -781,13 +781,16 @@ ppdefine(struct lexer *lx)
if (mac.variadic) {
error(&tk.span, "expected `)' after `...'");
if (tk.t == TKEOF || tk.t == '\n') return;
- else break;
+ break;
}
if (params.n > 0) {
- if (tk.t != ',') {
+ if (tk.t == TKDOTS) { /* GNU extension 'args...' */
+ mac.variadic = 1;
+ continue;
+ } if (tk.t != ',') {
error(&tk.span, "expected `,' or `)'");
if (tk.t == TKEOF || tk.t == '\n') return;
- else break;
+ break;
}
lex0(lx, &tk);
}
@@ -799,7 +802,7 @@ ppdefine(struct lexer *lx)
} else {
error(&tk.span, "expected parameter name or `)'");
if (tk.t == TKEOF || tk.t == '\n') return;
- else break;
+ break;
}
}
if (!params.n) vfree(&params);
diff --git a/test/07-pp.c b/test/07-pp.c
index 6a50571..47b9dbb 100644
--- a/test/07-pp.c
+++ b/test/07-pp.c
@@ -6,6 +6,7 @@ Foo,5 9 1506
join: "x ## y"
wide L"abc123 猫,€á💫", U+1f98b
Output ends here
+ok ...
*/
#include "07-pp.h"
@@ -31,6 +32,8 @@ u\
t\
s
+#define gnu_ext(a, c...) a(c)
+
#ifdef CMD_WORKING
int
main(V)
@@ -60,6 +63,7 @@ S\
* escapes the 0, ending the string early.
*/
);
+ gnu_ext(printf, "ok %s\n", "...");
CAT(ret,urn) 0;
}