Commit e090c797bbed755ac3bc8e0b6e76493817d57450

Authored by Georg Hopp
1 parent ae5751fe

finalize definition and initialization macro for for cclass and add -Wall to all Makefiles

@@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I m4 @@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I m4
3 bin_PROGRAMS = create_token 3 bin_PROGRAMS = create_token
4 create_token_SOURCES = base64.c createToken.c 4 create_token_SOURCES = base64.c createToken.c
5 create_token_LDADD = src/libtoken.la $(LIBOBJS) 5 create_token_LDADD = src/libtoken.la $(LIBOBJS)
6 -create_token_CFLAGS = -I include 6 +create_token_CFLAGS = -Wall -I include
7 7
8 EXTRA_DIST = base64.h 8 EXTRA_DIST = base64.h
9 9
@@ -242,7 +242,7 @@ top_srcdir = @top_srcdir@ @@ -242,7 +242,7 @@ top_srcdir = @top_srcdir@
242 ACLOCAL_AMFLAGS = -I m4 242 ACLOCAL_AMFLAGS = -I m4
243 create_token_SOURCES = base64.c createToken.c 243 create_token_SOURCES = base64.c createToken.c
244 create_token_LDADD = src/libtoken.la $(LIBOBJS) 244 create_token_LDADD = src/libtoken.la $(LIBOBJS)
245 -create_token_CFLAGS = -I include 245 +create_token_CFLAGS = -Wall -I include
246 EXTRA_DIST = base64.h 246 EXTRA_DIST = base64.h
247 SUBDIRS = src include tests 247 SUBDIRS = src include tests
248 all: config.h 248 all: config.h
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 (jCtor)jsonConst, \ 41 (jCtor)jsonConst, \
42 (dtor)__destruct, \ 42 (dtor)__destruct, \
43 (jTo)toJson \ 43 (jTo)toJson \
44 - }; const _CCLASS const __##class = &_class 44 + }; const _CCLASS const __##class = (const _CCLASS const)&_class
45 45
46 46
47 47
@@ -62,12 +62,12 @@ typedef struct CCLASS { @@ -62,12 +62,12 @@ typedef struct CCLASS {
62 #define CCLASS_PTR_SIZE sizeof(struct CCLASS *) 62 #define CCLASS_PTR_SIZE sizeof(struct CCLASS *)
63 #define CCLASS_SIZE sizeof(struct CCLASS) 63 #define CCLASS_SIZE sizeof(struct CCLASS)
64 64
65 -void * _new(const void * _class, ...);  
66 -void * _newFromJson(const void * _class, struct json_object * json); 65 +void * _new(const _CCLASS _class, ...);
  66 +void * _newFromJson(const _CCLASS _class, struct json_object * json);
67 void delete(void * _object); 67 void delete(void * _object);
68 struct json_object * toJson(void * _object); 68 struct json_object * toJson(void * _object);
69 int isObject(void * _object); 69 int isObject(void * _object);
70 -int _instanceOf(const void * _class, void * _object); 70 +int _instanceOf(const _CCLASS _class, void * _object);
71 71
72 #define new(class, ...) _new((__##class), __VA_ARGS__) 72 #define new(class, ...) _new((__##class), __VA_ARGS__)
73 #define newFromJson(class, json) _newFromJson((__##class), (json)) 73 #define newFromJson(class, json) _newFromJson((__##class), (json))
@@ -2,5 +2,5 @@ ACLOCAL_AMFLAGS = -I m4 @@ -2,5 +2,5 @@ ACLOCAL_AMFLAGS = -I m4
2 2
3 lib_LTLIBRARIES = libtoken.la 3 lib_LTLIBRARIES = libtoken.la
4 libtoken_la_SOURCES = cclass.c crypt.c dyntype.c dyntype/hash.c packet.c 4 libtoken_la_SOURCES = cclass.c crypt.c dyntype.c dyntype/hash.c packet.c
5 -libtoken_la_CFLAGS = -I ../include 5 +libtoken_la_CFLAGS = -Wall -I ../include
6 libtoken_la_LDFLAGS = -version-info 0:0:0 6 libtoken_la_LDFLAGS = -version-info 0:0:0
@@ -209,7 +209,7 @@ top_srcdir = @top_srcdir@ @@ -209,7 +209,7 @@ top_srcdir = @top_srcdir@
209 ACLOCAL_AMFLAGS = -I m4 209 ACLOCAL_AMFLAGS = -I m4
210 lib_LTLIBRARIES = libtoken.la 210 lib_LTLIBRARIES = libtoken.la
211 libtoken_la_SOURCES = cclass.c crypt.c dyntype.c dyntype/hash.c packet.c 211 libtoken_la_SOURCES = cclass.c crypt.c dyntype.c dyntype/hash.c packet.c
212 -libtoken_la_CFLAGS = -I ../include 212 +libtoken_la_CFLAGS = -Wall -I ../include
213 libtoken_la_LDFLAGS = -version-info 0:0:0 213 libtoken_la_LDFLAGS = -version-info 0:0:0
214 all: all-am 214 all: all-am
215 215
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 24
25 25
26 void * 26 void *
27 -_new(const void * _class, ...) 27 +_new(const _CCLASS _class, ...)
28 { 28 {
29 const _CCLASS class = _class; 29 const _CCLASS class = _class;
30 void * object = calloc(1, class->size); 30 void * object = calloc(1, class->size);
@@ -43,7 +43,7 @@ _new(const void * _class, ...) @@ -43,7 +43,7 @@ _new(const void * _class, ...)
43 } 43 }
44 44
45 void * 45 void *
46 -_newFromJson(const void * _class, struct json_object * json) 46 +_newFromJson(const _CCLASS _class, struct json_object * json)
47 { 47 {
48 const struct CCLASS * class = _class; 48 const struct CCLASS * class = _class;
49 void * object = calloc(1, class->size); 49 void * object = calloc(1, class->size);
@@ -91,7 +91,7 @@ isObject(void * _object) @@ -91,7 +91,7 @@ isObject(void * _object)
91 } 91 }
92 92
93 int 93 int
94 -_instanceOf(const void * _class, void * _object) 94 +_instanceOf(const _CCLASS _class, void * _object)
95 { 95 {
96 const struct CCLASS ** class = _object; 96 const struct CCLASS ** class = _object;
97 97
@@ -6,14 +6,14 @@ check_PROGRAMS = cclassTest cryptTest packetTest @@ -6,14 +6,14 @@ check_PROGRAMS = cclassTest cryptTest packetTest
6 6
7 cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c ../src/cclass.c 7 cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c ../src/cclass.c
8 cclassTest_LDADD = $(LIBOBJS) 8 cclassTest_LDADD = $(LIBOBJS)
9 -cclassTest_CFLAGS = -I ../include -I .. -I . 9 +cclassTest_CFLAGS = -Wall -I ../include -I .. -I .
10 10
11 cryptTest_SOURCES = runtest.c cryptTest.c ../src/cclass.c ../src/crypt.c 11 cryptTest_SOURCES = runtest.c cryptTest.c ../src/cclass.c ../src/crypt.c
12 cryptTest_LDADD = $(LIBOBJS) 12 cryptTest_LDADD = $(LIBOBJS)
13 -cryptTest_CFLAGS = -I ../include -I .. -I . 13 +cryptTest_CFLAGS = -Wall -I ../include -I .. -I .
14 14
15 packetTest_SOURCES = runtest.c packetTest.c ../src/cclass.c ../src/packet.c ../src/dyntype.c ../src/dyntype/hash.c 15 packetTest_SOURCES = runtest.c packetTest.c ../src/cclass.c ../src/packet.c ../src/dyntype.c ../src/dyntype/hash.c
16 packetTest_LDADD = $(LIBOBJS) 16 packetTest_LDADD = $(LIBOBJS)
17 -packetTest_CFLAGS = -I ../include -I .. -I . 17 +packetTest_CFLAGS = -Wall -I ../include -I .. -I .
18 18
19 EXTRA_DIST = runtest.h mock/class.h 19 EXTRA_DIST = runtest.h mock/class.h
@@ -210,13 +210,13 @@ ACLOCAL_AMFLAGS = -I m4 @@ -210,13 +210,13 @@ ACLOCAL_AMFLAGS = -I m4
210 TESTS_ENVIRONMENT = valgrind --error-exitcode=123 --leak-check=full --quiet 210 TESTS_ENVIRONMENT = valgrind --error-exitcode=123 --leak-check=full --quiet
211 cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c ../src/cclass.c 211 cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c ../src/cclass.c
212 cclassTest_LDADD = $(LIBOBJS) 212 cclassTest_LDADD = $(LIBOBJS)
213 -cclassTest_CFLAGS = -I ../include -I .. -I . 213 +cclassTest_CFLAGS = -Wall -I ../include -I .. -I .
214 cryptTest_SOURCES = runtest.c cryptTest.c ../src/cclass.c ../src/crypt.c 214 cryptTest_SOURCES = runtest.c cryptTest.c ../src/cclass.c ../src/crypt.c
215 cryptTest_LDADD = $(LIBOBJS) 215 cryptTest_LDADD = $(LIBOBJS)
216 -cryptTest_CFLAGS = -I ../include -I .. -I . 216 +cryptTest_CFLAGS = -Wall -I ../include -I .. -I .
217 packetTest_SOURCES = runtest.c packetTest.c ../src/cclass.c ../src/packet.c ../src/dyntype.c ../src/dyntype/hash.c 217 packetTest_SOURCES = runtest.c packetTest.c ../src/cclass.c ../src/packet.c ../src/dyntype.c ../src/dyntype/hash.c
218 packetTest_LDADD = $(LIBOBJS) 218 packetTest_LDADD = $(LIBOBJS)
219 -packetTest_CFLAGS = -I ../include -I .. -I . 219 +packetTest_CFLAGS = -Wall -I ../include -I .. -I .
220 EXTRA_DIST = runtest.h mock/class.h 220 EXTRA_DIST = runtest.h mock/class.h
221 all: all-am 221 all: all-am
222 222
Please register or login to post a comment