Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing VAR s: POINTER TO ARRAY OF CHAR passes compilation but later doesn't compile in C #94

Open
norayr opened this issue Nov 8, 2020 · 2 comments

Comments

@norayr
Copy link
Member

norayr commented Nov 8, 2020

in case we have function with this signature:

PROCEDURE Get*(VAR s: POINTER TO ARRAY OF CHAR);

it compiles to:

export void modulename_Get (struct {
        ADDRESS len[1];
        CHAR data[1];
} **s);


void modulename_Get (struct {
        ADDRESS len[1];
        CHAR data[1];
} **s)
{
...

and then C compiler doesn't compile the generated C code with the following error:

modulename.c:16:25: warning: anonymous struct declared inside parameter list will not be visible outside of this definition or declaration
   16 | export void modulename_Get (struct {
      |                         ^~~~~~
modulename.c:22:18: warning: anonymous struct declared inside parameter list will not be visible outside of this definition or declaration
   22 | void modulename_Get (struct {
      |                  ^~~~~~
modulename.c:22:6: error: conflicting types for ‘modulename_Get’
   22 | void modulename_Get (struct {
      |      ^~~~~~~~~~
modulename.c:16:13: note: previous declaration of ‘modulename_Get’ was here
   16 | export void modulename_Get (struct {
      |             ^~~~~~~~~~
C compile: gcc -fPIC -g -I "/opt/voc/2/include"  -c modulename.c
@norayr
Copy link
Member Author

norayr commented Nov 8, 2020

same without VAR by the way.
left here to look at this one day.

@diegosardina
Copy link

in case we have function with this signature:

PROCEDURE Get*(VAR s: POINTER TO ARRAY OF CHAR);

This procedure is not usable in Oberon-2 because that type is anonymous (and it looks like the same in C today).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants