+2000-09-04 Jakub Jelinek <jakub@redhat.com>
+
+ * cpplex.c (ON_REST_ARG): Check VAR_ARGS flag of current context,
+ use posn - 1 to index into tokens array.
+ (maybe_paste_with_next): Adjust caller.
+
2000-09-03 Geoff Keating <geoffk@cygnus.com>
* invoke.texi: Document the -mvxworks option for rs6000 ELF.
#define CURRENT_CONTEXT(pfile) ((pfile)->contexts + (pfile)->cur_context)
#define ON_REST_ARG(c) \
(((c)->flags & VAR_ARGS) \
- && (c)->u.list->tokens[(c)->posn].val.aux \
- == (unsigned int) ((c)->u.list->paramc - 1))
+ && ((c)-1)->u.list->tokens[((c)-1)->posn - 1].val.aux \
+ == (unsigned int) (((c)-1)->u.list->paramc - 1))
#define ASSIGN_FLAGS_AND_POS(d, s) \
do {(d)->flags = (s)->flags & (PREV_WHITE | BOL | PASTE_LEFT); \
the special extended semantics (see above). */
if (token->type == CPP_COMMA
&& IS_ARG_CONTEXT (CURRENT_CONTEXT (pfile))
- && ON_REST_ARG (CURRENT_CONTEXT (pfile) - 1))
+ && ON_REST_ARG (CURRENT_CONTEXT (pfile)))
/* no warning */;
else
cpp_warning (pfile,
+2000-09-04 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/cpp/paste8.c: New test.
+
2000-09-01 Alexandre Oliva <aoliva@redhat.com>
* gcc.c-torture/compile/20000827-1.c: New test.
--- /dev/null
+/* { dg-do preprocess } */
+/* { dg-options "" } */
+
+int foo(int, ...);
+
+#define a(x, y...) foo(x, ##y)
+a(1)
+a(1, 2, 3)
+#define b(x, y, z...) foo(x, ##y)
+b(1, 2, 3) /* { dg-warning "pasting would not" } */
+#define c(x, y, z...) foo(x, ##z)
+c(1, 2)
+c(1, 2, 3)
+#define d(x) foo(##x) /* { dg-warning "nothing can be pasted" } */
+d(1)