macro_paste_msextensions.c 747 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // RUN: not %clang_cc1 -P -E -fms-extensions %s | FileCheck -strict-whitespace %s
  2. // This horrible stuff should preprocess into (other than whitespace):
  3. // int foo;
  4. // int bar;
  5. // int baz;
  6. int foo;
  7. // CHECK: int foo;
  8. #define comment /##/ dead tokens live here
  9. comment This is stupidity
  10. int bar;
  11. // CHECK: int bar;
  12. #define nested(x) int x comment cute little dead tokens...
  13. nested(baz) rise of the dead tokens
  14. ;
  15. // CHECK: int baz
  16. // CHECK: ;
  17. // rdar://8197149 - VC++ allows invalid token pastes: (##baz
  18. #define foo(x) abc(x)
  19. #define bar(y) foo(##baz(y))
  20. bar(q)
  21. // CHECK: abc(baz(q))
  22. #define str(x) #x
  23. #define collapse_spaces(a, b, c, d) str(a ## - ## b ## - ## c ## d)
  24. collapse_spaces(1a, b2, 3c, d4)
  25. // CHECK: "1a-b2-3cd4"