From b5c76d7559a09473d75283c5b12fce7b1651e7bd Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 17 Jan 2019 01:41:36 +0100 Subject: [PATCH] Get rid of #ifdef SERENITY. We're past that phase of bootstrapping. --- AK/Assertions.h | 6 ------ AK/StdLibExtras.h | 16 ---------------- AK/Traits.h | 4 ---- AK/kmalloc.h | 18 ------------------ AK/kstdio.h | 6 ------ AK/ktime.h | 7 ------- LibC/Makefile | 1 + VirtualFileSystem/DiskBackedFileSystem.cpp | 5 ----- VirtualFileSystem/DiskDevice.h | 4 ---- VirtualFileSystem/FileDescriptor.cpp | 7 ------- VirtualFileSystem/FileDescriptor.h | 8 -------- VirtualFileSystem/Limits.h | 5 ----- VirtualFileSystem/UnixTypes.h | 8 -------- Widgets/Rect.cpp | 1 - 14 files changed, 1 insertion(+), 95 deletions(-) diff --git a/AK/Assertions.h b/AK/Assertions.h index 3c1e778a6f1..4439c5dbc51 100644 --- a/AK/Assertions.h +++ b/AK/Assertions.h @@ -1,16 +1,10 @@ #pragma once -#ifdef SERENITY #ifdef KERNEL #include #else #include #endif -#else -#include -#define ASSERT(x) assert(x) -#define ASSERT_NOT_REACHED() assert(false) -#endif namespace AK { diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index 4e50a3cad1b..8c13ee0e12b 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -1,48 +1,32 @@ #pragma once -#ifdef SERENITY #ifdef KERNEL #include #else #include #include #endif -#else -#include -#include -#include -#endif #include ALWAYS_INLINE void fast_dword_copy(dword* dest, const dword* src, size_t count) { -#ifdef SERENITY asm volatile( "rep movsl\n" : "=S"(src), "=D"(dest), "=c"(count) : "S"(src), "D"(dest), "c"(count) : "memory" ); -#else - memcpy(dest, src, count * sizeof(dword)); -#endif } ALWAYS_INLINE void fast_dword_fill(dword* dest, dword value, size_t count) { -#ifdef SERENITY asm volatile( "rep stosl\n" : "=D"(dest), "=c"(count) : "D"(dest), "c"(count), "a"(value) : "memory" ); -#else - for (size_t i = 0; x <= count; ++x) { - dest[i] = value; - } -#endif } namespace AK { diff --git a/AK/Traits.h b/AK/Traits.h index b3c89571a38..734212187ad 100644 --- a/AK/Traits.h +++ b/AK/Traits.h @@ -26,11 +26,7 @@ template struct Traits { static unsigned hash(const T* p) { -#ifdef SERENITY return intHash((dword)p); -#else - return intHash((unsigned long long)p & 0xffffffff); -#endif } static void dump(const T* p) { kprintf("%p", p); } }; diff --git a/AK/kmalloc.h b/AK/kmalloc.h index c28dddcae41..3c8102c0fd4 100644 --- a/AK/kmalloc.h +++ b/AK/kmalloc.h @@ -11,7 +11,6 @@ private: #define AK_MAKE_ETERNAL #endif -#ifdef SERENITY #ifdef KERNEL #include #else @@ -30,20 +29,3 @@ void* kmalloc_eternal(size_t) MALLOC_ATTR; inline void* operator new(size_t, void* p) { return p; } inline void* operator new[](size_t, void* p) { return p; } #endif -#else -#include - -#include "Types.h" - -extern "C" { - -void* kcalloc(size_t nmemb, size_t size); -void* kmalloc(size_t size) MALLOC_ATTR; -void kfree(void* ptr); -void* krealloc(void* ptr, size_t size); -void* kmalloc_eternal(size_t) MALLOC_ATTR; - -} - -#endif - diff --git a/AK/kstdio.h b/AK/kstdio.h index 00b06977127..8b5e7ff0f14 100644 --- a/AK/kstdio.h +++ b/AK/kstdio.h @@ -1,9 +1,3 @@ #pragma once -#ifdef SERENITY #include -#else -#include -#define kprintf printf -#define ksprintf sprintf -#endif diff --git a/AK/ktime.h b/AK/ktime.h index 326c4ecce47..07d9a1b8884 100644 --- a/AK/ktime.h +++ b/AK/ktime.h @@ -1,10 +1,3 @@ #pragma once -#ifdef SERENITY #include -#else -#include -#define ktime time -#define klocaltime localtime -#endif - diff --git a/LibC/Makefile b/LibC/Makefile index 719781da421..5ee5958a3a8 100644 --- a/LibC/Makefile +++ b/LibC/Makefile @@ -8,6 +8,7 @@ AK_OBJS = \ WIDGETS_OBJS = \ ../Widgets/Painter.o \ ../Widgets/Font.o \ + ../Widgets/Rect.o \ ../Widgets/GraphicsBitmap.o \ ../Widgets/CharacterBitmap.o \ ../Widgets/Color.o diff --git a/VirtualFileSystem/DiskBackedFileSystem.cpp b/VirtualFileSystem/DiskBackedFileSystem.cpp index 359a04f5e5f..8f17f859ea8 100644 --- a/VirtualFileSystem/DiskBackedFileSystem.cpp +++ b/VirtualFileSystem/DiskBackedFileSystem.cpp @@ -1,10 +1,5 @@ #include "DiskBackedFileSystem.h" - -#ifdef SERENITY #include "i386.h" -#else -typedef int InterruptDisabler; -#endif //#define DBFS_DEBUG diff --git a/VirtualFileSystem/DiskDevice.h b/VirtualFileSystem/DiskDevice.h index 71a5c6c6477..071c5cd63bd 100644 --- a/VirtualFileSystem/DiskDevice.h +++ b/VirtualFileSystem/DiskDevice.h @@ -3,12 +3,8 @@ #include #include -#ifdef SERENITY // FIXME: Support 64-bit DiskOffset typedef dword DiskOffset; -#else -typedef qword DiskOffset; -#endif class DiskDevice : public Retainable { public: diff --git a/VirtualFileSystem/FileDescriptor.cpp b/VirtualFileSystem/FileDescriptor.cpp index d98bd28b8f9..60f89cda173 100644 --- a/VirtualFileSystem/FileDescriptor.cpp +++ b/VirtualFileSystem/FileDescriptor.cpp @@ -5,11 +5,8 @@ #include "UnixTypes.h" #include #include "FIFO.h" - -#ifdef SERENITY #include "TTY.h" #include "MasterPTY.h" -#endif RetainPtr FileDescriptor::create(RetainPtr&& inode) { @@ -64,21 +61,17 @@ RetainPtr FileDescriptor::clone() if (!descriptor) return nullptr; descriptor->m_current_offset = m_current_offset; -#ifdef SERENITY descriptor->m_is_blocking = m_is_blocking; descriptor->m_file_flags = m_file_flags; -#endif return descriptor; } -#ifndef SERENITY bool additionWouldOverflow(Unix::off_t a, Unix::off_t b) { ASSERT(a > 0); uint64_t ua = a; return (ua + b) > maxFileOffset; } -#endif int FileDescriptor::stat(Unix::stat* buffer) { diff --git a/VirtualFileSystem/FileDescriptor.h b/VirtualFileSystem/FileDescriptor.h index 860e3a09dfe..65d3c05a979 100644 --- a/VirtualFileSystem/FileDescriptor.h +++ b/VirtualFileSystem/FileDescriptor.h @@ -7,11 +7,9 @@ #include #include -#ifdef SERENITY class TTY; class MasterPTY; class Process; -#endif class FileDescriptor : public Retainable { public: @@ -45,7 +43,6 @@ public: CharacterDevice* character_device() { return m_device.ptr(); } const CharacterDevice* character_device() const { return m_device.ptr(); } -#ifdef SERENITY bool is_tty() const; const TTY* tty() const; TTY* tty(); @@ -53,7 +50,6 @@ public: bool is_master_pty() const; const MasterPTY* master_pty() const; MasterPTY* master_pty(); -#endif InodeMetadata metadata() const; Inode* inode() { return m_inode.ptr(); } @@ -61,7 +57,6 @@ public: bool supports_mmap() const { return m_inode && !m_device; } -#ifdef SERENITY bool is_blocking() const { return m_is_blocking; } void set_blocking(bool b) { m_is_blocking = b; } @@ -70,7 +65,6 @@ public: bool is_fifo() const { return m_fifo; } FIFO::Direction fifo_direction() { return m_fifo_direction; } -#endif ByteBuffer& generator_cache() { return m_generator_cache; } @@ -87,12 +81,10 @@ private: ByteBuffer m_generator_cache; -#ifdef SERENITY bool m_is_blocking { true }; dword m_file_flags { 0 }; RetainPtr m_fifo; FIFO::Direction m_fifo_direction { FIFO::Neither }; -#endif }; diff --git a/VirtualFileSystem/Limits.h b/VirtualFileSystem/Limits.h index f04a200d644..00d063e7b76 100644 --- a/VirtualFileSystem/Limits.h +++ b/VirtualFileSystem/Limits.h @@ -2,12 +2,7 @@ #include "UnixTypes.h" -#ifdef SERENITY inline static const Unix::off_t maxFileOffset = 2147483647; -#else -#include -inline static const Unix::off_t maxFileOffset = std::numeric_limits::max(); -#endif static const size_t GoodBufferSize = 4096; diff --git a/VirtualFileSystem/UnixTypes.h b/VirtualFileSystem/UnixTypes.h index d4eb3aedcdd..6084a23985a 100644 --- a/VirtualFileSystem/UnixTypes.h +++ b/VirtualFileSystem/UnixTypes.h @@ -231,7 +231,6 @@ struct tms { clock_t tms_cstime; }; -#ifdef SERENITY typedef void (*__sighandler_t)(int); typedef __sighandler_t sighandler_t; @@ -256,16 +255,9 @@ struct sigaction { #define SIG_UNBLOCK 1 #define SIG_SETMASK 2 -#endif - -#ifdef SERENITY // FIXME: Support 64-bit offsets! typedef signed_dword off_t; typedef unsigned int time_t; -#else -typedef signed_qword off_t; -typedef ::time_t time_t; -#endif struct utimbuf { time_t actime; diff --git a/Widgets/Rect.cpp b/Widgets/Rect.cpp index b21cc730bde..f07d78e7fe9 100644 --- a/Widgets/Rect.cpp +++ b/Widgets/Rect.cpp @@ -1,6 +1,5 @@ #include "Rect.h" #include -#include "kstdio.h" void Rect::intersect(const Rect& other) {