aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-08 14:35:58 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-08 14:35:58 +0100
commitf82a15703735d9bd164b6c70155f482457717726 (patch)
treef93fb51f752bba35ce50e9e3e533072b3ca307cc
parentCode cleanup and add documentation. (diff)
downloadcalp-f82a15703735d9bd164b6c70155f482457717726.tar.gz
calp-f82a15703735d9bd164b6c70155f482457717726.tar.xz
Remove pendatic, update macro to be more portable.
-rw-r--r--Makefile2
-rw-r--r--macro.h15
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)