Moved the libc override macros to settings.h, and removed __VA_ARGS__

This commit is contained in:
Naman Dixit 2020-06-06 18:57:44 +05:30
parent bd9d4c96be
commit fb700978ac
7 changed files with 12 additions and 56 deletions

View File

@ -2,17 +2,6 @@
#include "libco.h"
#include "settings.h"
#if !defined(LIBCO_ASSERT)
#include <assert.h>
#define LIBCO_ASSERT(...) assert(__VA_ARGS__)
#endif
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
#include <stdlib.h>
#define LIBCO_MALLOC(...) malloc(__VA_ARGS__)
#define LIBCO_FREE(...) free(__VA_ARGS__)
#endif
#include <stdint.h>
#ifdef LIBCO_MPROTECT
#include <unistd.h>

11
amd64.c
View File

@ -2,17 +2,6 @@
#include "libco.h"
#include "settings.h"
#if !defined(LIBCO_ASSERT)
#include <assert.h>
#define LIBCO_ASSERT(...) assert(__VA_ARGS__)
#endif
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
#include <stdlib.h>
#define LIBCO_MALLOC(...) malloc(__VA_ARGS__)
#define LIBCO_FREE(...) free(__VA_ARGS__)
#endif
#ifdef __cplusplus
extern "C" {
#endif

11
arm.c
View File

@ -2,17 +2,6 @@
#include "libco.h"
#include "settings.h"
#if !defined(LIBCO_ASSERT)
#include <assert.h>
#define LIBCO_ASSERT(...) assert(__VA_ARGS__)
#endif
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
#include <stdlib.h>
#define LIBCO_MALLOC(...) malloc(__VA_ARGS__)
#define LIBCO_FREE(...) free(__VA_ARGS__)
#endif
#ifdef LIBCO_MPROTECT
#include <unistd.h>
#include <sys/mman.h>

6
ppc.c
View File

@ -4,12 +4,6 @@
#include "libco.h"
#include "settings.h"
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
#include <stdlib.h>
#define LIBCO_MALLOC(...) malloc(__VA_ARGS__)
#define LIBCO_FREE(...) free(__VA_ARGS__)
#endif
#include <stdint.h>
#include <string.h>

View File

@ -6,12 +6,6 @@
#include <stdint.h>
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
#include <stdlib.h>
#define LIBCO_MALLOC(...) malloc(__VA_ARGS__)
#define LIBCO_FREE(...) free(__VA_ARGS__)
#endif
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -26,6 +26,17 @@
#define alignas(bytes)
#endif
#if !defined(LIBCO_ASSERT)
#include <assert.h>
#define LIBCO_ASSERT assert
#endif
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
#include <stdlib.h>
#define LIBCO_MALLOC malloc
#define LIBCO_FREE free
#endif
#if defined(_MSC_VER)
#define section(name) __declspec(allocate("." #name))
#elif defined(__APPLE__)
@ -34,5 +45,6 @@
#define section(name) __attribute__((section("." #name "#")))
#endif
/* if defined(LIBCO_C) */
#endif

11
x86.c
View File

@ -2,17 +2,6 @@
#include "libco.h"
#include "settings.h"
#if !defined(LIBCO_ASSERT)
#include <assert.h>
#define LIBCO_ASSERT(...) assert(__VA_ARGS__)
#endif
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
#include <stdlib.h>
#define LIBCO_MALLOC(...) malloc(__VA_ARGS__)
#define LIBCO_FREE(...) free(__VA_ARGS__)
#endif
#ifdef __cplusplus
extern "C" {
#endif