-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Making the example for linux (compile+link) gives many warnings (thanks to -Wall flag).
This should not happen. The code should be clean enough to avoid this. This is what I get when I make:
cristian14@cristian14-HP-ENVY-4-Notebook-PC:~/workspace/C/UniversalShellBuilder/UniversalShellBuilder$ make
cd example; make
make[1]: Entering directory `/home/cristian10/workspace/C/UniversalShellBuilder/UniversalShellBuilder/example'
cd linux; make -w
make[2]: Entering directory `/home/cristian10/workspace/C/UniversalShellBuilder/UniversalShellBuilder/example/linux'
gcc -g -Wall -I../../ -I./ -c -o obj/getopt.o ../..//getopt.c
gcc -g -Wall -I../../ -I./ -c -o obj/commands.o ../..//commands.c
gcc -g -Wall -I../../ -I./ -c -o obj/minimal_lib.o ../..//minimal_lib.c
gcc -g -Wall -I../../ -I./ -c -o obj/my_commands.o my_commands.c
my_commands.c: In function ‘cmd_example’:
my_commands.c:47:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (error = get_options("t:ab:c")) return error;
^
my_commands.c: In function ‘cmd_echo’:
my_commands.c:85:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (error = get_options("n")) return error;
^
my_commands.c: In function ‘cmd_hello’:
my_commands.c:113:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (error = get_options("sm:")) return error;
^
my_commands.c: In function ‘cmd_exit’:
my_commands.c:152:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (error = get_options("")) return error;
^
my_commands.c: In function ‘cmd_count’:
my_commands.c:179:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (error = get_options("f:i:r")) return error;
^
my_commands.c:183:9: warning: implicit declaration of function ‘atoi’ [-Wimplicit-function-declaration]
count = atoi(opt_content('f'));
^
my_commands.c: In function ‘cmd_cat’:
my_commands.c:252:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (error = get_options("n")) return error;
^
my_commands.c: In function ‘cmd_echo’:
my_commands.c:96:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
gcc -g -Wall -I../../ -I./ -o linux_example obj/getopt.o obj/commands.o obj/minimal_lib.o obj/my_commands.o main.c
make[2]: Leaving directory `/home/cristian10/workspace/C/UniversalShellBuilder/UniversalShellBuilder/example/linux'
make[1]: Leaving directory `/home/cristian10/workspace/C/UniversalShellBuilder/UniversalShellBuilder/example'