diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-08 14:35:58 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-08 14:35:58 +0100 |
commit | f82a15703735d9bd164b6c70155f482457717726 (patch) | |
tree | f93fb51f752bba35ce50e9e3e533072b3ca307cc | |
parent | Code cleanup and add documentation. (diff) | |
download | calp-f82a15703735d9bd164b6c70155f482457717726.tar.gz calp-f82a15703735d9bd164b6c70155f482457717726.tar.xz |
Remove pendatic, update macro to be more portable.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | macro.h | 15 |
2 files changed, 6 insertions, 11 deletions
@@ -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) @@ -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) |