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

can't translate compound struct and union #172

Open
1000copy opened this issue Feb 3, 2024 · 1 comment
Open

can't translate compound struct and union #172

1000copy opened this issue Feb 3, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@1000copy
Copy link

1000copy commented Feb 3, 2024

On my Mac OS X 13.6, I have c language code which already compiled with compiler, like the piece:

// filename : main.c
typedef enum {asymbol,anumber}atom_type;
typedef struct sexpr_ sexpr;
typedef struct {
    atom_type type;
    union{
        char* a;
        double num;
    };
} atom;
typedef enum {slist,satom}sexpr_type;
typedef struct{
    int len;
    sexpr* a;
} list;
typedef struct sexpr_{
    sexpr_type type;
    union{
        list* list;
        atom* atom;
    };
}sexpr;
#include <stdio.h>
int main(){
    sexpr s = {.type = satom};
    printf("%d",s.type);

}

When I run cmd c2v main.c,A error occured:

error: inline comment is deprecated, please use line comment
   21 | fn main()  {
   22 |     s := Sexpr {
   23 |     /*FAILED TO FIND STRUCT "Sexpr"*/Sexpr_type.satom, }
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   24 |     
   25 |     C.printf(c'%d', s.type_)

What should I do next to solve the problem?

@JalonSolov JalonSolov added the Bug Something isn't working label Feb 3, 2024
@JalonSolov
Copy link
Contributor

There are 2 bugs here.

  1. V no longer supports inline comments, so c2v should stop generating them.

  2. c2v didn't keep track of the rename from sexpr_type to Sexpr_type, as it needs to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants