tests/lint: demonstrate wrong lint warning about complex variables
This commit is contained in:
parent
3d43236771
commit
80108d8526
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.1038 2021/04/08 22:18:26 rillig Exp $
|
||||
# $NetBSD: mi,v 1.1039 2021/04/09 21:07:39 rillig Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
|
@ -6104,6 +6104,7 @@
|
|||
./usr/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.exp tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/xlint/lint1/d_c99_complex_num.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/xlint/lint1/d_c99_complex_split.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/xlint/lint1/d_c99_complex_split.exp tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt2.c tests-usr.bin-tests compattestfile,atf
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.40 2021/04/08 22:18:27 rillig Exp $
|
||||
# $NetBSD: Makefile,v 1.41 2021/04/09 21:07:39 rillig Exp $
|
||||
|
||||
NOMAN= # defined
|
||||
MAX_MESSAGE= 342 # see lint1/err.c
|
||||
|
@ -22,6 +22,7 @@ FILES+= d_c99_anon_struct.c
|
|||
FILES+= d_c99_anon_union.c
|
||||
FILES+= d_c99_complex_num.c
|
||||
FILES+= d_c99_complex_split.c
|
||||
FILES+= d_c99_complex_split.exp
|
||||
FILES+= d_c99_compound_literal_comma.c
|
||||
FILES+= d_c99_decls_after_stmt.c
|
||||
FILES+= d_c99_decls_after_stmt2.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: d_c99_complex_split.c,v 1.5 2021/03/27 13:59:18 rillig Exp $ */
|
||||
/* $NetBSD: d_c99_complex_split.c,v 1.6 2021/04/09 21:07:39 rillig Exp $ */
|
||||
# 3 "d_c99_complex_split.c"
|
||||
|
||||
/*
|
||||
|
@ -19,3 +19,35 @@ a(void)
|
|||
if (b(__real__ z) && b(__imag__ z))
|
||||
return;
|
||||
}
|
||||
|
||||
void sink(double _Complex);
|
||||
|
||||
void
|
||||
set_complex_complete(double re, double im)
|
||||
{
|
||||
double _Complex c;
|
||||
|
||||
__real__ c = re; /* FIXME *//* expect: may be used before set */
|
||||
__imag__ c = im;
|
||||
sink(c);
|
||||
}
|
||||
|
||||
void
|
||||
set_complex_only_real(double re)
|
||||
{
|
||||
double _Complex c;
|
||||
|
||||
__real__ c = re; /* FIXME *//* expect: may be used before set */
|
||||
/* __imag__ c is left uninitialized */
|
||||
sink(c); /* XXX: may be used before set */
|
||||
}
|
||||
|
||||
void
|
||||
set_complex_only_imag(double im)
|
||||
{
|
||||
double _Complex c;
|
||||
|
||||
/* __real__ c is left uninitialized */
|
||||
__imag__ c = im; /* FIXME *//* expect: may be used before set */
|
||||
sink(c); /* XXX: may be used before set */
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
d_c99_complex_split.c(30): warning: c may be used before set [158]
|
||||
d_c99_complex_split.c(40): warning: c may be used before set [158]
|
||||
d_c99_complex_split.c(51): warning: c may be used before set [158]
|
Loading…
Reference in New Issue