Opened 5 years ago

Closed 5 years ago

#10147 closed bug (duplicate)

Clang CPP adds extra newline character

Reported by: mpickering Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.4
Keywords: cpp Cc:
Operating System: MacOS X Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Running the following command (taken from the settings file)

cat ImportsSemi.hs | gcc -E -undef -traditional -Wunicode -Wno-invalid-pp-token -Wno-unicode - > out.hs

on any file results in a file which has an extra newline character appended to the end. This result is different from when gcc is used as the preprocessor, in this case no extra newline is appended.

I appreciate that this isn't important to most users but it is important for ghc-exactprint. With the extra newline character the EOF marker is moved one line further down. When we come to output the AST, we also get an extra newline at the bottom of the file which breaks roundtripping.

> gcc --version
Configured with: --prefix=/Applications/ --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

Change History (1)

comment:1 Changed 5 years ago by rwbarton

Resolution: duplicate
Status: newclosed

Same as #10146.

Note: See TracTickets for help on using tickets.