[GHC] #13366: addCStub doesn't allow control over compiler flags or source file file

GHC ghc-devs at haskell.org
Fri Mar 3 01:27:28 UTC 2017


#13366: addCStub doesn't allow control over compiler flags or source file file
-------------------------------------+-------------------------------------
           Reporter:  bgamari        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:  8.2.1
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Currently if you pass a C source file on the GHC command line you can
 control whether the compiler treats it as C or C++ via the it's extension:
 GCC will treat a file ending in `.c` as C, whereas `.cpp` is treated as
 C++.

 However, we currently have no means of controlling what language a stub
 added with in Template Haskell with `addCStub` will be treated as.
 Consequently it is currently impossible to compile a C++ source file with
 `addCStub` without using `-optc`. Moreover, you can't have mixed C/C++
 stubs at all.

 It really seems like this interface should be amended to fix this before
 we release it in 8.2. Perhaps `addCStub` should accept both the source and
 a set of compiler flags which will be added to the usual flags (allowing
 one to pass `-x c++` to the compiler when compiling C++ files)?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13366>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list