LibCore: Rename identifiers that can clash with libc macros (#4127)
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.
This commit is contained in:
parent
abc98dea09
commit
a8f0e489a4
Notes:
sideshowbarker
2024-07-19 00:40:02 +09:00
Author: https://github.com/ericonr Commit: https://github.com/SerenityOS/serenity/commit/a8f0e489a4f Pull-request: https://github.com/SerenityOS/serenity/pull/4127
7 changed files with 13 additions and 13 deletions
|
@ -241,7 +241,7 @@ static RefPtr<File> stdin_file;
|
|||
static RefPtr<File> stdout_file;
|
||||
static RefPtr<File> stderr_file;
|
||||
|
||||
NonnullRefPtr<File> File::stdin()
|
||||
NonnullRefPtr<File> File::standard_input()
|
||||
{
|
||||
if (!stdin_file) {
|
||||
stdin_file = File::construct();
|
||||
|
@ -250,7 +250,7 @@ NonnullRefPtr<File> File::stdin()
|
|||
return *stdin_file;
|
||||
}
|
||||
|
||||
NonnullRefPtr<File> File::stdout()
|
||||
NonnullRefPtr<File> File::standard_output()
|
||||
{
|
||||
if (!stdout_file) {
|
||||
stdout_file = File::construct();
|
||||
|
@ -259,7 +259,7 @@ NonnullRefPtr<File> File::stdout()
|
|||
return *stdout_file;
|
||||
}
|
||||
|
||||
NonnullRefPtr<File> File::stderr()
|
||||
NonnullRefPtr<File> File::standard_error()
|
||||
{
|
||||
if (!stderr_file) {
|
||||
stderr_file = File::construct();
|
||||
|
|
|
@ -58,9 +58,9 @@ public:
|
|||
};
|
||||
bool open(int fd, IODevice::OpenMode, ShouldCloseFileDescriptor);
|
||||
|
||||
static NonnullRefPtr<File> stdin();
|
||||
static NonnullRefPtr<File> stdout();
|
||||
static NonnullRefPtr<File> stderr();
|
||||
static NonnullRefPtr<File> standard_input();
|
||||
static NonnullRefPtr<File> standard_output();
|
||||
static NonnullRefPtr<File> standard_error();
|
||||
|
||||
private:
|
||||
File(Object* parent = nullptr)
|
||||
|
|
|
@ -128,14 +128,14 @@ public:
|
|||
return Buffered<OutputFileStream> { file_result.value() };
|
||||
}
|
||||
|
||||
static OutputFileStream stdout()
|
||||
static OutputFileStream standard_output()
|
||||
{
|
||||
return OutputFileStream { Core::File::stdout() };
|
||||
return OutputFileStream { Core::File::standard_output() };
|
||||
}
|
||||
|
||||
static Buffered<OutputFileStream> stdout_buffered()
|
||||
{
|
||||
return Buffered<OutputFileStream> { Core::File::stdout() };
|
||||
return Buffered<OutputFileStream> { Core::File::standard_output() };
|
||||
}
|
||||
|
||||
size_t write(ReadonlyBytes bytes) override
|
||||
|
|
|
@ -44,6 +44,6 @@ int main()
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto engine = ChessEngine::construct(Core::File::stdin(), Core::File::stdout());
|
||||
auto engine = ChessEngine::construct(Core::File::standard_input(), Core::File::standard_output());
|
||||
return loop.exec();
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ int main(int argc, char** argv)
|
|||
};
|
||||
|
||||
if (!files.size() && !recursive) {
|
||||
auto stdin_file = Core::File::stdin();
|
||||
auto stdin_file = Core::File::standard_input();
|
||||
for (;;) {
|
||||
auto line = stdin_file->read_line();
|
||||
bool is_binary = line.bytes().contains_slow(0);
|
||||
|
|
|
@ -41,7 +41,7 @@ int main(int argc, char** argv)
|
|||
RefPtr<Core::File> file;
|
||||
|
||||
if (!path) {
|
||||
file = Core::File::stdin();
|
||||
file = Core::File::standard_input();
|
||||
} else {
|
||||
auto file_or_error = Core::File::open(path, Core::File::ReadOnly);
|
||||
if (file_or_error.is_error()) {
|
||||
|
|
|
@ -62,7 +62,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
if (list || extract) {
|
||||
auto file = Core::File::stdin();
|
||||
auto file = Core::File::standard_input();
|
||||
|
||||
if (archive_file) {
|
||||
auto maybe_file = Core::File::open(archive_file, Core::IODevice::OpenMode::ReadOnly);
|
||||
|
|
Loading…
Add table
Reference in a new issue