gcc compiler options
We have multiple compiler options in gcc the most commonly used are:-
-pedantic --> shows the compilation errors in header files
-Wall --> shows all warnings
-Werror --> converts all warnings into errors
-fno-stack-protector --> if we want to use Huge stack size then it disables the stack protector in gcc
ex:- $ gcc -Werror -Wall -pedantic sym_tbl.c lex.c
In file included from sym_tbl.c:3:0:
lex.h:3:13: error: ‘Buffer’ defined but not used [-Werror=unused-variable]
static char Buffer[MAX_CHAR];
^
lex.h:4:12: error: ‘TOTAL_CHAR’ defined but not used [-Werror=unused-variable]
static int TOTAL_CHAR;
^
sym_tbl.c: In function ‘Table_init’:
sym_tbl.c:17:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
sym_tbl.c: In function ‘symbol_insert’:
sym_tbl.c:32:1: error: control reaches end of non-void function [-Werror=return-type]
}
ex:- $ gcc -Werror -Wall -pedantic sym_tbl.c lex.c
In file included from sym_tbl.c:3:0:
lex.h:3:13: error: ‘Buffer’ defined but not used [-Werror=unused-variable]
static char Buffer[MAX_CHAR];
^
lex.h:4:12: error: ‘TOTAL_CHAR’ defined but not used [-Werror=unused-variable]
static int TOTAL_CHAR;
^
sym_tbl.c: In function ‘Table_init’:
sym_tbl.c:17:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
sym_tbl.c: In function ‘symbol_insert’:
sym_tbl.c:32:1: error: control reaches end of non-void function [-Werror=return-type]
}
Comments
Post a Comment