Skip to content

Commit

Permalink
Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_'
Browse files Browse the repository at this point in the history
  • Loading branch information
linusg committed Jul 22, 2022
1 parent 5a106b6 commit 8150d71
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 43 deletions.
2 changes: 1 addition & 1 deletion AK/DistinctNumeric.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ struct Formatter<DistinctNumeric<T, X, Incr, Cmp, Bool, Flags, Shift, Arith>> :

#define AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, Incr, Cmp, Bool, Flags, Shift, Arith, NAME) \
using NAME = DistinctNumeric<T, struct __##NAME##_tag, Incr, Cmp, Bool, Flags, Shift, Arith>;
#define TYPEDEF_DISTINCT_ORDERED_ID(T, NAME) AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, false, true, true, false, false, false, NAME)
#define AK_TYPEDEF_DISTINCT_ORDERED_ID(T, NAME) AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(T, false, true, true, false, false, false, NAME)
// TODO: Further type aliases?

template<typename T, typename X, auto... Args>
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Bus/PCI/Controller/HostController.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

namespace Kernel::PCI {

TYPEDEF_DISTINCT_ORDERED_ID(u8, BusNumber);
TYPEDEF_DISTINCT_ORDERED_ID(u8, DeviceNumber);
TYPEDEF_DISTINCT_ORDERED_ID(u8, FunctionNumber);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, BusNumber);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, DeviceNumber);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, FunctionNumber);

class HostController {
public:
Expand Down
19 changes: 10 additions & 9 deletions Kernel/Bus/PCI/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ enum class SubclassID {

}

TYPEDEF_DISTINCT_ORDERED_ID(u8, CapabilityID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, CapabilityID);

namespace Capabilities {
enum ID {
Null = 0x0,
Expand Down Expand Up @@ -218,14 +219,14 @@ class Capability {
const u8 m_ptr;
};

TYPEDEF_DISTINCT_ORDERED_ID(u8, ClassCode);
TYPEDEF_DISTINCT_ORDERED_ID(u8, SubclassCode);
TYPEDEF_DISTINCT_ORDERED_ID(u8, ProgrammingInterface);
TYPEDEF_DISTINCT_ORDERED_ID(u8, RevisionID);
TYPEDEF_DISTINCT_ORDERED_ID(u16, SubsystemID);
TYPEDEF_DISTINCT_ORDERED_ID(u16, SubsystemVendorID);
TYPEDEF_DISTINCT_ORDERED_ID(u8, InterruptLine);
TYPEDEF_DISTINCT_ORDERED_ID(u8, InterruptPin);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, ClassCode);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, SubclassCode);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, ProgrammingInterface);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, RevisionID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u16, SubsystemID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u16, SubsystemVendorID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, InterruptLine);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u8, InterruptPin);

