dependency-gen-escaping.c 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. // PR15642
  2. // RUN: %clang -M -MG -fno-ms-compatibility %s | FileCheck -strict-whitespace %s --check-prefix=CHECK --check-prefix=SEP2F
  3. // RUN: %clang -M -MG -fms-compatibility %s | FileCheck -strict-whitespace %s --check-prefix=CHECK --check-prefix=SEP5C
  4. // RUN: %clang -M -MG -MV %s | FileCheck -strict-whitespace %s --check-prefix=NMAKE
  5. // CHECK: \ \ \ \ .h
  6. // CHECK: $$$$.h
  7. // CHECK: \#\#.h
  8. // NMAKE: " .h"
  9. // NMAKE: "$$.h"
  10. // NMAKE: "##.h"
  11. // NMAKE-NOT: "
  12. // NMAKE: normal.h
  13. // NMAKE-NOT: "
  14. #include " .h"
  15. #include "$$.h"
  16. #include "##.h"
  17. #include "normal.h"
  18. // Backslash followed by # or space should escape both characters, because
  19. // that's what GNU Make wants. GCC does the right thing with space, but not
  20. // #, so Clang does too. (There should be 3 backslashes before the #.)
  21. // SEP2F: a{{[/\\]}}b{{[/\\]}}\#c{{/|\\\\}}\ d.h
  22. // With -fms-compatibility, Backslashes in #include are treated as path separators.
  23. // Backslashes are given in the emission for special characters, like 0x20 or 0x23.
  24. // SEP5C: a{{[/\\]}}b{{[/\\]}}\#c{{/|\\\\}}\ d.h
  25. // These combinations are just another case for NMAKE.
  26. // NMAKE: "a{{[/\\]}}b{{[/\\]}}#c{{[/\\]}} d.h"
  27. #include "a\b\#c\ d.h"