
#10147: Clang CPP adds extra newline character -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.4 Keywords: cpp | Operating System: MacOS X Architecture: | Type of failure: None/Unknown Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- 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/Xcode.app/Contents/Developer/usr --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 }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10147 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler