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 "libco.h"
#include "settings.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> #include <stdint.h>
#ifdef LIBCO_MPROTECT #ifdef LIBCO_MPROTECT
#include <unistd.h> #include <unistd.h>

11
amd64.c
View File

@ -2,17 +2,6 @@
#include "libco.h" #include "libco.h"
#include "settings.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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

11
arm.c
View File

@ -2,17 +2,6 @@
#include "libco.h" #include "libco.h"
#include "settings.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 #ifdef LIBCO_MPROTECT
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>

6
ppc.c
View File

@ -4,12 +4,6 @@
#include "libco.h" #include "libco.h"
#include "settings.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 <stdint.h>
#include <string.h> #include <string.h>

View File

@ -6,12 +6,6 @@
#include <stdint.h> #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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -26,6 +26,17 @@
#define alignas(bytes) #define alignas(bytes)
#endif #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) #if defined(_MSC_VER)
#define section(name) __declspec(allocate("." #name)) #define section(name) __declspec(allocate("." #name))
#elif defined(__APPLE__) #elif defined(__APPLE__)
@ -34,5 +45,6 @@
#define section(name) __attribute__((section("." #name "#"))) #define section(name) __attribute__((section("." #name "#")))
#endif #endif
/* if defined(LIBCO_C) */ /* if defined(LIBCO_C) */
#endif #endif

11
x86.c
View File

@ -2,17 +2,6 @@
#include "libco.h" #include "libco.h"
#include "settings.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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif