From: Michael Göhler Date: Wed, 27 Aug 2014 22:56:44 +0000 (+0200) Subject: fixed wrong linker usage + fix some compiler warnings X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=ecb540df90fa1b07218b20e5893a8c58d90447a9;p=smdp.git fixed wrong linker usage + fix some compiler warnings --- diff --git a/Makefile b/Makefile index ec4c76e..befbd52 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ +CFLAGS=-g -Wall + tmp: tmp.c cstring.o markdown.o parser.o - cc -g -o tmp tmp.c cstring.o markdown.o parser.o + cc $(CFLAGS) -o tmp tmp.c cstring.o markdown.o parser.o -parser.o: parser.c cstring.o markdown.o - cc -g -c parser.c -o parser.o -lmarkdown +parser.o: parser.c + cc $(CFLAGS) -c parser.c -markdown.o: markdown.c cstring.o - cc -g -c markdown.c -o markdown.o -lcstring +markdown.o: markdown.c + cc $(CFLAGS) -c markdown.c cstring.o: cstring.c - cc -g -c cstring.c -o cstring.o + cc $(CFLAGS) -c cstring.c all: tmp @@ -19,5 +21,4 @@ test: clean: rm -f tmp *.o - $(MAKE) -C test clean diff --git a/parser.c b/parser.c index 9931b02..29dbf83 100644 --- a/parser.c +++ b/parser.c @@ -1,3 +1,4 @@ +#include #include #include diff --git a/test/Makefile b/test/Makefile index 6d0f234..3a457e0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ # set some compiler flags -CFLAGS=-g -lncurses +CFLAGS=-g -Wall -lncurses # find *.c in the current directory SOURCES=$(wildcard *.c) diff --git a/test/bits.c b/test/bits.c index efe6fc1..5d2a0d1 100644 --- a/test/bits.c +++ b/test/bits.c @@ -4,7 +4,7 @@ int main(int argc, char *argv[]) { - int i; + int i = 0; printf("INIT: %i\n", i); SET_BIT(i, IS_H1); @@ -25,5 +25,7 @@ int main(int argc, char *argv[]) { printf("CHECK_BIT(%i): %i\n", IS_H1, CHECK_BIT(i, IS_H1)); printf("CHECK_BIT(%i): %i\n", IS_H2, CHECK_BIT(i, IS_H2)); + + return(0); } diff --git a/test/color.c b/test/color.c index f5452d2..c2b58be 100644 --- a/test/color.c +++ b/test/color.c @@ -9,12 +9,12 @@ void set_colors(void) start_color(); use_default_colors(); - for(i=1 ;i<256;i++) + for(i=0; i < COLORS; i++) { init_pair(i, i, -1); attron(COLOR_PAIR(i)); printw(" %3.hd", i); - if((i + 3) % 36 == 0) printw("\n"); + if((i + 1) % 36 == 0) printw("\n"); refresh(); } standend(); diff --git a/test/cstring.c b/test/cstring.c index 70892a6..2175663 100644 --- a/test/cstring.c +++ b/test/cstring.c @@ -7,35 +7,37 @@ int main(int argc, char *argv[]) { // testing with char cstring_t *p = cstring_init(); - printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand)(p, 'X'); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); + printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand)(p, 'X'); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); (p->reset)(p); - printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); + printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); char x[2] = {'X', '\0'}; - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); - (p->expand_arr)(p, x); printf("text: %s, size: %i, alloc: %i\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); + (p->expand_arr)(p, x); printf("text: %s, size: %zu, alloc: %zu\n", p->text, p->size, p->alloc); (p->delete)(p); + + return(0); } diff --git a/tmp.c b/tmp.c index fef4fef..8fbfa0d 100644 --- a/tmp.c +++ b/tmp.c @@ -67,5 +67,7 @@ int main(int argc, char *argv[]) { if(debug > 0) { markdown_debug(doc, debug); } + + return(EXIT_SUCCESS); }