class Access;
class DeviceIdentifier {
Expand Down
2 changes: 1 addition & 1 deletion Kernel/FileSystem/BlockBasedFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Kernel {

class BlockBasedFileSystem : public FileBackedFileSystem {
public:
TYPEDEF_DISTINCT_ORDERED_ID(u64, BlockIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, BlockIndex);

virtual ~BlockBasedFileSystem() override;
virtual ErrorOr<void> initialize() override;
Expand Down
4 changes: 2 additions & 2 deletions Kernel/FileSystem/DeviceFileTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Kernel {

TYPEDEF_DISTINCT_ORDERED_ID(unsigned, MajorNumber);
TYPEDEF_DISTINCT_ORDERED_ID(unsigned, MinorNumber);
AK_TYPEDEF_DISTINCT_ORDERED_ID(unsigned, MajorNumber);
AK_TYPEDEF_DISTINCT_ORDERED_ID(unsigned, MinorNumber);

}
2 changes: 1 addition & 1 deletion Kernel/FileSystem/Ext2FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Ext2FS final : public BlockBasedFileSystem {
FeaturesReadOnly get_features_readonly() const;

private:
TYPEDEF_DISTINCT_ORDERED_ID(unsigned, GroupIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(unsigned, GroupIndex);

explicit Ext2FS(OpenFileDescription&);

Expand Down
4 changes: 2 additions & 2 deletions Kernel/FileSystem/InodeIdentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Kernel {
class FileSystem;
struct InodeMetadata;

TYPEDEF_DISTINCT_ORDERED_ID(u32, FileSystemID);
TYPEDEF_DISTINCT_ORDERED_ID(u64, InodeIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, FileSystemID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, InodeIndex);

class InodeIdentifier {
public:
Expand Down
12 changes: 6 additions & 6 deletions Kernel/Forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ class SpinlockLocker;
struct InodeMetadata;
struct TrapFrame;

TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ProcessID);
TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ThreadID);
TYPEDEF_DISTINCT_ORDERED_ID(pid_t, SessionID);
TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ProcessGroupID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ProcessID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ThreadID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, SessionID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(pid_t, ProcessGroupID);

TYPEDEF_DISTINCT_ORDERED_ID(uid_t, UserID);
TYPEDEF_DISTINCT_ORDERED_ID(gid_t, GroupID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(uid_t, UserID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(gid_t, GroupID);

}
2 changes: 1 addition & 1 deletion Kernel/Graphics/Bochs/DisplayConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BochsDisplayConnector
friend class DeviceManagement;

public:
TYPEDEF_DISTINCT_ORDERED_ID(u16, IndexID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u16, IndexID);

static NonnullRefPtr<BochsDisplayConnector> must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, bool virtual_box_hardware);

Expand Down
6 changes: 3 additions & 3 deletions Kernel/Graphics/VirtIOGPU/Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#define VIRTIO_GPU_MAX_SCANOUTS 16

namespace Kernel::Graphics::VirtIOGPU {
TYPEDEF_DISTINCT_ORDERED_ID(u32, ContextID);
TYPEDEF_DISTINCT_ORDERED_ID(u32, ResourceID);
TYPEDEF_DISTINCT_ORDERED_ID(u32, ScanoutID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ContextID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ResourceID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ScanoutID);
};

#define VREND_MAX_CTX 64
Expand Down
2 changes: 1 addition & 1 deletion Kernel/TimerQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Kernel {

TYPEDEF_DISTINCT_ORDERED_ID(u64, TimerId);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, TimerId);

class Timer : public RefCounted<Timer> {
friend class TimerQueue;
Expand Down
4 changes: 2 additions & 2 deletions Userland/Demos/VirGLDemo/VirGLProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#include <AK/DistinctNumeric.h>

TYPEDEF_DISTINCT_ORDERED_ID(u32, ObjectHandle);
TYPEDEF_DISTINCT_ORDERED_ID(u32, ResourceID);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ObjectHandle);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, ResourceID);

#define VIRGL_BIND_DEPTH_STENCIL (1 << 0)
#define VIRGL_BIND_RENDER_TARGET (1 << 1)
Expand Down
2 changes: 1 addition & 1 deletion Userland/Libraries/LibThreading/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Threading {

TYPEDEF_DISTINCT_ORDERED_ID(intptr_t, ThreadError);
AK_TYPEDEF_DISTINCT_ORDERED_ID(intptr_t, ThreadError);

class Thread final : public Core::Object {
C_OBJECT(Thread);
Expand Down
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWasm/Opcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Wasm {

TYPEDEF_DISTINCT_ORDERED_ID(u32, OpCode);
AK_TYPEDEF_DISTINCT_ORDERED_ID(u32, OpCode);

namespace Instructions {

Expand Down
18 changes: 9 additions & 9 deletions Userland/Libraries/LibWasm/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ String parse_error_to_string(ParseError);
template<typename T>
using ParseResult = Result<T, ParseError>;

TYPEDEF_DISTINCT_ORDERED_ID(size_t, TypeIndex);
TYPEDEF_DISTINCT_ORDERED_ID(size_t, FunctionIndex);
TYPEDEF_DISTINCT_ORDERED_ID(size_t, TableIndex);
TYPEDEF_DISTINCT_ORDERED_ID(size_t, ElementIndex);
TYPEDEF_DISTINCT_ORDERED_ID(size_t, MemoryIndex);
TYPEDEF_DISTINCT_ORDERED_ID(size_t, LocalIndex);
TYPEDEF_DISTINCT_ORDERED_ID(size_t, GlobalIndex);
TYPEDEF_DISTINCT_ORDERED_ID(size_t, LabelIndex);
TYPEDEF_DISTINCT_ORDERED_ID(size_t, DataIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, TypeIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, FunctionIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, TableIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, ElementIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, MemoryIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, LocalIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, GlobalIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, LabelIndex);
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, DataIndex);
AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, true, true, false, true, false, true, InstructionPointer);

ParseError with_eof_check(InputStream const& stream, ParseError error_if_not_eof);
Expand Down

0 comments on commit 8150d71

Please sign in to comment.