Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 lint: fix wrong warning about initializa...
details: https://anonhg.NetBSD.org/src/rev/6089cd7e26c2
branches: trunk
changeset: 981867:6089cd7e26c2
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Mar 23 22:58:08 2021 +0000
description:
lint: fix wrong warning about initialization using string literal
Missing braces after 'if', since init.c 1.68 from 2021-02-20.
GCC 10 doesn't complain about this even with -Wmisleading-indentation
since at least one of the involved lines is a macro invocation (in this
case both lines). GCC 11 will warn about this.
Clang warns about this, but the regular Clang build currently fails for
other reasons, so this problem didn't show up there either.
diffstat:
tests/usr.bin/xlint/lint1/d_init_array_using_string.c | 6 +++---
tests/usr.bin/xlint/lint1/d_init_array_using_string.exp | 2 --
usr.bin/xlint/lint1/init.c | 7 ++++---
3 files changed, 7 insertions(+), 8 deletions(-)
diffs (58 lines):
diff -r 92df26029257 -r 6089cd7e26c2 tests/usr.bin/xlint/lint1/d_init_array_using_string.c
--- a/tests/usr.bin/xlint/lint1/d_init_array_using_string.c Tue Mar 23 22:27:38 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_init_array_using_string.c Tue Mar 23 22:58:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_init_array_using_string.c,v 1.1 2021/03/23 21:19:08 rillig Exp $ */
+/* $NetBSD: d_init_array_using_string.c,v 1.2 2021/03/23 22:58:08 rillig Exp $ */
# 3 "d_init_array_using_string.c"
/*
@@ -71,7 +71,7 @@
};
struct cs_ws extra_braces = {
- { "" }, /* expect: illegal combination *//*FIXME*/
- { L"" }, /* expect: illegal combination *//*FIXME*/
+ { "" },
+ { L"" },
};
}
diff -r 92df26029257 -r 6089cd7e26c2 tests/usr.bin/xlint/lint1/d_init_array_using_string.exp
--- a/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp Tue Mar 23 22:27:38 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_init_array_using_string.exp Tue Mar 23 22:58:08 2021 +0000
@@ -6,5 +6,3 @@
d_init_array_using_string.c(60): warning: illegal combination of integer (char) and pointer (pointer to char) [183]
d_init_array_using_string.c(69): warning: non-null byte ignored in string initializer [187]
d_init_array_using_string.c(70): warning: non-null byte ignored in string initializer [187]
-d_init_array_using_string.c(74): warning: illegal combination of integer (char) and pointer (pointer to char) [183]
-d_init_array_using_string.c(75): warning: illegal combination of integer (int) and pointer (pointer to int) [183]
diff -r 92df26029257 -r 6089cd7e26c2 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c Tue Mar 23 22:27:38 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c Tue Mar 23 22:58:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.114 2021/03/23 20:21:07 rillig Exp $ */
+/* $NetBSD: init.c,v 1.115 2021/03/23 22:58:08 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.114 2021/03/23 20:21:07 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.115 2021/03/23 22:58:08 rillig Exp $");
#endif
#include <stdlib.h>
@@ -1128,9 +1128,10 @@
* If the array is already partly initialized, we are
* wrong here.
*/
- if (istk->i_remaining != istk->i_type->t_dim)
+ if (istk->i_remaining != istk->i_type->t_dim) {
debug_leave();
return false;
+ }
} else {
debug_leave();
return false;
Home |
Main Index |
Thread Index |
Old Index