• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Boost.Wave: A Standard compliant C++ preprocessor library
3     http://www.boost.org/
4 
5     Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
6     Software License, Version 1.0. (See accompanying file
7     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
9 
10 // Test, if additional whitespace is inserted at appropriate places.
11 
12 #define STRINGIZE(x) STRINGIZE_D(x)
13 #define STRINGIZE_D(x) #x
14 
15 #define X() 1
16 #define PLUS() +
17 #define MINUS() -
18 #define DOT() .
19 #define GREATER() >
20 #define LESS() <
21 
22 //R #line 23 "t_9_003.cpp"
23 X()2                          //R 1 2
24 STRINGIZE( X()2 )             //R "12"
25 //R
26 X() 2                         //R 1 2
27 STRINGIZE( X() 2 )            //R "1 2"
28 //R
29 PLUS()MINUS()                 //R +-
30 STRINGIZE( PLUS()MINUS() )    //R "+-"
31 //R
32 PLUS()PLUS()                  //R + +
33 STRINGIZE( PLUS()PLUS() )     //R "++"
34 //R
35 MINUS()MINUS()                //R - -
36 STRINGIZE( MINUS()MINUS() )   //R "--"
37 //R
38 DOT()DOT()DOT()               //R .. .
39 STRINGIZE( DOT()DOT()DOT() )  //R "..."
40 
41 // the following are regressions reported by Stefan Seefeld
42 //R #line 43 "t_9_003.cpp"
43 GREATER()GREATER()            //R > >
44 STRINGIZE( GREATER()GREATER() ) //R ">>"
45 //R
46 LESS()LESS()                  //R < <
47 STRINGIZE( LESS()LESS() )     //R "<<"
48 
49 #define COMMA() ,
50 #define AND() &
51 #define CHAR() char
52 #define STAR() *
53 
54 // Make sure no whitespace gets inserted in between the operator symbols
55 //R #line 56 "t_9_003.cpp"
56 void foo(char&, char)               //R void foo(char&, char)
57 void foo(char *)                    //R void foo(char *)
58 void foo(char *&)                   //R void foo(char *&)
59 void foo(CHAR()AND()COMMA() CHAR()) //R void foo(char&, char)
60 void foo(CHAR() STAR())             //R void foo(char *)
61 void foo(CHAR() STAR()AND())        //R void foo(char *&)
62