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

[C-Generics] Hashed Filename missmatch #1780

Closed
mkhubaibumer opened this issue May 24, 2023 · 2 comments · Fixed by #1804
Closed

[C-Generics] Hashed Filename missmatch #1780

mkhubaibumer opened this issue May 24, 2023 · 2 comments · Fixed by #1804
Assignees
Labels
bug Something isn't working c Related to C target

Comments

@mkhubaibumer
Copy link
Collaborator

When using generics and writing a little complex structure like follow the compilation is terminated as the generated Hash name for component mismatches

target C;

// Hash issue
// Header name mismatch
reactor bundle <In, Out> {
    input in:In;
    output out:Out;
}

reactor Parent<In, Out> extends bundle {
    input in2:In;
    output out2:Out;
    reaction(in, in2) -> out, out2 {=
        if (in->is_present)
            lf_set(out, in->value * 3.1415);
        else
            lf_set(out2, in2->value * 3.1415);
    =}
}

reactor Child<T1, In, Out> extends Parent {
    reaction(in, in2) {=
        int a = in->is_present ? in->value : in2->value;
        printf("Got %d\n", a);
    =}
}

reactor Super<T1, T2, T3, In, Out> extends bundle {
    state t1:T1;
    c = new Child<T3, In, Out>();
    in -> c.in;
    c.out -> out;   
}

main reactor {
    cc = new Super<long, double, char, int, float>();
}

this produces the following output

In file included from /Users/khubaibumer/git/LF_Collaboration/CGenericsProposal/src-gen/test/super53186033.c:4:
/Users/khubaibumer/git/LF_Collaboration/CGenericsProposal/src-gen/test/./super53186033.h:4:10: fatal error: 'child662411343.h' file not found
#include "child662411343.h"In file included from /Users/khubaibumer/git/LF_Collaboration/CGenericsProposal/src-gen/test/test586877047_main.c:4:
In file included from /Users/khubaibumer/git/LF_Collaboration/CGenericsProposal/src-gen/test/./test586877047_main.h:4:
/Users/khubaibumer/git/LF_Collaboration/CGenericsProposal/src-gen/test/./super53186033.h:4:10 ^~~~~~~~~~~~~~~~~~:
fatal error: 'child662411343.h' file not found
#include "child662411343.h"
^~~~~~~~~~~~~~~~~~
11 error generated.
error generated.
make[2]: *** [CMakeFiles/test.dir/test586877047_main.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/test.dir/super53186033.c.o] Error 1
In file included from /Users/khubaibumer/git/LF_Collaboration/CGenericsProposal/src-gen/test/test.c:19:
/Users/khubaibumer/git/LF_Collaboration/CGenericsProposal/src-gen/test/./super53186033.h:4:10: fatal error: 'child662411343.h' file not found
#include "child662411343.h"
^~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/test.dir/test.c.o] Error 1
make[1]: *** [CMakeFiles/test.dir/all] Error 2
make: *** [all] Error 2

@mkhubaibumer mkhubaibumer added bug Something isn't working c Related to C target labels May 24, 2023
@petervdonovan
Copy link
Collaborator

This hashcode-based mechanism (which I am responsible for) needs to be replaced with something that is less ad hoc. In addition to having this bug, it also causes generated files to accumulate in src-gen instead of replacing old files, and it results in file names that are unnecessarily long and hard to read.

@petervdonovan petervdonovan self-assigned this May 24, 2023
@petervdonovan
Copy link
Collaborator

This is closely related to the second point in #1765; in order to fully close this issue it will be necessary to address that part of #1765. It might take perhaps a week to do this.

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

Successfully merging a pull request may close this issue.

2 participants