-
-
Notifications
You must be signed in to change notification settings - Fork 21
Fix compilation warnings #1119
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
base: main
Are you sure you want to change the base?
Fix compilation warnings #1119
Conversation
Summary of ChangesHello @janus, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses and resolves various compilation warnings present in the codebase. The changes primarily focus on improving adherence to the C language standard by suppressing unused parameter warnings, introducing dummy types in otherwise empty translation units, refining struct definitions, and ensuring comprehensive handling of enum types. The overall impact is a cleaner compilation process and enhanced code quality. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses several compilation warnings by suppressing unused parameter warnings, adding placeholders for empty translation units, and fixing a declaration scope issue. The changes are straightforward and improve the build process. My main feedback is regarding the naming of the placeholder type used in empty source files, which uses a reserved identifier pattern. Using a non-reserved name would be safer and more portable. See the specific comments for details.
| #include "ast_argument_item_create.h" | ||
|
|
||
| // Implementation here | ||
| typedef int __dummy_type; // Placeholder to avoid empty translation unit error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this fixes the empty translation unit warning, using identifiers that begin with a double underscore like __dummy_type is not recommended. Such names are reserved for the C implementation (compiler and standard library). Using them can lead to undefined behavior if they conflict with an implementation-defined name. A safer alternative would be to use a name that doesn't fall into the reserved namespace. This comment applies to all other files where __dummy_type has been introduced.
| typedef int __dummy_type; // Placeholder to avoid empty translation unit error | |
| typedef int dummy_type; // Placeholder to avoid empty translation unit error |
| @@ -1,0 +1 @@ | |||
| typedef int __dummy_type; // Placeholder to avoid empty translation unit error | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in other files, identifiers starting with a double underscore are reserved. Please use a non-reserved name to avoid potential conflicts and undefined behavior.
| typedef int __dummy_type; // Placeholder to avoid empty translation unit error | |
| typedef int dummy_type; // Placeholder to avoid empty translation unit error |
| #include "generator_llvm.h" | ||
|
|
||
| // generator_llvm(...) | ||
| typedef int __dummy_type; // Placeholder to avoid empty translation unit error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This identifier __dummy_type uses a reserved name pattern (starts with double underscore). To ensure portability and avoid undefined behavior, please use a name that is not reserved.
| typedef int __dummy_type; // Placeholder to avoid empty translation unit error | |
| typedef int dummy_type; // Placeholder to avoid empty translation unit error |
|
|
|
I can understand this line |
Translation Unit: In C, a translation unit refers to the source file after preprocessing (including headers, resolving macros, etc.) that the compiler then processes to generate object code. Empty Translation Unit: The ISO C standard requires a translation unit to contain at least one declaration (e.g., a variable declaration, a function prototype, a function definition, a typedef, etc.). An entirely blank source file or one that only contains comments or preprocessor directives without resulting in any declarations will trigger this warning. |
|
Hey @BDadmehr0 you have been upgraded with write access to the main Salam repo and have been added to the official maintainer team as see at the next two links: https://github.com/orgs/SalamLang/teams/maintainers/members https://github.com/orgs/SalamLang/teams/maintainers/repositories The "maintainer" team will be called for PR reviews on all PRs The new maintainer team has been listed on our organization homepage: |
Thank you! Glad to join the maintainer team — I’ll do my best and help with PR reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required change: Please rename all __dummy_type identifiers to avoid reserved double underscore names. Suggest using dummy_type or another non-reserved name for portability and standard compliance.
Other changes like (void)parameter; and dummy members in structs/unions look fine. Please also ensure CI failures are addressed before merging.
Description
The PR removes warnings during compilation
Related Issue
During compilation the compiler complains using warnings because of violation of C language standard
Proposed Changes
Introduces some dummy variables and suppresses unused parameters. Also hoist label declaration.
Checklist
Additional Notes
Add any additional notes or context about this pull request.