Re: [m-users.] C compiler error

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
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
> [email protected]
> https://lists.mercurylang.org/listinfo/users

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmP84sUACgkQ+K4ydFOs
HoUt9w/9FqBDSLWIJYXMZfq44yy684+z7vbgdZXDZR55Sr2fO8dISyP6yCU/zdOB
HVASANbq+vj80NArtXCQEvpHGlVfd5hfjpSViZATiaYE8/Jk6LQvTbvpUW2s2qWu
yV0m9RzhogjlFK52ho6aOzcUjG/ECzbTuvfIEJur4oV9wpdvval4OHTOUKmo7vIb
C7cVjAi6jvwU4EXbKQwxpFFXYLCYSEjk1Xz9M+6isuqwiuGGTCoPjL9kIIQQWbVS
mXuemOMlU1Z+vCK/IgcI8tInLwFTOaJ1KVpea26Zu6At4tT1Ofs1di9y9OZVhoSp
qV0txt9Om4vfJ8zhBKaoTSKW4SJrYyEaaE3zBaGafZtcf0SlH7R9wTd8GsZVql3U
Sa/bdyPuVk09StjEHSxzvSNlnV7eQ4PFMYmQng5ZpgtKORhU88bgN+vhlD/exSjX
uL298a4J3VLL1+76RE1+wpczmICaUl03IyC7uPYOTidm2LY8kulEAxkoZNylZrH5
SPAfIoJEHdMoV7+tlPGVQK9RDNmLHSTIto6Fi6FcRVVoQvTEvXOaN1RlkEu6+LWa
GN78VihA+qmdUR5WCT1ngDtoCtz//ewgTLrciM+j+P3lBy0rUtJUuj26eEFOCNgJ
cIHHs4sK0aH1E5BHkU5cr9OsSWhiM4xsdGC67vg2qRpp2tIt3C8=
=znUX
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.