[m-users.] C compiler error

Volker Wysk post at volker-wysk.de
Tue Feb 28 04:05:09 AEDT 2023


Hi.

I've taken a look at the mq.c file. There, mq_module0, mq_module1 and so on
are automatically generated C functions. And their storage class is invalid.
So this would be a Mercury compiler bug.

Cheers,
Volker

Am Montag, dem 27.02.2023 um 15:49 +0100 schrieb Volker Wysk:
> Hi.
> 
> I have a Mercury module with a lot of foreign C code, and I get many
> compiler errors like this:
> 
> Making Mercury/os/mq.o
> Mercury/cs/mq.c: In function ‘null_to_empty’:
> Mercury/cs/mq.c:644:1: error: invalid storage class for function
> ‘mq_module0’
> Mercury/cs/mq.c:644:1: error: invalid storage class for function
> ‘mq_module0’
> Mercury/cs/mq.c:764:1: error: invalid storage class for function
> ‘mq_module1’
> Mercury/cs/mq.c:764:1: error: invalid storage class for function
> ‘mq_module1’
> ...
> 
> 
> 
> The function in question is this:
> 
> :- pragma foreign_code("C",
> "
>   char * null_to_empty(char * str)
>   {
>     if (str == 0) {
>        MR_String str1 = MR_GC_malloc(1);
>        *str1 = (char) 0;
>        return str1;
>     } else {
>        return str;
>     }
> ").
> 
> 
> I don't understand what those C compiler options are saying...
> 
> Volker
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20230227/e285d5dd/attachment.sig>


More information about the users mailing list