According to stdlib.h, malloc and realloc return void * but error_table.y

declares them to return char *. For some reason, this causes no problems
with the old compiler tools, but doing a 'make world' with gcc 2.6.3 in a
seperate DESTDIR got me this error:

yacc -d /usr/src/usr.bin/compile_et/error_table.y
cc -O2 -I. -I/usr/src/usr.bin/compile_et/../../lib/libcom_err   -I/mnt/usr/include -c y.tab.c -o error_table.o
In file included from /usr/src/usr.bin/compile_et/et_lex.lex.l:11,
                 from /usr/src/usr.bin/compile_et/error_table.y:233:
/mnt/usr/include/stdlib.h💯 conflicting types for `malloc'
/usr/src/usr.bin/compile_et/error_table.y:80: previous declaration of `malloc'
/mnt/usr/include/stdlib.h:104: conflicting types for `realloc'
/usr/src/usr.bin/compile_et/error_table.y:80: previous declaration of `realloc'
*** Error code 1

Stop.

Declaring malloc and realloc to return void * fixes this. It could be that
the new gcc is a bit more picky about these things.
This commit is contained in:
Bill Paul 1995-03-15 19:05:28 +00:00
parent 8e95bee6d4
commit d93cc1a933
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7073

View file

@ -1,6 +1,7 @@
%{
#include <stdio.h>
char *str_concat(), *ds(), *quote(), *malloc(), *realloc();
char *str_concat(), *ds(), *quote();
void *malloc(), *realloc();
char *current_token = (char *)NULL;
extern char *table_name;
%}
@ -73,10 +74,10 @@ description : QUOTED_STRING
#ifndef lint
static char const rcsid_error_table_y[] =
"$Header: error_table.y,v 1.7 89/01/01 07:23:17 raeburn Locked $";
"$Header: /home/ncvs/src/usr.bin/compile_et/error_table.y,v 1.2 1995/01/14 22:29:33 wollman Exp $";
#endif
char *malloc(), *realloc();
void *malloc(), *realloc();
extern FILE *hfile, *cfile;
static long gensym_n = 0;