Ticket #7678 (new bug)

Opened 3 months ago

Last modified 6 weeks ago

GHC should compile cleanly with clang

Reported by: thoughtpolice Owned by: thoughtpolice
Priority: high Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: clang Cc: anton.nik@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Building GHC failed Difficulty: Unknown
Test Case: Blocked By:
Blocking: #7602 Related Tickets:

Description

I'm running into several difficulties (which I'll catalog shortly) building GHC HEAD with Clang 3.2. These mostly seem to be difficulties relating to the preprocessor and the fact clang does not really respect -traditional-cpp mode, and that it is stricter than gcc about whitespace and whatnot too. This means code like:

{-# RULES

 "thing" ...

  #-}

becomes invalid: clang is strict about the fact that preprocessor definitions must occur on the beginning of a line. There seems to be a bug in the preprocessor directive source code to this effect (that it doesn't handle whitespace before a directive.) It's quite unfortunate, because we do this a lot.

This also causes build failures in the parser due to some crazy CPP hackery we do. I'll follow up with that shortly.

As a workaround, we may have to force CPP to just continue being cpp which will Do The Right Thing, while CC will use clang instead. Or we'll have to have some script that seds whitespace out or something.

This currently blocks #7602 since I can't test my fix otherwise.

Change History

Changed 3 months ago by aseipp@…

commit 213e1c71e8c574e989f463ca623bef6d2dcccea6

Author: Austin Seipp <aseipp@pobox.com>
Date:   Sun Feb 10 02:22:29 2013 -0600

    Make sure ./configure tests valid C99 programs. Issue #7678.
    
    Clang gives a big fat warning that there's no return value for the
    statement, since the prototype defaults to 'int'.
    
    Signed-off-by: Austin Seipp <aseipp@pobox.com>

 aclocal.m4 |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Changed 3 months ago by aseipp@…

commit 61e8d5df26522b01922bc5358b9c233de0d1fc29

Author: Austin Seipp <aseipp@pobox.com>
Date:   Sun Feb 10 02:24:28 2013 -0600

    Better detection of clang in ./configure. Issue #7678.
    
    Signed-off-by: Austin Seipp <aseipp@pobox.com>

 aclocal.m4      |   19 +++++++++++++++----
 configure.ac    |    8 +++++++-
 mk/config.mk.in |    4 ++++
 3 files changed, 26 insertions(+), 5 deletions(-)

Changed 6 weeks ago by igloo

  • priority changed from normal to high
  • difficulty set to Unknown
  • milestone set to 7.8.1

Changed 6 weeks ago by lelf

  • cc anton.nik@… added
Note: See TracTickets for help on using tickets.