Module Name: src Committed By: rillig Date: Mon Feb 7 21:57:47 UTC 2022
Modified Files: src/usr.bin/xlint: Makefile.inc src/usr.bin/xlint/common: lint.h src/usr.bin/xlint/lint1: lint1.h src/usr.bin/xlint/lint2: lint2.h Log Message: lint: drop compatibility with C90 Since tools/README 1.5 from 2022-02-03, the tools no longer need to be compatible with C90, they may now use C99 features. Lint had used <stdbool.h> and snprintf already. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/Makefile.inc cvs rdiff -u -r1.34 -r1.35 src/usr.bin/xlint/common/lint.h cvs rdiff -u -r1.134 -r1.135 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/lint2.h 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/Makefile.inc diff -u src/usr.bin/xlint/Makefile.inc:1.17 src/usr.bin/xlint/Makefile.inc:1.18 --- src/usr.bin/xlint/Makefile.inc:1.17 Mon Nov 1 19:48:51 2021 +++ src/usr.bin/xlint/Makefile.inc Mon Feb 7 21:57:47 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.17 2021/11/01 19:48:51 rillig Exp $ +# $NetBSD: Makefile.inc,v 1.18 2022/02/07 21:57:47 rillig Exp $ .include <bsd.own.mk> @@ -16,8 +16,6 @@ ARCHSUBDIR= ${MACHINE_CPU} CPPFLAGS+= -I${.CURDIR}/../arch/${ARCHSUBDIR} CPPFLAGS+= -I${.CURDIR}/../common -CWARNFLAGS.gcc+=-Wdeclaration-after-statement # see tools/README -CWARNFLAGS.gcc+=-std=c90 # see tools/README CLEANFILES+= *.gcno *.gcda *.gcov Index: src/usr.bin/xlint/common/lint.h diff -u src/usr.bin/xlint/common/lint.h:1.34 src/usr.bin/xlint/common/lint.h:1.35 --- src/usr.bin/xlint/common/lint.h:1.34 Wed Dec 22 14:49:11 2021 +++ src/usr.bin/xlint/common/lint.h Mon Feb 7 21:57:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: lint.h,v 1.34 2021/12/22 14:49:11 rillig Exp $ */ +/* $NetBSD: lint.h,v 1.35 2022/02/07 21:57:47 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -149,21 +149,13 @@ typedef struct lint2_type type_t; #include "externs.h" -#if __STDC_VERSION__ >= 199901L -#define INLINE_FUNC static inline -#elif __GNUC__ -#define INLINE_FUNC static __attribute__((__unused__)) -#else -#define INLINE_FUNC static -#endif - -INLINE_FUNC bool +static inline bool ch_isalnum(char ch) { return isalnum((unsigned char)ch) != 0; } -INLINE_FUNC bool +static inline bool ch_isdigit(char ch) { return isdigit((unsigned char)ch) != 0; } -INLINE_FUNC bool +static inline bool ch_isprint(char ch) { return isprint((unsigned char)ch) != 0; } -INLINE_FUNC bool +static inline bool ch_isspace(char ch) { return isspace((unsigned char)ch) != 0; } -INLINE_FUNC bool +static inline bool ch_isupper(char ch) { return isupper((unsigned char)ch) != 0; } Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.134 src/usr.bin/xlint/lint1/lint1.h:1.135 --- src/usr.bin/xlint/lint1/lint1.h:1.134 Sat Dec 25 13:51:42 2021 +++ src/usr.bin/xlint/lint1/lint1.h Mon Feb 7 21:57:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.134 2021/12/25 13:51:42 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.135 2022/02/07 21:57:47 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -498,7 +498,7 @@ extern err_set msgset; # include "err-msgs.h" /* ARGSUSED */ -INLINE_FUNC void __attribute__((format(printf, 1, 2))) +static inline void __attribute__((format(printf, 1, 2))) check_printf(const char *fmt, ...) { } @@ -529,7 +529,7 @@ check_printf(const char *fmt, ...) # define c11ism(msgid, args...) wrap_check_printf(c11ism, msgid, ##args) #endif -INLINE_FUNC bool +static inline bool is_nonzero_val(const val_t *val) { return is_floating(val->v_tspec) @@ -537,7 +537,7 @@ is_nonzero_val(const val_t *val) : val->v_quad != 0; } -INLINE_FUNC bool +static inline bool constant_is_nonzero(const tnode_t *tn) { lint_assert(tn->tn_op == CON); @@ -545,25 +545,25 @@ constant_is_nonzero(const tnode_t *tn) return is_nonzero_val(tn->tn_val); } -INLINE_FUNC bool +static inline bool is_zero(const tnode_t *tn) { return tn != NULL && tn->tn_op == CON && !is_nonzero_val(tn->tn_val); } -INLINE_FUNC bool +static inline bool is_nonzero(const tnode_t *tn) { return tn != NULL && tn->tn_op == CON && is_nonzero_val(tn->tn_val); } -INLINE_FUNC bool +static inline bool is_binary(const tnode_t *tn) { return modtab[tn->tn_op].m_binary; } -INLINE_FUNC uint64_t +static inline uint64_t bit(unsigned i) { /* @@ -577,13 +577,13 @@ bit(unsigned i) return (uint64_t)1 << i; } -INLINE_FUNC bool +static inline bool msb(int64_t q, tspec_t t) { return (q & bit((unsigned int)size_in_bits(t) - 1)) != 0; } -INLINE_FUNC uint64_t +static inline uint64_t value_bits(unsigned bitsize) { lint_assert(bitsize > 0); @@ -601,7 +601,7 @@ value_bits(unsigned bitsize) } /* C99 6.7.8p7 */ -INLINE_FUNC bool +static inline bool is_struct_or_union(tspec_t t) { return t == STRUCT || t == UNION; Index: src/usr.bin/xlint/lint2/lint2.h diff -u src/usr.bin/xlint/lint2/lint2.h:1.21 src/usr.bin/xlint/lint2/lint2.h:1.22 --- src/usr.bin/xlint/lint2/lint2.h:1.21 Wed Dec 22 14:49:11 2021 +++ src/usr.bin/xlint/lint2/lint2.h Mon Feb 7 21:57:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: lint2.h,v 1.21 2021/12/22 14:49:11 rillig Exp $ */ +/* $NetBSD: lint2.h,v 1.22 2022/02/07 21:57:47 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -186,7 +186,7 @@ typedef struct hte { #include "externs2.h" /* maps type indices into pointers to type structs */ -INLINE_FUNC type_t * +static inline type_t * TP(unsigned short type_id) { /* force sequence point for newly parsed type_id */ return tlst[type_id];