| 1 |
/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ |
| 2 |
|
| 3 |
/* { dg-do preprocess } */ |
| 4 |
/* { dg-options "-ansi" } */ |
| 5 |
|
| 6 |
/* This tests that we avoid accidental pasting, as well as gratuitous |
| 7 |
space insertion, in various nasty places _inside_ a macro's |
| 8 |
replacement list: on either side of a paste, and on either side of |
| 9 |
an argument. It also tests that we don't pass empty macro leading |
| 10 |
whitespace to the next line - this problem use to break Emacs |
| 11 |
preprocessor abuse. |
| 12 |
|
| 13 |
Neil Booth, 1 Feb 2001. */ |
| 14 |
|
| 15 |
#define EMPTY_WITH_LEADING_SPACE |
| 16 |
#define f(x, y) :x: -y##> -##y> |
| 17 |
#define g(x, y) :x: :y##2 2##y: |
| 18 |
|
| 19 |
/* This should preprocess as |
| 20 |
|
| 21 |
: : : - > - > |
| 22 |
:2: :22 22: |
| 23 |
|
| 24 |
We used to get a space at the start of the line. */ |
| 25 |
|
| 26 |
EMPTY_WITH_LEADING_SPACE |
| 27 |
f(:,) |
| 28 |
g(2, 2) |
| 29 |
|
| 30 |
/* { dg-final { scan-file avoidpaste2.i "(^|\\n): : : - > - >" } } |
| 31 |
{ dg-final { scan-file avoidpaste2.i "(^|\\n):2: :22 22:" } } */ |