Skip to content

Conversation

@janus
Copy link
Member

@janus janus commented Oct 11, 2025

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

  • I have tested these changes locally.
  • My code follows the project's coding style guidelines.
  • I have reviewed my own code to ensure quality.
  • Unnecessary comments were removed.

Additional Notes

Add any additional notes or context about this pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Warning Suppression: Unused parameter warnings have been suppressed across numerous C functions by casting the parameters to void.
  • Empty Translation Unit Fixes: Many C files that previously contained only includes or forward declarations now include a typedef int __dummy_type; to prevent 'empty translation unit' compilation warnings.
  • Struct Definition Refinements: The ast_t struct definition in type.h has been adjusted for C standard compliance, and a dummy member was added to ast_kind_union_t to prevent warnings about empty structs.
  • Enum Handling Updates: Functions related to value handling (value_destroy, value_log, value_name) have been updated to correctly process the VALUE_TYPE_SIZE enum, preventing unhandled enum case warnings.
  • Variable Declaration Hoisting: A variable declaration in validator_validate_direct_expression_item.c was hoisted to a broader scope, addressing potential C standard compliance warnings.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
typedef int dummy_type; // Placeholder to avoid empty translation unit error

@janus
Copy link
Member Author

janus commented Oct 11, 2025

@jbampton @BaseMax @anufdo
Please review.

@BaseMax
Copy link
Member

BaseMax commented Oct 11, 2025

typedef int __dummy_type; // Placeholder to avoid empty translation unit error What is this line for?

@BaseMax
Copy link
Member

BaseMax commented Oct 11, 2025

I can understand this line (void)type; // Suppress unused parameter warning.

@janus
Copy link
Member Author

janus commented Oct 12, 2025

typedef int __dummy_type; // Placeholder to avoid empty translation unit error What is this line for?

warning: ISO C forbids an empty translation unit [-Wpedantic]
gcc when compiled with -pedantic reports a diagnostic when the translation unit is empty as it is requested by the C Standard.

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.

@jbampton jbampton self-assigned this Dec 6, 2025
@jbampton jbampton requested a review from a team as a code owner December 6, 2025 23:10
@jbampton
Copy link
Member

jbampton commented Dec 6, 2025

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:

https://github.com/SalamLang

@BDadmehr0
Copy link
Member

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:

https://github.com/SalamLang

Thank you! Glad to join the maintainer team — I’ll do my best and help with PR reviews.

Copy link
Member

@BDadmehr0 BDadmehr0 left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants