Date: Mon, 10 Jun 2002 03:57:08 +0300 From: Giorgos Keramidas <keramida@FreeBSD.org> To: tjr@FreeBSD.org, audit@FreeBSD.org Subject: /bin/sh: Making it possible to use WARNS=6 Message-ID: <20020610005708.GA12544@hades.hell.gr>
next in thread | raw e-mail | index | archive | help
These changes allowed me to build test(1) and sh(1)
with WARNS=6 in CURRENT. What do you think? ;-)
What do you all think?
%%%
- Remove a couple of unused vars from jobs.c
- Add all necessary fields to struct initialized in init.c
- Add const to mksyntax.c to fix last warnings.
- Properly prototype functions to fix bulding with WARNS=6.
Index: test/test.c
===================================================================
RCS file: /home/ncvs/src/bin/test/test.c,v
retrieving revision 1.47
diff -u -r1.47 test.c
--- test/test.c 11 May 2002 01:25:54 -0000 1.47
+++ test/test.c 9 Jun 2002 22:37:21 -0000
@@ -181,6 +181,8 @@
static void syntax(const char *, const char *);
static enum token t_lex(char *);
+int main(int argc, char **argv);
+
int
main(int argc, char **argv)
{
Index: sh/alias.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/alias.c,v
retrieving revision 1.15
diff -u -r1.15 alias.c
--- sh/alias.c 4 Jun 2002 12:59:12 -0000 1.15
+++ sh/alias.c 9 Jun 2002 22:54:11 -0000
@@ -148,7 +148,7 @@
}
#ifdef mkinit
-MKINIT void rmaliases();
+MKINIT void rmaliases(void);
SHELLPROC {
rmaliases();
Index: sh/arith.y
===================================================================
RCS file: /home/ncvs/src/bin/sh/arith.y,v
retrieving revision 1.13
diff -u -r1.13 arith.y
--- sh/arith.y 2 Feb 2002 06:50:45 -0000 1.13
+++ sh/arith.y 9 Jun 2002 21:44:17 -0000
@@ -103,10 +103,13 @@
#include "memalloc.h"
char *arith_buf, *arith_startbuf;
-extern void arith_lex_reset();
+extern void arith_lex_reset(void);
int yylex(void);
int yyparse(void);
+void yyerror(char *s);
+int arith(char *s);
+int expcmd(int argc, char **argv);
int
arith(char *s)
Index: sh/arith_lex.l
===================================================================
RCS file: /home/ncvs/src/bin/sh/arith_lex.l,v
retrieving revision 1.17
diff -u -r1.17 arith_lex.l
--- sh/arith_lex.l 2 Feb 2002 06:50:46 -0000 1.17
+++ sh/arith_lex.l 9 Jun 2002 22:04:20 -0000
@@ -52,6 +52,9 @@
#define YY_INPUT(buf,result,max) \
result = (*buf = *arith_buf++) ? 1 : YY_NULL;
#define YY_NO_UNPUT
+
+int yylex(void);
+void arith_lex_reset(void);
%}
%%
@@ -83,7 +86,7 @@
%%
void
-arith_lex_reset()
+arith_lex_reset(void)
{
YY_NEW_FILE;
}
Index: sh/exec.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/exec.c,v
retrieving revision 1.17
diff -u -r1.17 exec.c
--- sh/exec.c 15 Apr 2002 15:49:30 -0000 1.17
+++ sh/exec.c 9 Jun 2002 22:54:53 -0000
@@ -655,7 +655,7 @@
*/
#ifdef mkinit
-MKINIT void deletefuncs();
+MKINIT void deletefuncs(void);
SHELLPROC {
deletefuncs();
Index: sh/jobs.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/jobs.c,v
retrieving revision 1.44
diff -u -r1.44 jobs.c
--- sh/jobs.c 4 Jun 2002 15:26:00 -0000 1.44
+++ sh/jobs.c 9 Jun 2002 20:30:19 -0000
@@ -273,7 +273,6 @@
int
jobscmd(int argc, char *argv[])
{
- struct job *jp;
char *id;
int ch, sformat, lformat;
@@ -926,7 +925,6 @@
struct job *thisjob;
int done;
int stopped;
- int core;
int sig;
in_dowait++;
Index: sh/mail.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/mail.c,v
retrieving revision 1.11
diff -u -r1.11 mail.c
--- sh/mail.c 2 Feb 2002 06:50:46 -0000 1.11
+++ sh/mail.c 9 Jun 2002 22:15:00 -0000
@@ -50,6 +50,7 @@
#include "exec.h" /* defines padvance() */
#include "var.h"
#include "output.h"
+#include "mail.h"
#include "memalloc.h"
#include "error.h"
#include <sys/types.h>
Index: sh/miscbltin.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/miscbltin.c,v
retrieving revision 1.25
diff -u -r1.25 miscbltin.c
--- sh/miscbltin.c 2 Feb 2002 06:50:46 -0000 1.25
+++ sh/miscbltin.c 9 Jun 2002 22:27:48 -0000
@@ -67,6 +67,10 @@
#undef eflag
+int readcmd(int argc, char *argv[]);
+int umaskcmd(int argc, char *argv[]);
+int ulimitcmd(int argc, char *argv[]);
+
/*
* The read builtin. The -r option causes backslashes to be treated like
* ordinary characters.
Index: sh/mkbuiltins
===================================================================
RCS file: /home/ncvs/src/bin/sh/mkbuiltins,v
retrieving revision 1.10
diff -u -r1.10 mkbuiltins
--- sh/mkbuiltins 18 Feb 2002 06:08:23 -0000 1.10
+++ sh/mkbuiltins 9 Jun 2002 22:45:42 -0000
@@ -61,9 +61,9 @@
!
awk '/^[^#]/ {if(('$havejobs' || $2 != "-j") && ('$havehist' || $2 != "-h")) \
print $0}' builtins.def | sed 's/-j//' > $temp
-awk '{ printf "int %s();\n", $1}' $temp
+awk '{ printf "int %s(int argc, char **argv);\n", $1}' $temp
echo '
-int (*const builtinfunc[])() = {'
+int (*const builtinfunc[])(int, char **) = {'
awk '/^[^#]/ { printf "\t%s,\n", $1}' $temp
echo '};
@@ -90,6 +90,6 @@
int code;
};
-extern int (*const builtinfunc[])();
+extern int (*const builtinfunc[])(int argc, char **argv);
extern const struct builtincmd builtincmd[];'
rm -f $temp
Index: sh/mkinit.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/mkinit.c,v
retrieving revision 1.15
diff -u -r1.15 mkinit.c
--- sh/mkinit.c 2 Feb 2002 06:50:46 -0000 1.15
+++ sh/mkinit.c 9 Jun 2002 23:05:49 -0000
@@ -137,10 +137,10 @@
struct event event[] = {
- {"INIT", "init", init},
- {"RESET", "reset", reset},
- {"SHELLPROC", "initshellproc", shellproc},
- {NULL, NULL}
+ {"INIT", "init", init, {NULL, 0, NULL, NULL}},
+ {"RESET", "reset", reset, {NULL, 0, NULL, NULL}},
+ {"SHELLPROC", "initshellproc", shellproc, {NULL, 0, NULL, NULL}},
+ {NULL, NULL, NULL, {NULL, 0, NULL, NULL}}
};
@@ -395,7 +395,8 @@
for (ep = event ; ep->name ; ep++) {
fputs("\n\n\n", fp);
fputs(ep->comment, fp);
- fprintf(fp, "\nvoid\n%s() {\n", ep->routine);
+ fprintf(fp, "void %s(void);\n", ep->routine);
+ fprintf(fp, "\nvoid\n%s(void) {\n", ep->routine);
writetext(&ep->code, fp);
fprintf(fp, "}\n");
}
Index: sh/mksyntax.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/mksyntax.c,v
retrieving revision 1.18
diff -u -r1.18 mksyntax.c
--- sh/mksyntax.c 2 Feb 2002 06:50:46 -0000 1.18
+++ sh/mksyntax.c 9 Jun 2002 20:55:44 -0000
@@ -59,8 +59,8 @@
struct synclass {
- char *name;
- char *comment;
+ const char *name;
+ const char *comment;
};
/* Syntax classes */
Index: sh/var.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/var.c,v
retrieving revision 1.20
diff -u -r1.20 var.c
--- sh/var.c 6 Jun 2002 04:02:50 -0000 1.20
+++ sh/var.c 9 Jun 2002 22:55:32 -0000
@@ -462,7 +462,7 @@
*/
#ifdef mkinit
-MKINIT void shprocvar();
+MKINIT void shprocvar(void);
SHELLPROC {
shprocvar();
Index: sh/bltin/echo.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/bltin/echo.c,v
retrieving revision 1.11
diff -u -r1.11 echo.c
--- sh/bltin/echo.c 2 Feb 2002 06:50:55 -0000 1.11
+++ sh/bltin/echo.c 9 Jun 2002 22:21:31 -0000
@@ -45,6 +45,8 @@
#include "bltin.h"
+int main(int argc, char *argv[]);
+
/* #define eflag 1 */
int
%%%
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020610005708.GA12544>
