Replace kernel STATIC_ASSERT macro with C++11 static_assert.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-01-18 15:38:03 +01:00
parent d39437966d
commit 5559377532
2 changed files with 6 additions and 7 deletions

View File

@ -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.
@ -23,8 +23,8 @@
*******************************************************************************/
#ifndef SORTIX_DECL_H
#define SORTIX_DECL_H
#ifndef INCLUDE_SORTIX_KERNEL_DECL_H
#define INCLUDE_SORTIX_KERNEL_DECL_H
#include <stdint.h>
@ -32,7 +32,6 @@ typedef uintptr_t addr_t;
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
#define STATIC_ASSERT(condition) static_assert(condition, #condition)
#if !defined(CPU) && defined(__i386__)
#define CPU X86

View File

@ -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.
@ -336,14 +336,14 @@ struct Package
size_t size;
size_t payloadoffset;
size_t payloadsize;
WorkHandler handler; // TODO: May not be correctly aligned on some systems.
WorkHandler handler;
uint8_t payload[0];
};
void InitWorker()
{
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];
if ( !queue )
Panic("Can't allocate interrupt worker queue");