From 6642dda2295f572f01d51b511b046c7369aedfe2 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 3 Mar 2013 04:57:29 +0000 Subject: [PATCH] Always build using gnu99 and gnu++0x This opensource after all, why not use them? --- source/Makefile.mk | 4 ++-- source/backend/native/Makefile | 1 - source/libs/rtmempool/list.h | 8 ++++++-- source/utils/RtList.hpp | 5 ----- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/source/Makefile.mk b/source/Makefile.mk index b05e1a70a..f2971a78d 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -31,8 +31,8 @@ endif 32BIT_FLAGS = -m32 64BIT_FLAGS = -m64 -BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 $(CFLAGS) -BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) +BUILD_C_FLAGS = $(BASE_FLAGS) -std=gnu99 $(CFLAGS) +BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=gnu++0x $(CXXFLAGS) LINK_FLAGS = $(LDFLAGS) # -------------------------------------------------------------- diff --git a/source/backend/native/Makefile b/source/backend/native/Makefile index 6f8d2928c..1e241d860 100644 --- a/source/backend/native/Makefile +++ b/source/backend/native/Makefile @@ -8,7 +8,6 @@ include ../Makefile.mk # -------------------------------------------------------------- -BUILD_C_FLAGS += -std=gnu99 BUILD_CXX_FLAGS += -I../../libs/distrho BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui gl) LINK_FLAGS += $(shell pkg-config --libs QtCore QtGui gl) diff --git a/source/libs/rtmempool/list.h b/source/libs/rtmempool/list.h index cb6352788..fbc17f3a1 100644 --- a/source/libs/rtmempool/list.h +++ b/source/libs/rtmempool/list.h @@ -256,9 +256,13 @@ static inline void list_splice_init(struct list_head *list, struct list_head *he * @type: the type of the struct this is embedded in. * @member: the name of the list_struct within the struct. */ -#define list_entry(ptr, type, member) \ +#ifdef __GNUC__ +# define list_entry(ptr, type, member) \ + container_of(ptr, type, member) +#else +# define list_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) - //container_of(ptr, type, member) +#endif /** * list_for_each - iterate over a list diff --git a/source/utils/RtList.hpp b/source/utils/RtList.hpp index a5685c6f8..4b7b83c41 100644 --- a/source/utils/RtList.hpp +++ b/source/utils/RtList.hpp @@ -25,11 +25,6 @@ extern "C" { #include "rtmempool/rtmempool.h" } -// list_entry C++11 version (using nullptr instead of 0) -#undef list_entry -#define list_entry(ptr, type, member) \ - ((type *)((char *)(ptr)-(unsigned long)(&((type *)nullptr)->member))) - // Declare non copyable and prevent heap allocation #define LIST_DECLARATIONS(className) \ className(const className&); \