needs / teerank

A simple ranking system for teeworlds
https://teerank.io
GNU General Public License v3.0
12 stars 5 forks source link

Fix compilation with clang #5

Closed nzyuzin closed 8 years ago

nzyuzin commented 8 years ago

Fixes the following errors:

clang -Wall -Werror -O -ansi -D_POSIX_C_SOURCE=200809L -g   -c -o src/add-new-servers.o src/add-new-servers.c
clang -Wall -Werror -O -ansi -D_POSIX_C_SOURCE=200809L -g   -c -o src/network.o src/network.c
clang -Wall -Werror -O -ansi -D_POSIX_C_SOURCE=200809L -g   -c -o src/config.o src/config.c
clang -o teerank-add-new-servers -Wall -Werror -O -ansi -D_POSIX_C_SOURCE=200809L -g src/add-new-servers.o src/network.o src/config.o
clang-3.7: error: argument unused during compilation: '-ansi'
Makefile:15: recipe for target 'teerank-add-new-servers' failed
make: *** [teerank-add-new-servers] Error 1
clang -o teerank-add-new-servers -Wall -Werror -O -std=c99 -D_POSIX_C_SOURCE=200809L -g src/add-new-servers.o src/network.o src/config.o
clang -Wall -Werror -O -std=c99 -D_POSIX_C_SOURCE=200809L -g   -c -o src/update-servers.o src/update-servers.c
clang -Wall -Werror -O -std=c99 -D_POSIX_C_SOURCE=200809L -g   -c -o src/pool.o src/pool.c
clang -Wall -Werror -O -std=c99 -D_POSIX_C_SOURCE=200809L -g   -c -o src/delta.o src/delta.c
clang -Wall -Werror -O -std=c99 -D_POSIX_C_SOURCE=200809L -g   -c -o src/io.o src/io.c
clang -Wall -Werror -O -std=c99 -D_POSIX_C_SOURCE=200809L -g   -c -o src/server.o src/server.c
src/server.c:93:9: error: variable 'path' is uninitialized when used here [-Werror,-Wuninitialized]
        assert(path != NULL);
               ^~~~
/usr/include/assert.h:86:5: note: expanded from macro 'assert'
  ((expr)                                                               \
    ^
src/server.c:88:12: note: initialize the variable 'path' to silence this warning
        char *path;
                  ^
                   = NULL
src/server.c:92:9: error: variable 'file' is uninitialized when used here [-Werror,-Wuninitialized]
        assert(file != NULL);
               ^~~~
/usr/include/assert.h:86:5: note: expanded from macro 'assert'
  ((expr)                                                               \
    ^
src/server.c:89:12: note: initialize the variable 'file' to silence this warning
        FILE *file;
                  ^
                   = NULL
2 errors generated.
<builtin>: recipe for target 'src/server.o' failed
make: *** [src/server.o] Error 1
nzyuzin commented 8 years ago

The warning about assertions is a subject of another PR (#7) and changes in language level require a separate issue from my point of view.

I'm closing this PR.

needs commented 8 years ago

A clean clang build would be nice tho ;)