mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Replace kernel STATIC_ASSERT macro with C++11 static_assert.
This commit is contained in:
parent
d39437966d
commit
5559377532
2 changed files with 6 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
|
||||||
|
|
||||||
This file is part of Sortix.
|
This file is part of Sortix.
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#ifndef SORTIX_DECL_H
|
#ifndef INCLUDE_SORTIX_KERNEL_DECL_H
|
||||||
#define SORTIX_DECL_H
|
#define INCLUDE_SORTIX_KERNEL_DECL_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ typedef uintptr_t addr_t;
|
||||||
|
|
||||||
#define likely(x) __builtin_expect((x),1)
|
#define likely(x) __builtin_expect((x),1)
|
||||||
#define unlikely(x) __builtin_expect((x),0)
|
#define unlikely(x) __builtin_expect((x),0)
|
||||||
#define STATIC_ASSERT(condition) static_assert(condition, #condition)
|
|
||||||
|
|
||||||
#if !defined(CPU) && defined(__i386__)
|
#if !defined(CPU) && defined(__i386__)
|
||||||
#define CPU X86
|
#define CPU X86
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
|
||||||
|
|
||||||
This file is part of Sortix.
|
This file is part of Sortix.
|
||||||
|
|
||||||
|
@ -336,14 +336,14 @@ struct Package
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t payloadoffset;
|
size_t payloadoffset;
|
||||||
size_t payloadsize;
|
size_t payloadsize;
|
||||||
WorkHandler handler; // TODO: May not be correctly aligned on some systems.
|
WorkHandler handler;
|
||||||
uint8_t payload[0];
|
uint8_t payload[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
void InitWorker()
|
void InitWorker()
|
||||||
{
|
{
|
||||||
const size_t QUEUE_SIZE = 4UL*1024UL;
|
const size_t QUEUE_SIZE = 4UL*1024UL;
|
||||||
STATIC_ASSERT(QUEUE_SIZE % sizeof(Package) == 0);
|
static_assert(QUEUE_SIZE % sizeof(Package) == 0, "QUEUE_SIZE must be a multiple of the package size");
|
||||||
queue = new uint8_t[QUEUE_SIZE];
|
queue = new uint8_t[QUEUE_SIZE];
|
||||||
if ( !queue )
|
if ( !queue )
|
||||||
Panic("Can't allocate interrupt worker queue");
|
Panic("Can't allocate interrupt worker queue");
|
||||||
|
|
Loading…
Reference in a new issue