Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint lint: drop compatibility with C90



details:   https://anonhg.NetBSD.org/src/rev/31f9e032d631
branches:  trunk
changeset: 360003:31f9e032d631
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Feb 07 21:57:47 2022 +0000

description:
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.

diffstat:

 usr.bin/xlint/Makefile.inc  |   4 +---
 usr.bin/xlint/common/lint.h |  20 ++++++--------------
 usr.bin/xlint/lint1/lint1.h |  22 +++++++++++-----------
 usr.bin/xlint/lint2/lint2.h |   4 ++--
 4 files changed, 20 insertions(+), 30 deletions(-)

diffs (163 lines):

diff -r 5df3deab3e3d -r 31f9e032d631 usr.bin/xlint/Makefile.inc
--- a/usr.bin/xlint/Makefile.inc        Mon Feb 07 09:50:05 2022 +0000
+++ b/usr.bin/xlint/Makefile.inc        Mon Feb 07 21:57:47 2022 +0000
@@ -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 @@
 
 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
 
diff -r 5df3deab3e3d -r 31f9e032d631 usr.bin/xlint/common/lint.h
--- a/usr.bin/xlint/common/lint.h       Mon Feb 07 09:50:05 2022 +0000
+++ b/usr.bin/xlint/common/lint.h       Mon Feb 07 21:57:47 2022 +0000
@@ -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 @@
 
 #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; }
diff -r 5df3deab3e3d -r 31f9e032d631 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Mon Feb 07 09:50:05 2022 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Mon Feb 07 21:57:47 2022 +0000
@@ -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 @@
 #  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 @@
 #  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 @@
            : 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 @@
        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 @@
        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 @@
 }
 
 /* C99 6.7.8p7 */
-INLINE_FUNC bool
+static inline bool
 is_struct_or_union(tspec_t t)
 {
        return t == STRUCT || t == UNION;
diff -r 5df3deab3e3d -r 31f9e032d631 usr.bin/xlint/lint2/lint2.h
--- a/usr.bin/xlint/lint2/lint2.h       Mon Feb 07 09:50:05 2022 +0000
+++ b/usr.bin/xlint/lint2/lint2.h       Mon Feb 07 21:57:47 2022 +0000
@@ -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 @@
 #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];



Home | Main Index | Thread Index | Old Index