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

Don't #include inside extern "C" blocks. #2108

Merged
merged 6 commits into from
Feb 16, 2021
Merged

Conversation

nlewycky
Copy link
Contributor

Also free the malloc'd error string in print_wasmer_error().

Run the C code through clang-format.

Also free the malloc'd error string in print_wasmer_error().

Run the C code through clang-format.
Copy link
Contributor

@MarkMcCaskey MarkMcCaskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good -- thanks!

Comment on lines +291 to +293
c_statements.push(CStatement::LiteralConstant {
value: "\n#ifdef __cplusplus\n}\n#endif\n\n".to_string(),
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember much about the abstractions here but it might be nice to have the CPlusPlus guard be a thing that can work on nested data / trees so we don't have to remember to close it ourselves.

Don't let that block this PR though

int error_len = wasmer_last_error_length();
printf("Error len: `%d`\n", error_len);
char* error_str = (char*) malloc(error_len);
char *error_str = (char *)malloc(error_len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will never believe that char *name is more readable or accurate than char* name 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

char x, *y, f() is a char, a pointer-to-char and a function that returns a char. What a language! 😆

@nlewycky
Copy link
Contributor Author

bors r+

bors bot added a commit that referenced this pull request Feb 12, 2021
2108: Don't #include inside extern "C" blocks. r=nlewycky a=nlewycky

Also free the malloc'd error string in print_wasmer_error().

Run the C code through clang-format.


Co-authored-by: Nick Lewycky <[email protected]>
Co-authored-by: nlewycky <[email protected]>
@bors
Copy link
Contributor

bors bot commented Feb 12, 2021

Build failed:

The header file generated by engine-object-file doesn't #include the wasm types it needs and relies on these being included before it.
@nlewycky
Copy link
Contributor Author

bors r+

bors bot added a commit that referenced this pull request Feb 15, 2021
2108: Don't #include inside extern "C" blocks. r=nlewycky a=nlewycky

Also free the malloc'd error string in print_wasmer_error().

Run the C code through clang-format.


Co-authored-by: Nick Lewycky <[email protected]>
Co-authored-by: nlewycky <[email protected]>
@bors
Copy link
Contributor

bors bot commented Feb 15, 2021

Build failed:

@nlewycky
Copy link
Contributor Author

bors r+

@bors
Copy link
Contributor

bors bot commented Feb 16, 2021

@bors bors bot merged commit c19ebc3 into master Feb 16, 2021
@bors bors bot deleted the feature/no-include-from-extern-c branch February 16, 2021 20:22
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

Successfully merging this pull request may close these issues.

3 participants