From f82a15703735d9bd164b6c70155f482457717726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 8 Feb 2019 14:35:58 +0100 Subject: Remove pendatic, update macro to be more portable. --- Makefile | 2 +- macro.h | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 51e27750..4d87fab2 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ OBJDIR = obj CPPFLAGS = -DSAFE_STR # -DSAFE_HASH CFLAGS = $(CPPFLAGS) \ - -std=gnu11 -Wall -Wextra -pedantic \ + -std=gnu11 -Wall -Wextra \ -ggdb -fPIC \ $(shell guile-config compile) LDFLAGS = -fPIC $(shell guile-config link) diff --git a/macro.h b/macro.h index b48a004e..493b9537 100644 --- a/macro.h +++ b/macro.h @@ -1,11 +1,6 @@ #ifndef MACRO_H #define MACRO_H - -/* - * NOTE This file uses __VA_OPT__. This is not standard compliant. - */ - /* * Token paste */ @@ -44,7 +39,7 @@ /* Returns full type of constructor */ #define INIT_F(T, ...) \ - int __INIT_T(T, VA_ARGS_NUM(__VA_ARGS__)) (T* this __VA_OPT__(,) __VA_ARGS__) + int __INIT_T(T, VA_ARGS_NUM(__VA_ARGS__)) (T* this, ## __VA_ARGS__) /* * Call the constructor of an object @@ -52,26 +47,26 @@ * function results in an error. */ #define INIT(T, N, ...) \ - __INIT_T(T, VA_ARGS_NUM(__VA_ARGS__)) (N __VA_OPT__(,) __VA_ARGS__) + __INIT_T(T, VA_ARGS_NUM(__VA_ARGS__)) (N, ## __VA_ARGS__) /* Allocate a new object on the HEAP */ #define NEW(T, N, ...) \ T* N = malloc(sizeof(*N)); \ - INIT(T, N, __VA_ARGS__); + INIT(T, N, ## __VA_ARGS__); /* * Reconstructs a object. Use with caution. */ #define RENEW(T, N, ...) do { \ N = malloc(sizeof(*N)); \ - INIT(T, N, __VA_ARGS__); \ + INIT(T, N, ## __VA_ARGS__); \ } while (0) /* Allocate a new object on the STACK */ #define SNEW(T, N, ...) \ T N; \ - INIT(T, & N, __VA_ARGS__); + INIT(T, & N, ## __VA_ARGS__); /* Destructor for type */ #define FREE(T) TEMPL(free, T) -- cgit v1.2.3