[m-users.] Change in compiler behaviour for 22.01.8 ? Pointer type strictness increased?

Volker Wysk post at volker-wysk.de
Sat Apr 27 19:06:35 AEST 2024


Hi, Sean

Am Samstag, dem 27.04.2024 um 08:42 +0100 schrieb Sean Charles
(emacstheviking):
> Nope. 

Really? That's strange. I have this in the improved ODBC library:

:- pragma foreign_type("C", statement, "MODBC_Statement *",
    [can_pass_as_mercury_type]).

And it works. 

But, this is the type of MR_copy_string:

    extern char *MR_copy_string(const char *s);

And you have:

    Files = MR_list_cons(MR_copy_string(dfl.paths[i]), Files);

MR_list_cons is a macro, which I can't see what it does, at the first go.
But it seems like it requires an MR_Word as the first argument. Try this:

    Files = MR_list_cons((MR_Word) MR_copy_string(dfl.paths[i]), Files);

It seems like the C compiler is stricter than in the previous Mercury
version, with respect to implicit type conversions. Perhaps someone has
added a parameter for the call of gcc. The "-Wint-conversion" from your
error messages could be it.

Cheers,
Volker

> 
> > On 27 Apr 2024, at 04:19, Volker Wysk <post at volker-wysk.de> wrote:
> > 
> > Am Freitag, dem 26.04.2024 um 21:55 +0100 schrieb Sean Charles
> > (emacstheviking):
> > > This used to compiler:
> > > 
> > > :- pragma foreign_type("C", rsound,   "MR_Integer",
> > > [can_pass_as_mercury_type]).
> > 
> > Change that to:
> > 
> > :- pragma foreign_type("C", rsound, "char *",[can_pass_as_mercury_type]).
> > 
> > Or:
> > 
> > :- pragma foreign_type("C", rsound, "void *",[can_pass_as_mercury_type]).
> > 
> > ?
> > 
> > Volker
> > _______________________________________________
> > users mailing list
> > users at lists.mercurylang.org
> > https://lists.mercurylang.org/listinfo/users
> 
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users



More information about the users mailing list