From d34ab6de9f8795226e7c4a08f4299547fe38b8ab Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 8 Jun 2011 19:59:14 +0200 Subject: [PATCH] commands: fix clang errors --- commands/ash/setmode.c | 4 ++-- commands/autil/anm.c | 4 +++- commands/elle/Makefile | 5 +++++ commands/elle/eecmds.c | 13 ++++++++----- commands/elle/eedisp.c | 15 ++++++++------- commands/elle/eemain.c | 4 ++-- commands/elle/eeproto.h | 21 +++++++++++---------- commands/elle/ellec.c | 8 ++++---- commands/fdisk/fdisk.c | 12 ++++++------ commands/format/format.c | 2 +- commands/talk/screen.c | 2 +- 11 files changed, 51 insertions(+), 39 deletions(-) diff --git a/commands/ash/setmode.c b/commands/ash/setmode.c index d80c00bdd..80f66ae6b 100644 --- a/commands/ash/setmode.c +++ b/commands/ash/setmode.c @@ -73,7 +73,7 @@ typedef struct bitcmd { #define CMD2_UBITS 0x10 static BITCMD *addcmd (BITCMD *, int, int, int, unsigned int); -static int compress_mode (BITCMD *); +static void compress_mode (BITCMD *); #ifdef SETMODE_DEBUG static void dumpmode __P((BITCMD *)); #endif @@ -408,7 +408,7 @@ dumpmode(set) * 'g' and 'o' commands continue to be separate. They could probably be * compacted, but it's not worth the effort. */ -static int +static void compress_mode(set) register BITCMD *set; { diff --git a/commands/autil/anm.c b/commands/autil/anm.c index 993725193..1e0e862dd 100644 --- a/commands/autil/anm.c +++ b/commands/autil/anm.c @@ -99,6 +99,8 @@ extern int rd_unsigned2(); extern long lseek(); extern char *strncpy(); +void do_file(int fd); + process(fd) int fd; { @@ -135,7 +137,7 @@ process(fd) } } -do_file(fd) +void do_file(fd) int fd; { struct outname *nbufp = NULL; diff --git a/commands/elle/Makefile b/commands/elle/Makefile index d93dfe5d1..ef5849e0d 100644 --- a/commands/elle/Makefile +++ b/commands/elle/Makefile @@ -10,6 +10,11 @@ CPPFLAGS+= -DIGN_JOB_CONTROl MAN.elle= MAN.ellec= +.if !empty(CC:Mclang) +# tons of int functions don't return values +CFLAGS+= -Wreturn-type +.endif + defprf.c: deffun.e cat deffun.e defprf.e | ellec -Pconf > defprf.c diff --git a/commands/elle/eecmds.c b/commands/elle/eecmds.c index 757d8bebb..de124ebce 100644 --- a/commands/elle/eecmds.c +++ b/commands/elle/eecmds.c @@ -8,20 +8,24 @@ */ #include "elle.h" +#include "eeproto.h" /* Function table, see the included file for explanation. */ /* First must pre-declare function addrs */ +#if 0 #define EFUN(rtn,rtnstr,name) int rtn(); #define EFUNHOLE #include "eefdef.h" +#endif /* Now re-insert to define function table */ -int (*funtab[])() = +typedef int (*eefunc)(); +eefunc funtab[] = { #undef EFUN /* Avoid redefinition error message */ #undef EFUNHOLE -#define EFUN(rtn,rtnstr,name) rtn, +#define EFUN(rtn,rtnstr,name) (eefunc) rtn, #define EFUNHOLE 0, #include "eefdef.h" }; @@ -102,8 +106,7 @@ int ch; /* Asks for a profile file and sets profile from it. */ f_setprof() -{ int set_profile(); - hack_file("Set Profile: ", set_profile); +{ hack_file("Set Profile: ", set_profile); } #if FX_VTBUTTONS @@ -214,7 +217,7 @@ register int c; #include /* for O_BINARY */ #endif -set_profile(filename) +void set_profile(filename) char *filename; { char pfile[200]; register int pfd, len; diff --git a/commands/elle/eedisp.c b/commands/elle/eedisp.c index d1ceb3136..c93b23869 100644 --- a/commands/elle/eedisp.c +++ b/commands/elle/eedisp.c @@ -189,7 +189,7 @@ redp_init () /* SET_TTY() - Set up terminal modes for editing */ -set_tty() +void set_tty() { if(trm_mode) return; /* Ignore if detached or in edit mode */ trm_mode++; ts_enter(); /* Set up system's ideas about terminal */ @@ -249,7 +249,7 @@ set_scr() * as to what has changed or needs updating, to avoid wasting time * on things which don't need attention. */ -redisplay () +void redisplay () { register struct window *w; register i; struct window *make_mode(); @@ -1301,7 +1301,7 @@ done: s->sl_line = s->sl_nlin; /* Replace old image by new */ } #if FX_SOWIND -fillset(str,cnt,c) +void fillset(str,cnt,c) char *str; int cnt; int c; @@ -1314,7 +1314,7 @@ int c; } #endif -fillsp(str,cnt) +void fillsp(str,cnt) char *str; int cnt; { register int n; @@ -1324,7 +1324,8 @@ int cnt; do{ *cp++ = SP; } while(--n); } -inspc(cp0, cpl, cnt) + +void inspc(cp0, cpl, cnt) char *cp0, *cpl; int cnt; { register char *cp, *cp2; @@ -1348,7 +1349,7 @@ int cnt; int sctreol = 0; /* Ugly crock for talking to sctrin() */ /* 0 = no EOL seen, 1 = EOL seen, -1 = EOF seen */ -fix_line(slp, olds) +void fix_line(slp, olds) struct scr_line *slp; struct scr_line *olds; { register struct scr_line *s; @@ -1653,7 +1654,7 @@ int on; #endif -t_move(y,x) +void t_move(y,x) register int y,x; { register int d; diff --git a/commands/elle/eemain.c b/commands/elle/eemain.c index 7241da74e..9427d3f7a 100644 --- a/commands/elle/eemain.c +++ b/commands/elle/eemain.c @@ -277,7 +277,7 @@ ring_bell() * through all modified buffers, complaining about a different one each time, * so that the user need not even know how to select a buffer! */ -f_retsup() +void f_retsup() { register char *reply; register int c; register struct buffer *b, *b2; @@ -354,7 +354,7 @@ f_retsup() #if FX_WFEXIT /* EFUN: "Write File Exit" (not EMACS) - from IMAGEN config */ -f_wfexit() +void f_wfexit() { exp_p = 1; /* Ensure f_savefiles asks no questions */ if (! f_savefiles()) /* Save all modified buffers, but */ diff --git a/commands/elle/eeproto.h b/commands/elle/eeproto.h index 9b50fd1eb..dfbb91ef5 100644 --- a/commands/elle/eeproto.h +++ b/commands/elle/eeproto.h @@ -61,7 +61,7 @@ _PROTOTYPE( int cmd_wait, (void) ); _PROTOTYPE( int cmd_read, (void) ); _PROTOTYPE( int cmd_xct, (int ch) ); _PROTOTYPE( int cmd_idx, (int c) ); -_PROTOTYPE( int set_profile, (char *filename) ); +_PROTOTYPE( void set_profile, (char *filename) ); _PROTOTYPE( int init_menu, (void) ); /* eediag.c */ @@ -73,10 +73,10 @@ _PROTOTYPE( int db_prwind, (struct window *w) ); _PROTOTYPE( char *db_scflgs, (int flags) ); /* eedisp.c */ -_PROTOTYPE( int set_tty, (void) ); +_PROTOTYPE( void set_tty, (void) ); _PROTOTYPE( int clean_exit, (void) ); _PROTOTYPE( int set_scr, (void) ); -_PROTOTYPE( int redisplay, (void) ); +_PROTOTYPE( void redisplay, (void) ); _PROTOTYPE( int fupd_wind, (struct window *w) ); _PROTOTYPE( int upd_curs, (chroff adot) ); _PROTOTYPE( int d_line, (chroff cdot) ); @@ -88,15 +88,15 @@ _PROTOTYPE( int inwinp, (struct window *win, chroff cdot) ); _PROTOTYPE( int upd_wind, (struct window *win) ); _PROTOTYPE( int slineq, (struct scr_line *olds, struct scr_line *news) ); _PROTOTYPE( int upd_line, (int y) ); -_PROTOTYPE( int fillset, (char *str, int cnt, int c) ); -_PROTOTYPE( int fillsp, (char *str, int cnt) ); -_PROTOTYPE( int inspc, (char *cp0, char *cpl, int cnt) ); -_PROTOTYPE( int fix_line, (struct scr_line *slp, struct scr_line *olds) ); +_PROTOTYPE( void fillset, (char *str, int cnt, int c) ); +_PROTOTYPE( void fillsp, (char *str, int cnt) ); +_PROTOTYPE( void inspc, (char *cp0, char *cpl, int cnt) ); +_PROTOTYPE( void fix_line, (struct scr_line *slp, struct scr_line *olds) ); _PROTOTYPE( int sctrin, (char *to, int lim, int ccol) ); _PROTOTYPE( int inslin, (int line, int n, struct window *win) ); _PROTOTYPE( int dellin, (int line, int n, struct window *win) ); _PROTOTYPE( int t_dostandout, (int on) ); -_PROTOTYPE( int t_move, (int y, int x) ); +_PROTOTYPE( void t_move, (int y, int x) ); _PROTOTYPE( int t_docleol, (void) ); /* eeedit.c */ @@ -338,8 +338,8 @@ _PROTOTYPE( int doargs, (int argc, char **argv) ); _PROTOTYPE( int initialize, (void) ); _PROTOTYPE( int f_throw, (void) ); _PROTOTYPE( int ring_bell, (void) ); -_PROTOTYPE( int f_retsup, (void) ); -_PROTOTYPE( int f_wfexit, (void) ); +_PROTOTYPE( void f_retsup, (void) ); +_PROTOTYPE( void f_wfexit, (void) ); _PROTOTYPE( int f_pshinf, (void) ); _PROTOTYPE( char *memalloc, (SBMO size) ); _PROTOTYPE( int chkfree, (SBMA ptr) ); @@ -406,6 +406,7 @@ _PROTOTYPE( int lin_search, (int backwards) ); _PROTOTYPE( int srchint, (void) ); _PROTOTYPE( char *srch_ask, (char *prompt) ); _PROTOTYPE( int f_risrch, (void) ); +_PROTOTYPE( int f_isrch, (void) ); _PROTOTYPE( int i_search, (int back) ); /* eeterm.c */ diff --git a/commands/elle/ellec.c b/commands/elle/ellec.c index 195f2a068..de334a5ba 100644 --- a/commands/elle/ellec.c +++ b/commands/elle/ellec.c @@ -143,7 +143,7 @@ _PROTOTYPE(int ustrcmp , (char *s1 , char *s2 )); _PROTOTYPE(int strueq , (char *s1 , char *s2 )); _PROTOTYPE(int do_opcod , (void)); _PROTOTYPE(int do_opasc , (void)); -_PROTOTYPE(int outkbind , (int c , int fx )); +_PROTOTYPE(void outkbind , (int c , int fx )); _PROTOTYPE(int do_obprof , (void)); _PROTOTYPE(int mupcase , (int ch )); _PROTOTYPE(int upcase , (int ch )); @@ -156,7 +156,7 @@ _PROTOTYPE(int do_ofxcod , (void)); _PROTOTYPE(int compile_stdin , (void)); _PROTOTYPE(int lrch , (void)); _PROTOTYPE(struct lnode *lread , (void)); -_PROTOTYPE(int wspfls , (void)); +_PROTOTYPE(void wspfls , (void)); _PROTOTYPE(struct lnode *lrstr , (int flg )); _PROTOTYPE(int islword , (int c )); _PROTOTYPE(struct lnode *eval , (struct lnode *lp )); @@ -561,7 +561,7 @@ do_opasc() fatal("%d errors encountered, check output file.", oerrs); } -outkbind(c, fx) +void outkbind(c, fx) { if(fx == 0) /* Allow key to be mapped to nothing. */ return; @@ -899,7 +899,7 @@ lread() return(lrstr(0)); } -wspfls() +void wspfls() { register int c; for(;;) { c = lrch(); diff --git a/commands/fdisk/fdisk.c b/commands/fdisk/fdisk.c index 8e5fe53c6..e0b4db8cb 100644 --- a/commands/fdisk/fdisk.c +++ b/commands/fdisk/fdisk.c @@ -86,14 +86,14 @@ _PROTOTYPE(int main, (int argc, char *argv [])); _PROTOTYPE(void getgeom, (void)); _PROTOTYPE(int getboot, (char *buffer)); _PROTOTYPE(int putboot, (char *buffer)); -_PROTOTYPE(int load_from_file, (void)); -_PROTOTYPE(int save_to_file, (void)); +_PROTOTYPE(void load_from_file, (void)); +_PROTOTYPE(void save_to_file, (void)); _PROTOTYPE(int dpl_partitions, (int rawflag)); _PROTOTYPE(int chk_table, (void)); _PROTOTYPE(int sec_to_hst, (long logsec, unsigned char *hd, unsigned char *sec, unsigned char *cyl)); _PROTOTYPE(int mark_partition, (struct part_entry *pe)); -_PROTOTYPE(int change_partition, (struct part_entry *entry)); +_PROTOTYPE(void change_partition, (struct part_entry *entry)); _PROTOTYPE(int get_a_char, (void)); _PROTOTYPE(int print_menu, (void)); _PROTOTYPE(void adj_base, (struct part_entry *pe)); @@ -292,7 +292,7 @@ char *buffer; #endif -load_from_file() +void load_from_file() { /* Load buffer from file */ @@ -315,7 +315,7 @@ load_from_file() } -save_to_file() +void save_to_file() { /* Save to file */ @@ -561,7 +561,7 @@ struct part_entry *pe; } } -change_partition(entry) +void change_partition(entry) struct part_entry *entry; { /* Get partition info : first & last cylinder */ diff --git a/commands/format/format.c b/commands/format/format.c index 40f63c205..f6cd43b7a 100644 --- a/commands/format/format.c +++ b/commands/format/format.c @@ -332,7 +332,7 @@ int main(int argc, char **argv) type= fl_type(st.st_rdev); /* The drive should not be mounted. */ - if (load_mtab("mkfs") < 0) return; + if (load_mtab("mkfs") < 0) exit(1); while (get_mtab_entry(special, mounted_on, version, rw_flag) == 0) { if (stat(special, &st) >= 0 && isfloppy(st.st_rdev) diff --git a/commands/talk/screen.c b/commands/talk/screen.c index 1b84ba471..c7f689392 100644 --- a/commands/talk/screen.c +++ b/commands/talk/screen.c @@ -186,7 +186,7 @@ char *p = &line[80]; *p-- = '\0'; getyx(w, r, c); - if(c == 0) return; + if(c == 0) return NULL; while(c >= 0) { c--; ch = mvwinch(w, r, c);