1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

Kernel: Remove FIFO::{attach,detach}(Direction)

These functions would have caused a `-Woverloaded-virtual` warning with
GCC 13, as they shadow `File::{attach,detach}(OpenFileDescription&)`.

Both of these functions had a single call site. This commit inlines
`attach` into its only caller, `FIFO::open_direction`.

Instead of explicitly checking `is_fifo()` in `~OpenFileDescription`
before running the `detach(Direction)` overload, let's just override the
regular `detach(OpenFileDescription&)` for `FIFO` to perform this action
instead.
This commit is contained in:
Daniel Bertalan 2023-05-11 11:02:37 +02:00 committed by Andreas Kling
parent f666989c9e
commit 2123fdd678
3 changed files with 10 additions and 20 deletions

View file

@ -32,17 +32,12 @@ public:
ErrorOr<NonnullRefPtr<OpenFileDescription>> open_direction(Direction);
ErrorOr<NonnullRefPtr<OpenFileDescription>> open_direction_blocking(Direction);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
void attach(Direction);
void detach(Direction);
#pragma GCC diagnostic pop
private:
// ^File
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override;
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
virtual ErrorOr<struct stat> stat() const override;
virtual void detach(OpenFileDescription&) override;
virtual bool can_read(OpenFileDescription const&, u64) const override;
virtual bool can_write(OpenFileDescription const&, u64) const override;
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(OpenFileDescription const&) const override;