Module Name: src Committed By: rillig Date: Tue Dec 29 11:35:11 UTC 2020
Modified Files: src/usr.bin/xlint/common: mem.c tyname.c src/usr.bin/xlint/lint1: cgram.y decl.c emit1.c err.c init.c main1.c mem1.c tree.c src/usr.bin/xlint/lint2: chk.c emit2.c hash.c mem2.c msg.c read.c src/usr.bin/xlint/xlint: xlint.c Log Message: lint: remove redundant parentheses around return value To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/common/mem.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/common/tyname.c cvs rdiff -u -r1.111 -r1.112 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.23 -r1.24 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.56 -r1.57 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.30 -r1.31 src/usr.bin/xlint/lint1/main1.c cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint1/mem1.c cvs rdiff -u -r1.94 -r1.95 src/usr.bin/xlint/lint1/tree.c cvs rdiff -u -r1.26 -r1.27 src/usr.bin/xlint/lint2/chk.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/xlint/lint2/emit2.c cvs rdiff -u -r1.11 -r1.12 src/usr.bin/xlint/lint2/hash.c cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint2/mem2.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint2/msg.c cvs rdiff -u -r1.29 -r1.30 src/usr.bin/xlint/lint2/read.c cvs rdiff -u -r1.50 -r1.51 src/usr.bin/xlint/xlint/xlint.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/common/mem.c diff -u src/usr.bin/xlint/common/mem.c:1.10 src/usr.bin/xlint/common/mem.c:1.11 --- src/usr.bin/xlint/common/mem.c:1.10 Mon Dec 28 22:16:42 2020 +++ src/usr.bin/xlint/common/mem.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.10 2020/12/28 22:16:42 rillig Exp $ */ +/* $NetBSD: mem.c,v 1.11 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: mem.c,v 1.10 2020/12/28 22:16:42 rillig Exp $"); +__RCSID("$NetBSD: mem.c,v 1.11 2020/12/29 11:35:11 rillig Exp $"); #endif #include <sys/param.h> @@ -56,7 +56,7 @@ xmalloc(size_t s) if ((p = malloc(s)) == NULL) nomem(); - return (p); + return p; } void * @@ -66,7 +66,7 @@ xcalloc(size_t n, size_t s) if ((p = calloc(n, s)) == NULL) nomem(); - return (p); + return p; } void * @@ -79,7 +79,7 @@ xrealloc(void *p, size_t s) nomem(); } p = n; - return (p); + return p; } char * @@ -89,7 +89,7 @@ xstrdup(const char *s) if ((s2 = strdup(s)) == NULL) nomem(); - return (s2); + return s2; } void Index: src/usr.bin/xlint/common/tyname.c diff -u src/usr.bin/xlint/common/tyname.c:1.13 src/usr.bin/xlint/common/tyname.c:1.14 --- src/usr.bin/xlint/common/tyname.c:1.13 Fri Sep 7 15:16:15 2018 +++ src/usr.bin/xlint/common/tyname.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tyname.c,v 1.13 2018/09/07 15:16:15 christos Exp $ */ +/* $NetBSD: tyname.c,v 1.14 2020/12/29 11:35:11 rillig Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tyname.c,v 1.13 2018/09/07 15:16:15 christos Exp $"); +__RCSID("$NetBSD: tyname.c,v 1.14 2020/12/29 11:35:11 rillig Exp $"); #endif #include <limits.h> @@ -235,5 +235,5 @@ tyname(char *buf, size_t bufsiz, const t default: LERROR("tyname(%d)", t); } - return (buf); + return buf; } Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.111 src/usr.bin/xlint/lint1/cgram.y:1.112 --- src/usr.bin/xlint/lint1/cgram.y:1.111 Tue Dec 29 10:24:22 2020 +++ src/usr.bin/xlint/lint1/cgram.y Tue Dec 29 11:35:11 2020 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.111 2020/12/29 10:24:22 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.112 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.111 2020/12/29 10:24:22 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.112 2020/12/29 11:35:11 rillig Exp $"); #endif #include <limits.h> @@ -2026,7 +2026,7 @@ yyerror(const char *msg) error(249, yytext); if (++sytxerr >= 5) norecover(); - return (0); + return 0; } static __inline int uq_gt(uint64_t, uint64_t); @@ -2036,14 +2036,14 @@ static __inline int uq_gt(uint64_t a, uint64_t b) { - return (a > b); + return a > b; } static __inline int q_gt(int64_t a, int64_t b) { - return (a > b); + return a > b; } #define q_lt(a, b) q_gt(b, a) @@ -2096,7 +2096,7 @@ toicon(tnode_t *tn, int required) } } free(v); - return (i); + return i; } static void Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.75 src/usr.bin/xlint/lint1/decl.c:1.76 --- src/usr.bin/xlint/lint1/decl.c:1.75 Tue Dec 29 10:24:22 2020 +++ src/usr.bin/xlint/lint1/decl.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.75 2020/12/29 10:24:22 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.76 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.75 2020/12/29 10:24:22 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.76 2020/12/29 11:35:11 rillig Exp $"); #endif #include <sys/param.h> @@ -140,7 +140,7 @@ type_t * gettyp(tspec_t t) { - return (&typetab[t]); + return &typetab[t]; } type_t * @@ -150,7 +150,7 @@ duptyp(const type_t *tp) ntp = getblk(sizeof (type_t)); STRUCT_ASSIGN(*ntp, *tp); - return (ntp); + return ntp; } /* @@ -164,7 +164,7 @@ tduptyp(const type_t *tp) ntp = tgetblk(sizeof (type_t)); STRUCT_ASSIGN(*ntp, *tp); - return (ntp); + return ntp; } /* @@ -177,15 +177,15 @@ incompl(type_t *tp) tspec_t t; if ((t = tp->t_tspec) == VOID) { - return (1); + return 1; } else if (t == ARRAY) { - return (tp->t_aincompl); + return tp->t_aincompl; } else if (t == STRUCT || t == UNION) { - return (tp->t_str->sincompl); + return tp->t_str->sincompl; } else if (t == ENUM) { - return (tp->t_enum->eincompl); + return tp->t_enum->eincompl; } - return (0); + return 0; } /* @@ -389,7 +389,7 @@ tdeferr(type_t *td, tspec_t t) warning(5, ttab[t].tt_name); td = duptyp(gettyp(mrgtspec(t2, t))); td->t_typedef = 1; - return (td); + return td; } break; case SHORT: @@ -398,7 +398,7 @@ tdeferr(type_t *td, tspec_t t) warning(5, "short"); td = duptyp(gettyp(t2 == INT ? SHORT : USHORT)); td->t_typedef = 1; - return (td); + return td; } break; case LONG: @@ -423,7 +423,7 @@ tdeferr(type_t *td, tspec_t t) } td = duptyp(td); td->t_typedef = 1; - return (td); + return td; } break; /* LINTED206: (enumeration values not handled in switch) */ @@ -465,7 +465,7 @@ tdeferr(type_t *td, tspec_t t) /* Anything other is not accepted. */ dcs->d_terr = 1; - return (td); + return td; } /* @@ -877,7 +877,7 @@ mrgtspec(tspec_t t, tspec_t s) } } - return (t); + return t; } /* @@ -925,7 +925,7 @@ length(type_t *tp, const char *name) LERROR("length(%d)", elsz); break; } - return (elem * elsz); + return elem * elsz; } /* @@ -958,7 +958,7 @@ getbound(type_t *tp) } if (a < CHAR_BIT || a > WORST_ALIGN(1) * CHAR_BIT) LERROR("getbound()"); - return (a); + return a; } /* @@ -971,11 +971,11 @@ lnklst(sym_t *l1, sym_t *l2) sym_t *l; if ((l = l1) == NULL) - return (l2); + return l2; while (l1->s_nxt != NULL) l1 = l1->s_nxt; l1->s_nxt = l2; - return (l); + return l; } /* @@ -1210,7 +1210,7 @@ declarator_1_struct_union(sym_t *dsym) */ bitfieldtype_ok = 0; - return (dsym); + return dsym; } /* @@ -1255,7 +1255,7 @@ bitfield(sym_t *dsym, int len) dsym->s_type->t_isfield = 1; dsym->s_type->t_flen = len; dsym->s_field = 1; - return (dsym); + return dsym; } /* @@ -1274,7 +1274,7 @@ merge_pointers_and_qualifiers(pqinf_t *p for (p = p2; p->p_nxt != NULL; p = p->p_nxt) continue; p->p_nxt = p1; - return (p2); + return p2; } else { if (p2->p_const) { if (p1->p_const) { @@ -1291,7 +1291,7 @@ merge_pointers_and_qualifiers(pqinf_t *p p1->p_volatile = 1; } free(p2); - return (p1); + return p1; } } @@ -1325,7 +1325,7 @@ add_pointer(sym_t *decl, pqinf_t *pi) free(pi); pi = npi; } - return (decl); + return decl; } /* @@ -1359,7 +1359,7 @@ add_array(sym_t *decl, int dim, int n) setcomplete(tp, 0); } - return (decl); + return decl; } sym_t * @@ -1405,7 +1405,7 @@ add_function(sym_t *decl, sym_t *args) tp->t_args = args; tp->t_vararg = dcs->d_vararg; - return (decl); + return decl; } /* @@ -1444,7 +1444,7 @@ new_style_function(sym_t *decl, sym_t *a } /* return NULL if first param is VOID */ - return (args != NULL && args->s_type->t_tspec != VOID ? args : NULL); + return args != NULL && args->s_type->t_tspec != VOID ? args : NULL; } /* @@ -1591,7 +1591,7 @@ declarator_name(sym_t *sym) dcs->d_fpsyms = NULL; - return (sym); + return sym; } /* @@ -1615,7 +1615,7 @@ old_style_function_name(sym_t *sym) sym->s_scl = AUTO; sym->s_def = DEF; sym->s_defarg = sym->s_arg = 1; - return (sym); + return sym; } /* @@ -1687,7 +1687,7 @@ mktag(sym_t *tag, tspec_t kind, int decl } setcomplete(tp, 0); } - return (tp); + return tp; } /* @@ -1745,7 +1745,7 @@ newtag(sym_t *tag, scl_t scl, int decl, dcs->d_nxt->d_nedecl = 1; } } - return (tag); + return tag; } const char * @@ -1764,7 +1764,7 @@ scltoa(scl_t sc) case ENUMTAG: s = "enum"; break; default: LERROR("tagttoa()"); } - return (s); + return s; } /* @@ -1818,7 +1818,7 @@ compltag(type_t *tp, sym_t *fmem) } else { tp->t_enum->elem = fmem; } - return (tp); + return tp; } /* @@ -1865,7 +1865,7 @@ ename(sym_t *sym, int val, int impl) warning(48, sym->s_name); } enumval = val + 1; - return (sym); + return sym; } /* @@ -2014,19 +2014,19 @@ check_redeclaration(sym_t *dsym, int *do /* redeclaration of %s */ error(27, dsym->s_name); print_previous_declaration(-1, rsym); - return (1); + return 1; } if (rsym->s_scl == TYPEDEF) { /* typedef redeclared: %s */ error(89, dsym->s_name); print_previous_declaration(-1, rsym); - return (1); + return 1; } if (dsym->s_scl == TYPEDEF) { /* redeclaration of %s */ error(27, dsym->s_name); print_previous_declaration(-1, rsym); - return (1); + return 1; } if (rsym->s_def == DEF && dsym->s_def == DEF) { /* redefinition of %s */ @@ -2072,7 +2072,7 @@ check_redeclaration(sym_t *dsym, int *do print_previous_declaration(-1, rsym); } dsym->s_scl = STATIC; - return (0); + return 0; } static int @@ -2133,30 +2133,30 @@ eqtype(type_t *tp1, type_t *tp2, int ign } if (t != tp2->t_tspec) - return (0); + return 0; if (!chkqual(tp1, tp2, ignqual)) return 0; if (t == STRUCT || t == UNION) - return (tp1->t_str == tp2->t_str); + return tp1->t_str == tp2->t_str; if (t == ARRAY && tp1->t_dim != tp2->t_dim) { if (tp1->t_dim != 0 && tp2->t_dim != 0) - return (0); + return 0; } /* dont check prototypes for traditional */ if (t == FUNC && !tflag) { if (tp1->t_proto && tp2->t_proto) { if (!eqargs(tp1, tp2, dowarn)) - return (0); + return 0; } else if (tp1->t_proto) { if (!mnoarg(tp1, dowarn)) - return (0); + return 0; } else if (tp2->t_proto) { if (!mnoarg(tp2, dowarn)) - return (0); + return 0; } } @@ -2166,7 +2166,7 @@ eqtype(type_t *tp1, type_t *tp2, int ign } - return (tp1 == tp2); + return tp1 == tp2; } /* @@ -2178,7 +2178,7 @@ eqargs(type_t *tp1, type_t *tp2, int *do sym_t *a1, *a2; if (tp1->t_vararg != tp2->t_vararg) - return (0); + return 0; a1 = tp1->t_args; a2 = tp2->t_args; @@ -2186,14 +2186,14 @@ eqargs(type_t *tp1, type_t *tp2, int *do while (a1 != NULL && a2 != NULL) { if (eqtype(a1->s_type, a2->s_type, 1, 0, dowarn) == 0) - return (0); + return 0; a1 = a1->s_nxt; a2 = a2->s_nxt; } - return (a1 == a2); + return a1 == a2; } /* @@ -2224,7 +2224,7 @@ mnoarg(type_t *tp, int *dowarn) *dowarn = 1; } } - return (1); + return 1; } /* @@ -2279,7 +2279,7 @@ check_old_style_definition(sym_t *rdsym, /* old style definition */ print_previous_declaration(300, rdsym); - return (msg); + return msg; } /* @@ -2380,7 +2380,7 @@ decl1arg(sym_t *sym, int initflg) sym->s_used = dcs->d_used; mark_as_set(sym); - return (sym); + return sym; } /* @@ -2542,7 +2542,7 @@ check_prototype_declaration(sym_t *arg, msg = 1; } - return (msg); + return msg; } /* @@ -2768,7 +2768,7 @@ check_init(sym_t *sym) } } - return (erred); + return erred; } /* @@ -2796,7 +2796,7 @@ abstract_name(void) dcs->d_rdcsym = NULL; dcs->d_vararg = 0; - return (sym); + return sym; } /* @@ -2829,7 +2829,7 @@ declare_1_abstract(sym_t *sym) check_function_definition(sym, 1); check_type(sym); - return (sym); + return sym; } /* Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.23 src/usr.bin/xlint/lint1/emit1.c:1.24 --- src/usr.bin/xlint/lint1/emit1.c:1.23 Mon Dec 28 21:24:55 2020 +++ src/usr.bin/xlint/lint1/emit1.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.23 2020/12/28 21:24:55 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.24 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: emit1.c,v 1.23 2020/12/28 21:24:55 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.24 2020/12/29 11:35:11 rillig Exp $"); #endif #include <ctype.h> @@ -185,7 +185,7 @@ ttos(type_t *tp) tob = ob; ob = tmp; - return (tob.o_buf); + return tob.o_buf; } /* Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.56 src/usr.bin/xlint/lint1/err.c:1.57 --- src/usr.bin/xlint/lint1/err.c:1.56 Mon Dec 28 21:24:55 2020 +++ src/usr.bin/xlint/lint1/err.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.56 2020/12/28 21:24:55 rillig Exp $ */ +/* $NetBSD: err.c,v 1.57 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.56 2020/12/28 21:24:55 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.57 2020/12/29 11:35:11 rillig Exp $"); #endif #include <sys/types.h> @@ -413,7 +413,7 @@ lbasename(const char *path) const char *cp, *cp1, *cp2; if (Fflag) - return (path); + return path; cp = cp1 = cp2 = path; while (*cp != '\0') { @@ -422,7 +422,7 @@ lbasename(const char *path) cp1 = cp; } } - return (*cp1 == '\0' ? cp2 : cp1); + return *cp1 == '\0' ? cp2 : cp1; } static void @@ -540,7 +540,7 @@ c99ism(int n, ...) } va_end(ap); - return (msg); + return msg; } int @@ -561,5 +561,5 @@ gnuism(int n, ...) } va_end(ap); - return (msg); + return msg; } Index: src/usr.bin/xlint/lint1/init.c diff -u src/usr.bin/xlint/lint1/init.c:1.32 src/usr.bin/xlint/lint1/init.c:1.33 --- src/usr.bin/xlint/lint1/init.c:1.32 Mon Dec 28 22:31:31 2020 +++ src/usr.bin/xlint/lint1/init.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.32 2020/12/28 22:31:31 rillig Exp $ */ +/* $NetBSD: init.c,v 1.33 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: init.c,v 1.32 2020/12/28 22:31:31 rillig Exp $"); +__RCSID("$NetBSD: init.c,v 1.33 2020/12/29 11:35:11 rillig Exp $"); #endif #include <ctype.h> @@ -626,7 +626,7 @@ strginit(tnode_t *tn) strg_t *strg; if (tn->tn_op != STRING) - return (0); + return 0; istk = initstk; strg = tn->tn_strg; @@ -641,7 +641,7 @@ strginit(tnode_t *tn) if (!((strg->st_tspec == CHAR && (t == CHAR || t == UCHAR || t == SCHAR)) || (strg->st_tspec == WCHAR && t == WCHAR))) { - return (0); + return 0; } /* Put the array at top of stack */ pushinit(); @@ -652,16 +652,16 @@ strginit(tnode_t *tn) if (!((strg->st_tspec == CHAR && (t == CHAR || t == UCHAR || t == SCHAR)) || (strg->st_tspec == WCHAR && t == WCHAR))) { - return (0); + return 0; } /* * If the array is already partly initialized, we are * wrong here. */ if (istk->i_cnt != istk->i_type->t_dim) - return (0); + return 0; } else { - return (0); + return 0; } /* Get length without trailing NUL character. */ @@ -681,5 +681,5 @@ strginit(tnode_t *tn) /* In every case the array is initialized completely. */ istk->i_cnt = 0; - return (1); + return 1; } Index: src/usr.bin/xlint/lint1/main1.c diff -u src/usr.bin/xlint/lint1/main1.c:1.30 src/usr.bin/xlint/lint1/main1.c:1.31 --- src/usr.bin/xlint/lint1/main1.c:1.30 Tue Dec 29 10:24:22 2020 +++ src/usr.bin/xlint/lint1/main1.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main1.c,v 1.30 2020/12/29 10:24:22 rillig Exp $ */ +/* $NetBSD: main1.c,v 1.31 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: main1.c,v 1.30 2020/12/29 10:24:22 rillig Exp $"); +__RCSID("$NetBSD: main1.c,v 1.31 2020/12/29 11:35:11 rillig Exp $"); #endif #include <sys/types.h> @@ -273,7 +273,7 @@ main(int argc, char *argv[]) outclose(); - return (nerr != 0); + return nerr != 0; } static void Index: src/usr.bin/xlint/lint1/mem1.c diff -u src/usr.bin/xlint/lint1/mem1.c:1.19 src/usr.bin/xlint/lint1/mem1.c:1.20 --- src/usr.bin/xlint/lint1/mem1.c:1.19 Mon Dec 28 12:52:45 2020 +++ src/usr.bin/xlint/lint1/mem1.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mem1.c,v 1.19 2020/12/28 12:52:45 rillig Exp $ */ +/* $NetBSD: mem1.c,v 1.20 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: mem1.c,v 1.19 2020/12/28 12:52:45 rillig Exp $"); +__RCSID("$NetBSD: mem1.c,v 1.20 2020/12/29 11:35:11 rillig Exp $"); #endif #include <sys/types.h> @@ -74,7 +74,7 @@ srchfn(const char *s, size_t len) if (fn->fn_len == len && memcmp(fn->fn_name, s, len) == 0) break; } - return (fn); + return fn; } /* @@ -84,7 +84,7 @@ const char * fnalloc(const char *s) { - return (s != NULL ? fnnalloc(s, strlen(s)) : NULL); + return s != NULL ? fnnalloc(s, strlen(s)) : NULL; } struct repl { @@ -136,7 +136,7 @@ fnnalloc(const char *s, size_t len) static int nxt_id = 0; if (s == NULL) - return (NULL); + return NULL; if ((fn = srchfn(s, len)) == NULL) { fn = xmalloc(sizeof (fn_t)); @@ -154,7 +154,7 @@ fnnalloc(const char *s, size_t len) outchar('s'); outstrg(fnxform(fn->fn_name, fn->fn_len)); } - return (fn->fn_name); + return fn->fn_name; } /* @@ -166,8 +166,8 @@ getfnid(const char *s) fn_t *fn; if (s == NULL || (fn = srchfn(s, strlen(s))) == NULL) - return (-1); - return (fn->fn_id); + return -1; + return fn->fn_id; } /* @@ -215,7 +215,7 @@ xnewblk(void) mb->blk = xmapalloc(mblklen); mb->size = mblklen; - return (mb); + return mb; } /* @@ -260,7 +260,7 @@ xgetblk(mbl_t **mbp, size_t s) #ifdef BLKDEBUG (void)memset(p, 0, s); #endif - return (p); + return p; } /* @@ -304,14 +304,14 @@ getlblk(size_t l, size_t s) (void)memset(&mblks[nmblks], 0, ML_INC * sizeof (mbl_t *)); nmblks += ML_INC; } - return (xgetblk(&mblks[l], s)); + return xgetblk(&mblks[l], s); } void * getblk(size_t s) { - return (getlblk(mblklev, s)); + return getlblk(mblklev, s); } /* @@ -341,7 +341,7 @@ void * tgetblk(size_t s) { - return (xgetblk(&tmblk, s)); + return xgetblk(&tmblk, s); } /* @@ -351,7 +351,7 @@ tnode_t * getnode(void) { - return (tgetblk(sizeof (tnode_t))); + return tgetblk(sizeof (tnode_t)); } /* @@ -376,7 +376,7 @@ tsave(void) tmem = tmblk; tmblk = NULL; - return (tmem); + return tmem; } /* Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.94 src/usr.bin/xlint/lint1/tree.c:1.95 --- src/usr.bin/xlint/lint1/tree.c:1.94 Tue Dec 29 10:24:22 2020 +++ src/usr.bin/xlint/lint1/tree.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.94 2020/12/29 10:24:22 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.95 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.94 2020/12/29 10:24:22 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.95 2020/12/29 11:35:11 rillig Exp $"); #endif #include <float.h> @@ -140,7 +140,7 @@ incref(type_t *tp, tspec_t t) tp2 = getblk(sizeof (type_t)); tp2->t_tspec = t; tp2->t_subt = tp; - return (tp2); + return tp2; } /* @@ -154,7 +154,7 @@ tincref(type_t *tp, tspec_t t) tp2 = tgetblk(sizeof (type_t)); tp2->t_tspec = t; tp2->t_subt = tp; - return (tp2); + return tp2; } /* @@ -173,7 +173,7 @@ getcnode(type_t *tp, val_t *v) n->tn_val->v_ansiu = v->v_ansiu; n->tn_val->v_u = v->v_u; free(v); - return (n); + return n; } /* @@ -190,7 +190,7 @@ getinode(tspec_t t, int64_t q) n->tn_val = tgetblk(sizeof (val_t)); n->tn_val->v_tspec = t; n->tn_val->v_quad = q; - return (n); + return n; } /* @@ -258,7 +258,7 @@ getnnode(sym_t *sym, int ntok) *n->tn_val = sym->s_value; } - return (n); + return n; } /* @@ -295,7 +295,7 @@ getsnode(strg_t *strg) } free(strg); - return (n); + return n; } /* @@ -325,7 +325,7 @@ strmemb(tnode_t *tn, op_t op, sym_t *msy msym->s_styp->stag = tgetblk(sizeof (sym_t)); msym->s_styp->stag->s_name = unnamed; msym->s_value.v_tspec = INT; - return (msym); + return msym; } /* Set str to the tag of which msym is expected to be a member. */ @@ -352,7 +352,7 @@ strmemb(tnode_t *tn, op_t op, sym_t *msy continue; if (strcmp(sym->s_name, msym->s_name) != 0) continue; - return (sym); + return sym; } } @@ -415,7 +415,7 @@ strmemb(tnode_t *tn, op_t op, sym_t *msy } else { error(102, msym->s_name); } - return (msym); + return msym; } /* @@ -451,7 +451,7 @@ strmemb(tnode_t *tn, op_t op, sym_t *msy } } - return (msym); + return msym; } /* @@ -473,7 +473,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) /* If there was an error in one of the operands, return. */ if (ln == NULL || (mp->m_binary && rn == NULL)) - return (NULL); + return NULL; /* * Apply class conversions to the left operand, but only if its @@ -537,7 +537,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) * compatibility. Return if there are serios problems. */ if (!typeok(op, 0, ln, rn)) - return (NULL); + return NULL; /* And now create the node. */ switch (op) { @@ -600,7 +600,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) /* Return if an error occurred. */ if (ntn == NULL) - return (NULL); + return NULL; /* Print a warning if precedence confusion is possible */ if (mp->m_tpconf) @@ -634,7 +634,7 @@ build(op_t op, tnode_t *ln, tnode_t *rn) } } - return (ntn); + return ntn; } /* @@ -678,7 +678,7 @@ cconv(tnode_t *tn) tn = mktnode(LOAD, tp, tn, NULL); } - return (tn); + return tn; } /* @@ -715,26 +715,26 @@ typeok(op_t op, int arg, tnode_t *ln, tn if (mp->m_requires_integer) { if (!tspec_is_int(lt) || (mp->m_binary && !tspec_is_int(rt))) { incompat(op, lt, rt); - return (0); + return 0; } } else if (mp->m_requires_integer_or_complex) { if ((!tspec_is_int(lt) && !tspec_is_complex(lt)) || (mp->m_binary && (!tspec_is_int(rt) && !tspec_is_complex(rt)))) { incompat(op, lt, rt); - return (0); + return 0; } } else if (mp->m_requires_scalar) { if (!tspec_is_scalar(lt) || (mp->m_binary && !tspec_is_scalar(rt))) { incompat(op, lt, rt); - return (0); + return 0; } } else if (mp->m_requires_arith) { if (!tspec_is_arith(lt) || (mp->m_binary && !tspec_is_arith(rt))) { incompat(op, lt, rt); - return (0); + return 0; } } @@ -763,7 +763,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn if (tflag) /* unacceptable operand of %s */ error(111, mp->m_name); - return (0); + return 0; } /* Now we have an object we can create a pointer to */ break; @@ -773,7 +773,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn if (tflag) /* unacceptabel operand of %s */ error(111, mp->m_name); - return (0); + return 0; } break; case INCAFT: @@ -791,7 +791,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn } /* %soperand of %s must be lvalue */ error(114, "", mp->m_name); - return (0); + return 0; } else if (ltp->t_const) { /* %soperand of %s must be modifiable lvalue */ if (!tflag) @@ -811,22 +811,22 @@ typeok(op_t op, int arg, tnode_t *ln, tn } /* %soperand of %s must be lvalue */ error(114, "", mp->m_name); - return (0); + return 0; } else if (tspec_is_scalar(lt)) { if (ltp->t_isfield) { /* cannot take address of bit-field */ error(112); - return (0); + return 0; } } else if (lt != STRUCT && lt != UNION) { /* unacceptable operand of %s */ error(111, mp->m_name); - return (0); + return 0; } if (ln->tn_op == NAME && ln->tn_sym->s_reg) { /* cannot take address of register %s */ error(113, ln->tn_sym->s_name); - return (0); + return 0; } break; case STAR: @@ -834,7 +834,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn if (lt != PTR) { /* cannot dereference non-pointer type */ error(96); - return (0); + return 0; } break; case PLUS: @@ -842,17 +842,17 @@ typeok(op_t op, int arg, tnode_t *ln, tn if ((lt == PTR && !tspec_is_int(rt)) || (rt == PTR && !tspec_is_int(lt))) { incompat(op, lt, rt); - return (0); + return 0; } break; case MINUS: /* operands have scalar types (checked above) */ if (lt == PTR && (!tspec_is_int(rt) && rt != PTR)) { incompat(op, lt, rt); - return (0); + return 0; } else if (rt == PTR && lt != PTR) { incompat(op, lt, rt); - return (0); + return 0; } if (lt == PTR && rt == PTR) { if (!eqtype(lstp, rstp, 1, 0, NULL)) { @@ -966,7 +966,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn warning(123, lx, lbuf, rx, rbuf, mp->m_name); } else { incompat(op, lt, rt); - return (0); + return 0; } } else if (lt == PTR && rt == PTR) { ptrcmpok(op, ln, rn); @@ -976,7 +976,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn if (!tspec_is_scalar(lt)) { /* first operand must have scalar type, op ? : */ error(170); - return (0); + return 0; } while (rn->tn_op == CVT) rn = rn->tn_left; @@ -1042,14 +1042,14 @@ typeok(op_t op, int arg, tnode_t *ln, tn /* incompatible types in conditional */ error(126); - return (0); + return 0; case ASSIGN: case INIT: case FARG: case RETURN: if (!asgntypok(op, arg, ln, rn)) - return (0); + return 0; goto assign; case MULASS: case DIVASS: @@ -1060,7 +1060,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn /* operands have scalar types (checked above) */ if ((lt == PTR && !tspec_is_int(rt)) || rt == PTR) { incompat(op, lt, rt); - return (0); + return 0; } goto assign; case SHLASS: @@ -1087,7 +1087,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn } /* %soperand of %s must be lvalue */ error(114, "left ", mp->m_name); - return (0); + return 0; } else if (ltp->t_const || ((lt == STRUCT || lt == UNION) && conmemb(ltp))) { /* %soperand of %s must be modifiable lvalue */ @@ -1141,7 +1141,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn chkeop1(op, arg, ln, rn); } - return (1); + return 1; } static void @@ -1198,16 +1198,16 @@ asgntypok(op_t op, int arg, tnode_t *ln, mp = &modtab[op]; if (tspec_is_arith(lt) && tspec_is_arith(rt)) - return (1); + return 1; if ((lt == STRUCT || lt == UNION) && (rt == STRUCT || rt == UNION)) /* both are struct or union */ - return (ltp->t_str == rtp->t_str); + return ltp->t_str == rtp->t_str; /* 0, 0L and (void *)0 may be assigned to any pointer */ if (lt == PTR && ((rt == PTR && rst == VOID) || tspec_is_int(rt))) { if (rn->tn_op == CON && rn->tn_val->v_quad == 0) - return (1); + return 1; } if (lt == PTR && rt == PTR && (lst == VOID || rst == VOID)) { @@ -1259,7 +1259,7 @@ asgntypok(op_t op, int arg, tnode_t *ln, break; } } - return (1); + return 1; } if ((lt == PTR && tspec_is_int(rt)) || @@ -1284,7 +1284,7 @@ asgntypok(op_t op, int arg, tnode_t *ln, warning(123, lx, lbuf, rx, rbuf, mp->m_name); break; } - return (1); + return 1; } if (lt == PTR && rt == PTR) { @@ -1302,7 +1302,7 @@ asgntypok(op_t op, int arg, tnode_t *ln, illptrc(mp, ltp, rtp); break; } - return (1); + return 1; } switch (op) { @@ -1325,7 +1325,7 @@ asgntypok(op_t op, int arg, tnode_t *ln, break; } - return (0); + return 0; } /* @@ -1533,7 +1533,7 @@ promote(op_t op, int farg, tnode_t *tn) t = tn->tn_type->t_tspec; if (!tspec_is_arith(t)) - return (tn); + return tn; if (!tflag) { /* @@ -1591,7 +1591,7 @@ promote(op_t op, int farg, tnode_t *tn) tn = convert(op, 0, ntp, tn); } - return (tn); + return tn; } /* @@ -1717,7 +1717,7 @@ convert(op_t op, int arg, type_t *tp, tn cvtcon(op, arg, ntn->tn_type, ntn->tn_val, tn->tn_val); } - return (ntn); + return ntn; } /* @@ -2308,13 +2308,13 @@ conmemb(type_t *tp) for (m = tp->t_str->memb; m != NULL; m = m->s_nxt) { tp = m->s_type; if (tp->t_const) - return (1); + return 1; if ((t = tp->t_tspec) == STRUCT || t == UNION) { if (conmemb(m->s_type)) - return (1); + return 1; } } - return (0); + return 0; } /* @@ -2366,7 +2366,7 @@ bldstr(op_t op, tnode_t *ln, tnode_t *rn if (nolval) ntn->tn_lvalue = 0; - return (ntn); + return ntn; } /* @@ -2387,7 +2387,7 @@ bldincdec(op_t op, tnode_t *ln) } ntn = mktnode(op, ln->tn_type, ln, cn); - return (ntn); + return ntn; } /* @@ -2420,7 +2420,7 @@ bldri(op_t op, tnode_t *ln) ntn = mktnode(op, cn->tn_type, ln, cn); ntn->tn_lvalue = 1; - return (ntn); + return ntn; } /* * Create a tree node for the & operator @@ -2435,19 +2435,19 @@ bldamper(tnode_t *tn, int noign) /* & before array or function: ignored */ if (tflag) warning(127); - return (tn); + return tn; } /* eliminate &* */ if (tn->tn_op == STAR && tn->tn_left->tn_type->t_tspec == PTR && tn->tn_left->tn_type->t_subt == tn->tn_type) { - return (tn->tn_left); + return tn->tn_left; } ntn = mktnode(AMPER, tincref(tn->tn_type, PTR), tn, NULL); - return (ntn); + return ntn; } /* @@ -2501,7 +2501,7 @@ bldplmi(op_t op, tnode_t *ln, tnode_t *r ntn = mktnode(op, ln->tn_type, ln, rn); } - return (ntn); + return ntn; } /* @@ -2516,7 +2516,7 @@ bldshft(op_t op, tnode_t *ln, tnode_t *r if ((t = rn->tn_type->t_tspec) != INT && t != UINT) rn = convert(CVT, 0, gettyp(INT), rn); ntn = mktnode(op, ln->tn_type, ln, rn); - return (ntn); + return ntn; } /* @@ -2554,7 +2554,7 @@ bldcol(tnode_t *ln, tnode_t *rn) if (incompl(ln->tn_type)) { /* unknown operand size, op %s */ error(138, modtab[COLON].m_name); - return (NULL); + return NULL; } rtp = ln->tn_type; } else if (lt == PTR && tspec_is_int(rt)) { @@ -2594,7 +2594,7 @@ bldcol(tnode_t *ln, tnode_t *rn) ntn = mktnode(COLON, rtp, ln, rn); - return (ntn); + return ntn; } /* @@ -2634,7 +2634,7 @@ bldasgn(op_t op, tnode_t *ln, tnode_t *r /* unknown operand size, op %s */ error(138, modtab[op].m_name); } - return (NULL); + return NULL; } } @@ -2656,7 +2656,7 @@ bldasgn(op_t op, tnode_t *ln, tnode_t *r ntn = mktnode(op, ln->tn_type, ln, rn); - return (ntn); + return ntn; } /* @@ -2725,7 +2725,7 @@ plength(type_t *tp) st = INT; #endif - return (getinode(st, (int64_t)(elem * elsz / CHAR_BIT))); + return getinode(st, (int64_t)(elem * elsz / CHAR_BIT)); } /* @@ -2877,7 +2877,7 @@ fold(tnode_t *tn) cn = getcnode(tn->tn_type, v); - return (cn); + return cn; } /* @@ -2925,7 +2925,7 @@ foldtst(tnode_t *tn) LERROR("foldtst()"); } - return (getcnode(tn->tn_type, v)); + return getcnode(tn->tn_type, v); } /* @@ -3026,7 +3026,7 @@ foldflt(tnode_t *tn) fpe = 0; } - return (getcnode(tn->tn_type, v)); + return getcnode(tn->tn_type, v); } @@ -3123,6 +3123,7 @@ tsize(type_t *tp) break; } + /* XXX: type conversion is too late */ return (int64_t)(elem * elsz); } @@ -3184,7 +3185,7 @@ cast(tnode_t *tn, type_t *tp) tspec_t nt, ot; if (tn == NULL) - return (NULL); + return NULL; tn = cconv(tn); @@ -3221,16 +3222,16 @@ cast(tnode_t *tn, type_t *tp) /* invalid cast expression */ if (!Sflag || nt == ARRAY || nt == FUNC) { error(147); - return (NULL); + return NULL; } } else if (ot == STRUCT || ot == UNION) { /* invalid cast expression */ error(147); - return (NULL); + return NULL; } else if (ot == VOID) { /* improper cast of void expression */ error(148); - return (NULL); + return NULL; } else if (tspec_is_int(nt) && tspec_is_scalar(ot)) { /* ok */ } else if (tspec_is_float(nt) && tspec_is_arith(ot)) { @@ -3246,13 +3247,13 @@ cast(tnode_t *tn, type_t *tp) } else { /* invalid cast expression */ error(147); - return (NULL); + return NULL; } tn = convert(CVT, 0, tp, tn); tn->tn_cast = 1; - return (tn); + return tn; } /* @@ -3275,7 +3276,7 @@ funcarg(tnode_t *args, tnode_t *arg) ntn = mktnode(PUSH, arg->tn_type, arg, args); - return (ntn); + return ntn; } /* @@ -3289,7 +3290,7 @@ funccall(tnode_t *func, tnode_t *args) op_t fcop; if (func == NULL) - return (NULL); + return NULL; if (func->tn_op == NAME && func->tn_type->t_tspec == FUNC) { fcop = CALL; @@ -3308,14 +3309,14 @@ funccall(tnode_t *func, tnode_t *args) char buf[256]; /* illegal function */ error(149, tyname(buf, sizeof(buf), func->tn_type)); - return (NULL); + return NULL; } args = chkfarg(func->tn_type->t_subt, args); ntn = mktnode(fcop, func->tn_type->t_subt->t_subt, func, args); - return (ntn); + return ntn; } /* @@ -3360,12 +3361,12 @@ chkfarg(type_t *ftp, tnode_t *args) if ((at = arg->tn_left->tn_type->t_tspec) == VOID) { /* void expressions may not be arguments, arg #%d */ error(151, n); - return (NULL); + return NULL; } else if ((at == STRUCT || at == UNION) && incompl(arg->tn_left->tn_type)) { /* argument cannot have unknown size, arg #%d */ error(152, n); - return (NULL); + return NULL; } else if (tspec_is_int(at) && arg->tn_left->tn_type->t_isenum && incompl(arg->tn_left->tn_type)) { @@ -3387,7 +3388,7 @@ chkfarg(type_t *ftp, tnode_t *args) asym = asym->s_nxt; } - return (args); + return args; } /* @@ -3413,7 +3414,7 @@ parg( int n, /* pos of arg */ tn = convert(FARG, n, tp, tn); } free(ln); - return (tn); + return tn; } /* @@ -3438,7 +3439,7 @@ constant(tnode_t *tn, int required) LERROR("constant()"); v->v_tspec = INT; v->v_quad = 1; - return (v); + return v; } v->v_tspec = tn->tn_type->t_tspec; @@ -3449,7 +3450,7 @@ constant(tnode_t *tn, int required) if (tspec_is_int(tn->tn_val->v_tspec)) { v->v_ansiu = tn->tn_val->v_ansiu; v->v_quad = tn->tn_val->v_quad; - return (v); + return v; } v->v_quad = tn->tn_val->v_ldbl; } else { @@ -3465,7 +3466,7 @@ constant(tnode_t *tn, int required) if (!tspec_is_int(v->v_tspec)) v->v_tspec = INT; - return (v); + return v; } /* @@ -3942,22 +3943,22 @@ conaddr(tnode_t *tn, sym_t **symp, ptrdi if (tn->tn_right->tn_op == CVT) return conaddr(tn->tn_right, symp, offsp); else if (tn->tn_right->tn_op != CON) - return (-1); + return -1; /* FALLTHROUGH */ case PLUS: offs1 = offs2 = 0; if (tn->tn_left->tn_op == CON) { offs1 = (ptrdiff_t)tn->tn_left->tn_val->v_quad; if (conaddr(tn->tn_right, &sym, &offs2) == -1) - return (-1); + return -1; } else if (tn->tn_right->tn_op == CON) { offs2 = (ptrdiff_t)tn->tn_right->tn_val->v_quad; if (tn->tn_op == MINUS) offs2 = -offs2; if (conaddr(tn->tn_left, &sym, &offs1) == -1) - return (-1); + return -1; } else { - return (-1); + return -1; } *symp = sym; *offsp = offs1 + offs2; @@ -3979,7 +3980,7 @@ conaddr(tnode_t *tn, sym_t **symp, ptrdi ot = tn->tn_left->tn_type->t_tspec; if ((!tspec_is_int(t) && t != PTR) || (!tspec_is_int(ot) && ot != PTR)) { - return (-1); + return -1; } #ifdef notdef /* @@ -3992,15 +3993,15 @@ conaddr(tnode_t *tn, sym_t **symp, ptrdi * since psize(u_long) != psize(u_char) this fails. */ else if (psize(t) != psize(ot)) - return (-1); + return -1; #endif if (conaddr(tn->tn_left, symp, offsp) == -1) - return (-1); + return -1; break; default: - return (-1); + return -1; } - return (0); + return 0; } /* @@ -4014,7 +4015,7 @@ catstrg(strg_t *strg1, strg_t *strg2) if (strg1->st_tspec != strg2->st_tspec) { /* cannot concatenate wide and regular string literals */ error(292); - return (strg1); + return strg1; } len1 = strg1->st_len; @@ -4036,7 +4037,7 @@ catstrg(strg_t *strg1, strg_t *strg2) strg1->st_len = len - 1; /* - NUL */; free(strg2); - return (strg1); + return strg1; } /* Index: src/usr.bin/xlint/lint2/chk.c diff -u src/usr.bin/xlint/lint2/chk.c:1.26 src/usr.bin/xlint/lint2/chk.c:1.27 --- src/usr.bin/xlint/lint2/chk.c:1.26 Mon Dec 28 19:47:42 2020 +++ src/usr.bin/xlint/lint2/chk.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: chk.c,v 1.26 2020/12/28 19:47:42 rillig Exp $ */ +/* $NetBSD: chk.c,v 1.27 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: chk.c,v 1.26 2020/12/28 19:47:42 rillig Exp $"); +__RCSID("$NetBSD: chk.c,v 1.27 2020/12/29 11:35:11 rillig Exp $"); #endif #include <ctype.h> @@ -1232,7 +1232,7 @@ eqtype(type_t *tp1, type_t *tp2, int ign if (asgn && to == PTR) { if (indir == 1 && (t == VOID || tp2->t_tspec == VOID)) - return (1); + return 1; } if (t != tp2->t_tspec) { @@ -1241,16 +1241,16 @@ eqtype(type_t *tp1, type_t *tp2, int ign * signedness a chance if not sflag and not hflag. */ if (sflag || hflag || to != PTR) - return (0); + return 0; if (styp(t) != styp(tp2->t_tspec)) - return (0); + return 0; } if (tp1->t_isenum && tp2->t_isenum) { if (tp1->t_istag && tp2->t_istag) { - return (tp1->t_tag == tp2->t_tag); + return tp1->t_tag == tp2->t_tag; } else if (tp1->t_istynam && tp2->t_istynam) { - return (tp1->t_tynam == tp2->t_tynam); + return tp1->t_tynam == tp2->t_tynam; } else if (tp1->t_isuniqpos && tp2->t_isuniqpos) { return (tp1->t_uniqpos.p_line == tp2->t_uniqpos.p_line && @@ -1259,7 +1259,7 @@ eqtype(type_t *tp1, type_t *tp2, int ign tp1->t_uniqpos.p_uniq == tp2->t_uniqpos.p_uniq); } else { - return (0); + return 0; } } @@ -1270,21 +1270,21 @@ eqtype(type_t *tp1, type_t *tp2, int ign if (asgn && indir == 1) { if (!tp1->t_const && tp2->t_const) - return (0); + return 0; if (!tp1->t_volatile && tp2->t_volatile) - return (0); + return 0; } else if (!ignqual && !tflag) { if (tp1->t_const != tp2->t_const) - return (0); + return 0; if (tp1->t_const != tp2->t_const) - return (0); + return 0; } if (t == STRUCT || t == UNION) { if (tp1->t_istag && tp2->t_istag) { - return (tp1->t_tag == tp2->t_tag); + return tp1->t_tag == tp2->t_tag; } else if (tp1->t_istynam && tp2->t_istynam) { - return (tp1->t_tynam == tp2->t_tynam); + return tp1->t_tynam == tp2->t_tynam; } else if (tp1->t_isuniqpos && tp2->t_isuniqpos) { return (tp1->t_uniqpos.p_line == tp2->t_uniqpos.p_line && @@ -1293,25 +1293,25 @@ eqtype(type_t *tp1, type_t *tp2, int ign tp1->t_uniqpos.p_uniq == tp2->t_uniqpos.p_uniq); } else { - return (0); + return 0; } } if (t == ARRAY && tp1->t_dim != tp2->t_dim) { if (tp1->t_dim != 0 && tp2->t_dim != 0) - return (0); + return 0; } if (t == FUNC) { if (tp1->t_proto && tp2->t_proto) { if (!eqargs(tp1, tp2, dowarn)) - return (0); + return 0; } else if (tp1->t_proto) { if (!mnoarg(tp1, dowarn)) - return (0); + return 0; } else if (tp2->t_proto) { if (!mnoarg(tp2, dowarn)) - return (0); + return 0; } } @@ -1323,7 +1323,7 @@ eqtype(type_t *tp1, type_t *tp2, int ign } - return (tp1 == tp2); + return tp1 == tp2; } /* @@ -1335,7 +1335,7 @@ eqargs(type_t *tp1, type_t *tp2, int *do type_t **a1, **a2; if (tp1->t_vararg != tp2->t_vararg) - return (0); + return 0; a1 = tp1->t_args; a2 = tp2->t_args; @@ -1343,14 +1343,14 @@ eqargs(type_t *tp1, type_t *tp2, int *do while (*a1 != NULL && *a2 != NULL) { if (eqtype(*a1, *a2, 1, 0, 0, dowarn) == 0) - return (0); + return 0; a1++; a2++; } - return (*a1 == *a2); + return *a1 == *a2; } /* @@ -1373,11 +1373,11 @@ mnoarg(type_t *tp, int *dowarn) *dowarn = 1; for (arg = tp->t_args; *arg != NULL; arg++) { if ((t = (*arg)->t_tspec) == FLOAT) - return (0); + return 0; if (t == CHAR || t == SCHAR || t == UCHAR) - return (0); + return 0; if (t == SHORT || t == USHORT) - return (0); + return 0; } - return (1); + return 1; } Index: src/usr.bin/xlint/lint2/emit2.c diff -u src/usr.bin/xlint/lint2/emit2.c:1.13 src/usr.bin/xlint/lint2/emit2.c:1.14 --- src/usr.bin/xlint/lint2/emit2.c:1.13 Fri Sep 26 22:52:24 2008 +++ src/usr.bin/xlint/lint2/emit2.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: emit2.c,v 1.13 2008/09/26 22:52:24 matt Exp $ */ +/* $NetBSD: emit2.c,v 1.14 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -34,7 +34,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: emit2.c,v 1.13 2008/09/26 22:52:24 matt Exp $"); +__RCSID("$NetBSD: emit2.c,v 1.14 2020/12/29 11:35:11 rillig Exp $"); #endif #include "lint2.h" @@ -281,7 +281,7 @@ addoutfile(short num) ofl->ofl_num = num; ofl->ofl_next = NULL; } - return (i); + return i; } static void Index: src/usr.bin/xlint/lint2/hash.c diff -u src/usr.bin/xlint/lint2/hash.c:1.11 src/usr.bin/xlint/lint2/hash.c:1.12 --- src/usr.bin/xlint/lint2/hash.c:1.11 Wed Apr 15 01:20:57 2009 +++ src/usr.bin/xlint/lint2/hash.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.11 2009/04/15 01:20:57 christos Exp $ */ +/* $NetBSD: hash.c,v 1.12 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: hash.c,v 1.11 2009/04/15 01:20:57 christos Exp $"); +__RCSID("$NetBSD: hash.c,v 1.12 2020/12/29 11:35:11 rillig Exp $"); #endif /* @@ -83,7 +83,7 @@ hash(const char *s) v = (v << sizeof (v)) + *us; v ^= v >> (sizeof (v) * CHAR_BIT - sizeof (v)); } - return (v % HSHSIZ2); + return v % HSHSIZ2; } /* @@ -106,7 +106,7 @@ _hsearch(hte_t **table, const char *s, i } if (hte != NULL || !mknew) - return (hte); + return hte; /* create a new hte */ hte = xmalloc(sizeof (hte_t)); @@ -124,7 +124,7 @@ _hsearch(hte_t **table, const char *s, i hte->h_hte = NULL; table[h] = hte; - return (hte); + return hte; } /* Index: src/usr.bin/xlint/lint2/mem2.c diff -u src/usr.bin/xlint/lint2/mem2.c:1.10 src/usr.bin/xlint/lint2/mem2.c:1.11 --- src/usr.bin/xlint/lint2/mem2.c:1.10 Mon Dec 28 19:07:43 2020 +++ src/usr.bin/xlint/lint2/mem2.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mem2.c,v 1.10 2020/12/28 19:07:43 rillig Exp $ */ +/* $NetBSD: mem2.c,v 1.11 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: mem2.c,v 1.10 2020/12/28 19:07:43 rillig Exp $"); +__RCSID("$NetBSD: mem2.c,v 1.11 2020/12/29 11:35:11 rillig Exp $"); #endif #include <sys/param.h> @@ -89,5 +89,5 @@ xalloc(size_t sz) ptr = (char *)mbuf + nxtfree; nxtfree += sz; - return (ptr); + return ptr; } Index: src/usr.bin/xlint/lint2/msg.c diff -u src/usr.bin/xlint/lint2/msg.c:1.12 src/usr.bin/xlint/lint2/msg.c:1.13 --- src/usr.bin/xlint/lint2/msg.c:1.12 Mon Dec 28 19:07:43 2020 +++ src/usr.bin/xlint/lint2/msg.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: msg.c,v 1.12 2020/12/28 19:07:43 rillig Exp $ */ +/* $NetBSD: msg.c,v 1.13 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: msg.c,v 1.12 2020/12/28 19:07:43 rillig Exp $"); +__RCSID("$NetBSD: msg.c,v 1.13 2020/12/29 11:35:11 rillig Exp $"); #endif #include <stdarg.h> @@ -92,7 +92,7 @@ lbasename(const char *path) const char *cp, *cp1, *cp2; if (Fflag) - return (path); + return path; cp = cp1 = cp2 = path; while (*cp != '\0') { @@ -101,7 +101,7 @@ lbasename(const char *path) cp1 = cp; } } - return (*cp1 == '\0' ? cp2 : cp1); + return *cp1 == '\0' ? cp2 : cp1; } /* @@ -137,5 +137,5 @@ mkpos(pos_t *posp) (void)sprintf(buf, "%s", fn); } - return (buf); + return buf; } Index: src/usr.bin/xlint/lint2/read.c diff -u src/usr.bin/xlint/lint2/read.c:1.29 src/usr.bin/xlint/lint2/read.c:1.30 --- src/usr.bin/xlint/lint2/read.c:1.29 Mon Dec 28 19:07:43 2020 +++ src/usr.bin/xlint/lint2/read.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.29 2020/12/28 19:07:43 rillig Exp $ */ +/* $NetBSD: read.c,v 1.30 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: read.c,v 1.29 2020/12/28 19:07:43 rillig Exp $"); +__RCSID("$NetBSD: read.c,v 1.30 2020/12/29 11:35:11 rillig Exp $"); #endif #include <ctype.h> @@ -566,7 +566,7 @@ inptype(const char *cp, const char **epp h = thash(cp, tlen); if ((tidx = findtype(cp, tlen, h)) != 0) { *epp = ep; - return (tidx); + return tidx; } /* No, we must create a new type. */ @@ -739,7 +739,7 @@ inptype(const char *cp, const char **epp } *epp = cp; - return (tidx); + return tidx; } /* @@ -975,7 +975,7 @@ gettlen(const char *cp, const char **epp } *epp = cp; - return (cp - cp1); + return cp - cp1; } /* @@ -990,10 +990,10 @@ findtype(const char *cp, size_t len, int if (strncmp(thte->th_name, cp, len) != 0) continue; if (thte->th_name[len] == '\0') - return (thte->th_idx); + return thte->th_idx; } - return (0); + return 0; } /* @@ -1029,7 +1029,7 @@ storetyp(type_t *tp, const char *cp, siz thte->th_nxt = thtab[h]; thtab[h] = thte; - return ((u_short)tidx++); + return (u_short)tidx++; } /* @@ -1045,7 +1045,7 @@ thash(const char *s, size_t len) v = (v << sizeof (v)) + (u_char)*s++; v ^= v >> (sizeof (v) * CHAR_BIT - sizeof (v)); } - return (v % THSHSIZ2); + return v % THSHSIZ2; } /* @@ -1128,7 +1128,7 @@ inpqstrg(const char *src, const char **e *dst = '\0'; *epp = src; - return (strg); + return strg; } /* @@ -1157,7 +1157,7 @@ inpname(const char *cp, const char **epp buf[i] = '\0'; *epp = cp; - return (buf); + return buf; } /* @@ -1186,7 +1186,7 @@ getfnidx(const char *fn) fnames[i] = xstrdup(fn); flines[i] = 0; - return (i); + return i; } /* Index: src/usr.bin/xlint/xlint/xlint.c diff -u src/usr.bin/xlint/xlint/xlint.c:1.50 src/usr.bin/xlint/xlint/xlint.c:1.51 --- src/usr.bin/xlint/xlint/xlint.c:1.50 Sat May 23 17:28:27 2020 +++ src/usr.bin/xlint/xlint/xlint.c Tue Dec 29 11:35:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xlint.c,v 1.50 2020/05/23 17:28:27 christos Exp $ */ +/* $NetBSD: xlint.c,v 1.51 2020/12/29 11:35:11 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: xlint.c,v 1.50 2020/05/23 17:28:27 christos Exp $"); +__RCSID("$NetBSD: xlint.c,v 1.51 2020/12/29 11:35:11 rillig Exp $"); #endif #include <sys/param.h> @@ -213,7 +213,7 @@ concat2(const char *s1, const char *s2) (void)strcpy(s, s1); (void)strcat(s, s2); - return (s); + return s; } static char * @@ -226,7 +226,7 @@ concat3(const char *s1, const char *s2, (void)strcat(s, s2); (void)strcat(s, s3); - return (s); + return s; } /* @@ -274,7 +274,7 @@ lbasename(const char *strg, int delim) cp1 = cp; } } - return (*cp1 == '\0' ? cp2 : cp1); + return *cp1 == '\0' ? cp2 : cp1; } static void @@ -823,12 +823,12 @@ rdok(const char *path) struct stat sbuf; if (stat(path, &sbuf) == -1) - return (0); + return 0; if (!S_ISREG(sbuf.st_mode)) - return (0); + return 0; if (access(path, R_OK) == -1) - return (0); - return (1); + return 0; + return 1; } static void