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

LibCore: Rename identifiers that can clash with libc macros #4127

Merged
merged 1 commit into from
Dec 22, 2020
Merged

LibCore: Rename identifiers that can clash with libc macros #4127

merged 1 commit into from
Dec 22, 2020

Conversation

ericonr
Copy link
Contributor

@ericonr ericonr commented Nov 20, 2020

POSIX allows these default streams to be macros, which means that on
such systems (musl libc is one) building Lagom will fail due to the
File::stdin() functions. Undefining them at the top of the file is
enough to fix it.

@awesomekling
Copy link
Collaborator

This doesn't feel like a very sturdy fix. What happens to code that includes <LibCore/File.h> after including such a libc header?
It seems better to just rename these functions on our side if it's a problem.
cc @bugaevc

@bugaevc
Copy link
Member

bugaevc commented Nov 20, 2020

Agreed, undefining them is not great, let's rename ours instead.

@ericonr
Copy link
Contributor Author

ericonr commented Nov 20, 2020

Any suggestions for the names?

@bugaevc
Copy link
Member

bugaevc commented Nov 21, 2020

Perhaps std_in(), or standard_in(), or standard_input()

@ccapitalK
Copy link
Collaborator

I vote standard_input(), I feel like it makes the most sense.

@ericonr
Copy link
Contributor Author

ericonr commented Dec 11, 2020

Sorry for the time it took! Should follow the proposed solution now.

@ericonr ericonr changed the title LibCore/File.cpp: undefine stream identifiers - stdout, stderr and stdin LibCore: don't use standard stream identifiers Dec 11, 2020
…c macros.

POSIX allows the default streams (stdin, stdout and stderr) to be
macros, which means that on such systems (musl libc is one) building
Lagom will fail due to the File::std*() names.

Also fix any files that use these identifiers.
@ericonr
Copy link
Contributor Author

ericonr commented Dec 22, 2020

It also passes CI now :D

@awesomekling awesomekling changed the title LibCore: don't use standard stream identifiers LibCore: Rename identifiers that can clash with libc macros Dec 22, 2020
@awesomekling awesomekling merged commit a8f0e48 into SerenityOS:master Dec 22, 2020
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.

None yet

4 participants