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

Sean Charles (emacstheviking) objitsu at gmail.com
Sat Apr 27 06:55:12 AEST 2024


This used to compiler:

:- pragma foreign_type("C", rsound,   "MR_Integer", [can_pass_as_mercury_type]).
:- pragma foreign_type("C", rmusic,   "MR_Integer", [can_pass_as_mercury_type]).
:- pragma foreign_type("C", rfont,    "MR_Integer", [can_pass_as_mercury_type]).
:- pragma foreign_type("C", rtexture, "MR_Integer", [can_pass_as_mercury_type]).
:- pragma foreign_type("C", rshader,  "MR_Integer", [can_pass_as_mercury_type]).

But having upgraded to 22.01.8 it ails with:

Mercury/cs/raylib.c:5997:25: error: incompatible pointer to integer conversion passing 'char *' to parameter of type 'MR_Word' (aka 'unsigned long') [-Wint-conversion]
                Files = MR_list_cons(MR_copy_string(dfl.paths[i]), Files);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_tags.h:115:5: note: expanded from macro 'MR_list_cons'
    MR_typed_list_cons(                                                 \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_tags.h:97:9: note: expanded from macro 'MR_typed_list_cons'
        MR_create2((ti_head), (head), (ti_tail), (tail))))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_heap.h:610:29: note: expanded from macro 'MR_create2'
            MR_create2_func((w1), (w2))
                            ^
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_tags.h:44:61: note: expanded from macro 'MR_mkword'
#define MR_mkword(t, p)             ((MR_Word *) ((char *) (p) + (t)))
                                                            ^
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_heap.h:583:25: note: passing argument to parameter 'w1' here
MR_create2_func(MR_Word w1, MR_Word w2)
                        ^
Mercury/cs/raylib.c:6644:25: error: incompatible pointer to integer conversion passing 'char *' to parameter of type 'MR_Word' (aka 'unsigned long') [-Wint-conversion]
                Files = MR_list_cons(MR_copy_string(dfl.paths[i]), Files);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_tags.h:115:5: note: expanded from macro 'MR_list_cons'
    MR_typed_list_cons(                                                 \
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_tags.h:97:9: note: expanded from macro 'MR_typed_list_cons'
        MR_create2((ti_head), (head), (ti_tail), (tail))))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_heap.h:610:29: note: expanded from macro 'MR_create2'
            MR_create2_func((w1), (w2))
                            ^
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_tags.h:44:61: note: expanded from macro 'MR_mkword'
#define MR_mkword(t, p)             ((MR_Word *) ((char *) (p) + (t)))
                                                            ^
/usr/local/mercury-22.01.8/lib/mercury/inc/mercury_heap.h:583:25: note: passing argument to parameter 'w1' here
MR_create2_func(MR_Word w1, MR_Word w2)
                        ^
Mercury/cs/raylib.c:7123:16: error: incompatible pointer to integer conversion assigning to 'MR_Integer' (aka 'long') from 'void *' [-Wint-conversion]
        RMusic = p;
               ^ ~
Mercury/cs/raylib.c:7274:16: error: incompatible pointer to integer conversion assigning to 'MR_Integer' (aka 'long') from 'void *' [-Wint-conversion]
        RSound = p;
               ^ ~
Mercury/cs/raylib.c:7700:13: error: incompatible pointer to integer conversion assigning to 'MR_Integer' (aka 'long') from 'void *' [-Wint-conversion]
        Out = p;
            ^ ~
Mercury/cs/raylib.c:7999:13: error: incompatible pointer to integer conversion assigning to 'MR_Integer' (aka 'long') from 'void *' [-Wint-conversion]
        Out = p;
            ^ ~
6 errors generated.

So whats is the way to declare a pointer type?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20240426/2684824e/attachment.html>


More information about the users mailing list