lint: require C11 for _Generic
This does not have any effect in practice since the option -g (originally meant for GCC extensions to the C standards) implicitly allows all features from C11, since err.c 1.111 from 2021-04-14. Since the default lint flags for NetBSD builds include the option -g, this allows all C11 features. Currently it is not possible to say "allow GNU extensions but not C11".
This commit is contained in:
parent
7725923054
commit
cec0b2453a
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: mi,v 1.1066 2021/06/27 18:48:45 rillig Exp $
|
# $NetBSD: mi,v 1.1067 2021/06/27 19:10:29 rillig Exp $
|
||||||
#
|
#
|
||||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||||
#
|
#
|
||||||
|
@ -6924,6 +6924,8 @@
|
||||||
./usr/tests/usr.bin/xlint/lint1/msg_343.exp tests-usr.bin-tests compattestfile,atf
|
./usr/tests/usr.bin/xlint/lint1/msg_343.exp tests-usr.bin-tests compattestfile,atf
|
||||||
./usr/tests/usr.bin/xlint/lint1/msg_344.c tests-usr.bin-tests compattestfile,atf
|
./usr/tests/usr.bin/xlint/lint1/msg_344.c tests-usr.bin-tests compattestfile,atf
|
||||||
./usr/tests/usr.bin/xlint/lint1/msg_344.exp tests-usr.bin-tests compattestfile,atf
|
./usr/tests/usr.bin/xlint/lint1/msg_344.exp tests-usr.bin-tests compattestfile,atf
|
||||||
|
./usr/tests/usr.bin/xlint/lint1/msg_345.c tests-usr.bin-tests compattestfile,atf
|
||||||
|
./usr/tests/usr.bin/xlint/lint1/msg_345.exp tests-usr.bin-tests compattestfile,atf
|
||||||
./usr/tests/usr.bin/xlint/lint1/op_colon.c tests-usr.bin-tests compattestfile,atf
|
./usr/tests/usr.bin/xlint/lint1/op_colon.c tests-usr.bin-tests compattestfile,atf
|
||||||
./usr/tests/usr.bin/xlint/lint1/op_colon.exp tests-usr.bin-tests compattestfile,atf
|
./usr/tests/usr.bin/xlint/lint1/op_colon.exp tests-usr.bin-tests compattestfile,atf
|
||||||
./usr/tests/usr.bin/xlint/lint1/stmt_for.c tests-usr.bin-tests compattestfile,atf
|
./usr/tests/usr.bin/xlint/lint1/stmt_for.c tests-usr.bin-tests compattestfile,atf
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# $NetBSD: Makefile,v 1.67 2021/06/27 18:48:45 rillig Exp $
|
# $NetBSD: Makefile,v 1.68 2021/06/27 19:10:29 rillig Exp $
|
||||||
|
|
||||||
NOMAN= # defined
|
NOMAN= # defined
|
||||||
MAX_MESSAGE= 344 # see lint1/err.c
|
MAX_MESSAGE= 345 # see lint1/err.c
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
/* $NetBSD: msg_345.c,v 1.1 2021/06/27 19:10:29 rillig Exp $ */
|
||||||
|
# 3 "msg_345.c"
|
||||||
|
|
||||||
|
// Test for message: generic selection requires C11 or later [345]
|
||||||
|
|
||||||
|
/* Omit flag -g since it silences c11ism. */
|
||||||
|
/* lint1-flags: -Sw */
|
||||||
|
|
||||||
|
int
|
||||||
|
test(int x)
|
||||||
|
{
|
||||||
|
/* expect+1: generic selection requires C11 or later [345] */
|
||||||
|
return _Generic(x, default: 3);
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
msg_345.c(13): error: generic selection requires C11 or later [345]
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: t_integration.sh,v 1.60 2021/06/27 18:48:45 rillig Exp $
|
# $NetBSD: t_integration.sh,v 1.61 2021/06/27 19:10:29 rillig Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
|
# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -211,7 +211,7 @@ all_messages_body()
|
||||||
|
|
||||||
failed=""
|
failed=""
|
||||||
|
|
||||||
for msg in $(seq 0 344); do
|
for msg in $(seq 0 345); do
|
||||||
name="$(printf 'msg_%03d.c' "$msg")"
|
name="$(printf 'msg_%03d.c' "$msg")"
|
||||||
check_lint1 "$name" \
|
check_lint1 "$name" \
|
||||||
|| failed="$failed${failed:+ }$name"
|
|| failed="$failed${failed:+ }$name"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%{
|
%{
|
||||||
/* $NetBSD: cgram.y,v 1.235 2021/06/27 18:54:14 rillig Exp $ */
|
/* $NetBSD: cgram.y,v 1.236 2021/06/27 19:10:29 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: cgram.y,v 1.235 2021/06/27 18:54:14 rillig Exp $");
|
__RCSID("$NetBSD: cgram.y,v 1.236 2021/06/27 19:10:29 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -1683,6 +1683,8 @@ switch_expr:
|
||||||
/* TODO: c11ism */
|
/* TODO: c11ism */
|
||||||
generic_selection: /* C11 6.5.1.1 */
|
generic_selection: /* C11 6.5.1.1 */
|
||||||
T_GENERIC T_LPAREN expr T_COMMA generic_assoc_list T_RPAREN {
|
T_GENERIC T_LPAREN expr T_COMMA generic_assoc_list T_RPAREN {
|
||||||
|
/* generic selection requires C11 or later */
|
||||||
|
c11ism(345);
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: err.c,v 1.119 2021/05/16 11:11:36 rillig Exp $ */
|
/* $NetBSD: err.c,v 1.120 2021/06/27 19:10:29 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(__RCSID) && !defined(lint)
|
#if defined(__RCSID) && !defined(lint)
|
||||||
__RCSID("$NetBSD: err.c,v 1.119 2021/05/16 11:11:36 rillig Exp $");
|
__RCSID("$NetBSD: err.c,v 1.120 2021/06/27 19:10:29 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -399,6 +399,7 @@ const char *const msgs[] = {
|
||||||
"argument to '%s' must be cast to 'unsigned char', not to '%s'", /* 342 */
|
"argument to '%s' must be cast to 'unsigned char', not to '%s'", /* 342 */
|
||||||
"static array size is a C11 extension", /* 343 */
|
"static array size is a C11 extension", /* 343 */
|
||||||
"bit-field of type plain 'int' has implementation-defined signedness", /* 344 */
|
"bit-field of type plain 'int' has implementation-defined signedness", /* 344 */
|
||||||
|
"generic selection requires C11 or later", /* 345 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct include_level {
|
static struct include_level {
|
||||||
|
|
Loading…
Reference in New Issue