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

Generated test application (blechc -app) includes the blech program as .c file #12

Open
schorg opened this issue Jan 27, 2023 · 6 comments

Comments

@schorg
Copy link
Member

schorg commented Jan 27, 2023

The Blech compiler automatically generates a test program - blech.c by default - with the following command line

blechc --app --trace control.blc

Compiling all generated C-files generates duplicate symbol warnings.

cd blech
clang -Iinclude *.c
duplicate symbol '_blc_blech_01control01_init' in:
    /var/folders/l9/p0sgmsvj16v16tgzlplc3flm0000gn/T/blech-4471ee.o
    /var/folders/l9/p0sgmsvj16v16tgzlplc3flm0000gn/T/control-74f76a.o
... and so on

Reason: The EntryPoint file control.c is included as a control.c instead of control.h
into blech.c.

I am on it.

schorg added a commit that referenced this issue Jan 27, 2023
@FriedrichGretz
Copy link
Contributor

It is not a bug, it is a feature which, however, confuses even those who introduced it years ago ;-)

@schorg
Copy link
Member Author

schorg commented Jan 27, 2023

Can't remember the reason. Can you elaborate on this

@FriedrichGretz
Copy link
Contributor

Before pushing to master, did you check all the code gen tests? With your commit all of them should be broken, if I remember correctly

@FriedrichGretz
Copy link
Contributor

The test program and the blech.c are tightly coupled so instead of including the header and compiling to C files, we directly include the code and you only need to compile the test program. Additionally compiling the blech.c is what raised the warnings.

@schorg
Copy link
Member Author

schorg commented Jan 27, 2023

Created a branch for this. The issue creates problems when compiling the C code to WebAssembly. I will look into the code generation tests, before I do a pull request

@FriedrichGretz
Copy link
Contributor

Ah sorry, did not see the new branch when I clicked on the commit

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