summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-17 01:41:36 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-17 01:41:36 +0100
commitb5c76d7559a09473d75283c5b12fce7b1651e7bd (patch)
tree27e7b3c9615e44bb12fa9b49a965590954a77868
parent5605295d00ec1230b958c461f30736fc1603342d (diff)
downloadserenity-b5c76d7559a09473d75283c5b12fce7b1651e7bd.zip
Get rid of #ifdef SERENITY. We're past that phase of bootstrapping.
-rw-r--r--AK/Assertions.h6
-rw-r--r--AK/StdLibExtras.h16
-rw-r--r--AK/Traits.h4
-rw-r--r--AK/kmalloc.h18
-rw-r--r--AK/kstdio.h6
-rw-r--r--AK/ktime.h7
-rw-r--r--LibC/Makefile1
-rw-r--r--VirtualFileSystem/DiskBackedFileSystem.cpp5
-rw-r--r--VirtualFileSystem/DiskDevice.h4
-rw-r--r--VirtualFileSystem/FileDescriptor.cpp7
-rw-r--r--VirtualFileSystem/FileDescriptor.h8
-rw-r--r--VirtualFileSystem/Limits.h5
-rw-r--r--VirtualFileSystem/UnixTypes.h8
-rw-r--r--Widgets/Rect.cpp1
14 files changed, 1 insertions, 95 deletions
diff --git a/AK/Assertions.h b/AK/Assertions.h
index 3c1e778a6f..4439c5dbc5 100644
--- a/AK/Assertions.h
+++ b/AK/Assertions.h
@@ -1,16 +1,10 @@
#pragma once
-#ifdef SERENITY
#ifdef KERNEL
#include <Kernel/kassert.h>
#else
#include <LibC/assert.h>
#endif
-#else
-#include <assert.h>
-#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 4e50a3cad1..8c13ee0e12 100644
--- a/AK/StdLibExtras.h
+++ b/AK/StdLibExtras.h
@@ -1,48 +1,32 @@
#pragma once
-#ifdef SERENITY
#ifdef KERNEL
#include <Kernel/StdLib.h>
#else
#include <LibC/stdlib.h>
#include <LibC/string.h>
#endif
-#else
-#include <cstring>
-#include <cstdlib>
-#include <utility>
-#endif
#include <AK/Types.h>
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 b3c89571a3..734212187a 100644
--- a/AK/Traits.h
+++ b/AK/Traits.h
@@ -26,11 +26,7 @@ template<typename T>
struct Traits<T*> {
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 c28dddcae4..3c8102c0fd 100644
--- a/AK/kmalloc.h
+++ b/AK/kmalloc.h
@@ -11,7 +11,6 @@ private:
#define AK_MAKE_ETERNAL
#endif
-#ifdef SERENITY
#ifdef KERNEL
#include <Kernel/kmalloc.h>
#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 <new>
-
-#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 00b0697712..8b5e7ff0f1 100644
--- a/AK/kstdio.h
+++ b/AK/kstdio.h
@@ -1,9 +1,3 @@
#pragma once
-#ifdef SERENITY
#include <Kernel/kstdio.h>
-#else
-#include <cstdio>
-#define kprintf printf
-#define ksprintf sprintf
-#endif
diff --git a/AK/ktime.h b/AK/ktime.h
index 326c4ecce4..07d9a1b888 100644
--- a/AK/ktime.h
+++ b/AK/ktime.h
@@ -1,10 +1,3 @@
#pragma once
-#ifdef SERENITY
#include <Kernel/ktime.h>
-#else
-#include <time.h>
-#define ktime time
-#define klocaltime localtime
-#endif
-
diff --git a/LibC/Makefile b/LibC/Makefile
index 719781da42..5ee5958a3a 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 359a04f5e5..8f17f859ea 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 71a5c6c647..071c5cd63b 100644
--- a/VirtualFileSystem/DiskDevice.h
+++ b/VirtualFileSystem/DiskDevice.h
@@ -3,12 +3,8 @@
#include <AK/Retainable.h>
#include <AK/Types.h>
-#ifdef SERENITY
// FIXME: Support 64-bit DiskOffset
typedef dword DiskOffset;
-#else
-typedef qword DiskOffset;
-#endif
class DiskDevice : public Retainable<DiskDevice> {
public:
diff --git a/VirtualFileSystem/FileDescriptor.cpp b/VirtualFileSystem/FileDescriptor.cpp
index d98bd28b8f..60f89cda17 100644
--- a/VirtualFileSystem/FileDescriptor.cpp
+++ b/VirtualFileSystem/FileDescriptor.cpp
@@ -5,11 +5,8 @@
#include "UnixTypes.h"
#include <AK/BufferStream.h>
#include "FIFO.h"
-
-#ifdef SERENITY
#include "TTY.h"
#include "MasterPTY.h"
-#endif
RetainPtr<FileDescriptor> FileDescriptor::create(RetainPtr<Inode>&& inode)
{
@@ -64,21 +61,17 @@ RetainPtr<FileDescriptor> 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 860e3a09df..65d3c05a97 100644
--- a/VirtualFileSystem/FileDescriptor.h
+++ b/VirtualFileSystem/FileDescriptor.h
@@ -7,11 +7,9 @@
#include <AK/CircularQueue.h>
#include <AK/Retainable.h>
-#ifdef SERENITY
class TTY;
class MasterPTY;
class Process;
-#endif
class FileDescriptor : public Retainable<FileDescriptor> {
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<FIFO> m_fifo;
FIFO::Direction m_fifo_direction { FIFO::Neither };
-#endif
};
diff --git a/VirtualFileSystem/Limits.h b/VirtualFileSystem/Limits.h
index f04a200d64..00d063e7b7 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 <limits>
-inline static const Unix::off_t maxFileOffset = std::numeric_limits<Unix::off_t>::max();
-#endif
static const size_t GoodBufferSize = 4096;
diff --git a/VirtualFileSystem/UnixTypes.h b/VirtualFileSystem/UnixTypes.h
index d4eb3aedcd..6084a23985 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 b21cc730bd..f07d78e7fe 100644
--- a/Widgets/Rect.cpp
+++ b/Widgets/Rect.cpp
@@ -1,6 +1,5 @@
#include "Rect.h"
#include <AK/StdLibExtras.h>
-#include "kstdio.h"
void Rect::intersect(const Rect& other)
{