Skip to content

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

Open
@norayr

Description

@norayr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions