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

Do not include files that have already been included. #911

Merged
merged 1 commit into from
Oct 8, 2023
Merged

Conversation

dvander
Copy link
Member

@dvander dvander commented Oct 8, 2023

If two #included files have the same inode, only the first include will be parsed. this obsoletes the "#if ... #endinput" hack in every include file.

Nominally #include in SourcePawn was the same as C/C++, where you can include the same file over and over. This is useful in C/C++ for creating macro expansion tables. It's not useful in Pawn, where those tricks don't work, and as evidenced by the fact that not a single plugin in the corpus was affected by this change.

This greatly simplifies how static scopes are handled, since SourcePawn's notion of a static scope is per-file, rather than per-translation unit. This simplification re-opens the door to multiple translation units, an important step for an upcoming refactoring of how builtins work.

If two #included files have the same inode, only the first include will
be parsed. This obsoletes the "#if ... #endinput" hack in every include
file.

Nominally #include in SourcePawn was the same as C/C++, where you can
include the same file over and over. This is useful in C/C++ for
creating macro expansion tables. It's not useful in Pawn, where those
tricks don't work, and as evidenced by the fact that not a single plugin
in the corpus was affected by this change.

This greatly simplifies how static scopes are handled, since
SourcePawn's notion of a static scope is per-file, rather than
per-translation unit. This simplification re-opens the door to multiple
translation units, an important step for an upcoming refactoring of how
builtins work.
@dvander dvander merged commit d41725f into master Oct 8, 2023
19 checks passed
@dvander dvander deleted the sema2 branch October 8, 2023 04:51
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.

1 participant