haskell / c2hs

c2hs is a pre-processor for Haskell FFI bindings to C libraries
http://hackage.haskell.org/package/c2hs
Other
198 stars 50 forks source link

c2hs builds with -fno-warn-incomplete-patterns #179

Closed kolmodin closed 7 years ago

kolmodin commented 7 years ago

c2hs builds with

 ghc-options:    -Wall -fno-warn-incomplete-patterns -fwarn-tabs

and then fails at runtime;

c2hs: src/C2HS/Gen/Bind.hs:(1426,5)-(1444,66): Non-exhaustive patterns in function addDft
kolmodin commented 7 years ago

Turning the incomplete patterns warnings back on;

src/C2HS/Gen/Bind.hs:1426:5: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for ‘addDft’:
        Patterns not matched:
            (CHSPlusParm _:_) []
            (CHSParm _ _ True _ _ _ _:_) [_]
kolmodin commented 7 years ago

I had written this c2hs code;

-- | Validate the key of a metadata pair.
{#fun pure grpc_header_key_is_legal as isKeyValid
  { 'useAsCStringLen'* `B.ByteString'&} -> `Bool' #}

But the C code had been updated from char*, size_t to grpc_slice;

GRPCAPI int grpc_header_key_is_legal(grpc_slice slice);

Thus c2hs expects two arguments in the C function, but there was only one. Naturally c2hs needs to fail generating the bindings, but the failure should be informative.

deech commented 7 years ago

I am unable to upload to Hackage. upload-failed

@ian-ross Can you add me to the Hackage group?

ian-ross commented 7 years ago

@deech Just tried to add you. Do you get some sort of email when I do that? Because you're not just appearing on the maintainers list when I add you (username deech, I guess?).

deech commented 7 years ago

I haven't yet. Just refreshed the Hackage page and I don't see my email address listed.

ian-ross commented 7 years ago

Hmmm. Maybe the web form for adding maintainers doesn't work. Let me just pull from the repo, add you to the maintainers list in the Cabal file and do an upload. That might work better. Just give me a minute...

ian-ross commented 7 years ago

OK, I've just uploaded 0.28.2 with you added to the maintainers list in the Cabal file. It doesn't make editing the maintainers list in the web form work any better though...

deech commented 7 years ago

Ok, I see the version up there with my email address. Let's see if it works on the next release. Thanks!