Opened 7 years ago

Closed 3 years ago

Last modified 3 years ago

#4268 closed bug (fixed)

Warning for ANN pragmas when GHCi is not supported

Reported by: simonmar Owned by:
Priority: high Milestone: 7.8.1
Component: Compiler Version: 7.0.4
Keywords: Cc: bgamari@…, juhp@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: #8312, #5105 Differential Rev(s):
Wiki Page:

Description

There's no flag to enable the annotations extension, as far as I can tell.

Change History (19)

comment:1 Changed 7 years ago by igloo

Owner: set to igloo

comment:2 Changed 7 years ago by igloo

Annotations are pragmas, which we haven't historically had extensions for. Some options:

  • Do nothing.
  • Ignore (but warn about) ANN pragmas if TemplateHaskell is off (I infer from the docs that they rely on TH). If they are a well-behaved pragma then ignoring them won't affect the correctness of the code.
  • Add an extension for annotations.
  • Add an extension for each pragma GHC knows about.

comment:3 Changed 7 years ago by igloo

Resolution: fixed
Status: newclosed

Consensus was "do nothing".

comment:4 Changed 5 years ago by nomeata

Owner: igloo deleted
Resolution: fixed
Status: closednew
Version: 6.12.37.0.4

Can you please reconsider option two? On Debian, we have several arches where ghci does not work. It is already a pitty that we cannot build any TH-using library there, but now we also have to remove anything using annotation, e.g. haskell-vector.

Thanks, Joachim

comment:5 Changed 5 years ago by bgamari

Cc: bgamari@… added

comment:6 Changed 5 years ago by igloo

Milestone: 7.0.17.6.1

comment:7 Changed 4 years ago by igloo

Milestone: 7.6.17.6.2

comment:8 Changed 4 years ago by juhpetersen

Cc: juhp@… added

comment:9 Changed 3 years ago by nomeata

People are starting to us annotation for example to tell HLint something, e.g. https://github.com/ekmett/distributive/issues/2 that this breaks compilation on non-stage2-architectures is really annoying.

What speaks against issuing a warning if GHCi is not available?

Last edited 3 years ago by nomeata (previous) (diff)

comment:10 Changed 3 years ago by simonmar

Milestone: 7.6.27.8.1
Priority: normalhigh
Summary: Annotation extension needs a flagWarning for ANN pragmas when GHCi is not supported

We don't want a flag for the ANN pragma, because pragmas don't normally have flags to enable them, they are unconditionally enabled. However, ANN might not be supported if GHC is built without GHCi support (say on a platform that doesn't have GHCi support), so in those cases we want to emit a warning.

Therefore this ticket is now for adding a warning when an ANN pragma is being ignored.

comment:11 Changed 3 years ago by nomeata

According to #8312, Annotations will require a -X flag in the future, and in a non-GHCi-compiler, we still get an error (not a warning), requiring distributions to patch annotations out of the code. In light of #8312, do you still think that it should be a warning, and not an error?

comment:12 Changed 3 years ago by nomeata

Nevermind, #8312 was not about the -X flag; that was just a discussion on the mailing lists.

So basically you are saying that we should replace the error message introduced in #8312 by a warning, right?

comment:13 Changed 3 years ago by simonmar

Thanks for the pointer to #8312, but I don't see where it says that annotations will require a flag, could you help me out?

Yes, I think it should be a warning, not an error.

comment:14 Changed 3 years ago by simonmar

comment:15 Changed 3 years ago by simonmar

comment:16 Changed 3 years ago by Simon Peyton Jones <simonpj@…>

In 6c1aba4ff27371fddfc0dce5f9256c97edf16eea/ghc:

Warn if you use ANN annotations with a stage-1 compiler (Trac #4268)

This makes us give a civilised warning when we hit an
  {-# ANN f foo #-}
pragma in a stage-1 compiler.

We decided that, since it's a pragma, it does not need a language
extension flag to enable it.

comment:17 Changed 3 years ago by simonpj

Resolution: fixed
Status: newclosed

I don't know how to make a test that runs the stage-1 compiler and it's not that important, so I'm closing without a regression test.

Simon

comment:18 Changed 3 years ago by simonmar

Might have been slightly better to say "this is a stage-1 compiler or doesn't support GHCi" or somesuch, because some platforms just don't support GHCi. Not a big deal though.

comment:19 Changed 3 years ago by Simon Peyton Jones <simonpj@…>

In 434d78360154684a0d5086643a572c955de90c7d/ghc:

Improve error message

Accommodating Simon M's suggestion (Trac #4268, comment 17)
Note: See TracTickets for help on using tickets.