diff options
author | Janis Johnson <janis187@us.ibm.com> | 2006-01-11 21:29:59 +0000 |
---|---|---|
committer | Ben Elliston <bje@gcc.gnu.org> | 2006-01-12 08:29:59 +1100 |
commit | 27a2694fb9683903ed3b1e39066fbd5bc05d6e17 (patch) | |
tree | 9aff0dc626b4d53c1ff32ce6d509433c47ba166d /gcc/testsuite/gcc.dg/format | |
parent | fcfd0ebb149626fe2a44a65b8983c37911140e66 (diff) | |
download | gcc-27a2694fb9683903ed3b1e39066fbd5bc05d6e17.zip gcc-27a2694fb9683903ed3b1e39066fbd5bc05d6e17.tar.gz gcc-27a2694fb9683903ed3b1e39066fbd5bc05d6e17.tar.bz2 |
nodfp-1.c: New test.
* gcc.dg/nodfp-1.c: New test.
* gcc.dg/compat/scalar-return-dfp_x.c: Likewise.
* gcc.dg/compat/scalar-return-dfp_x.c: Likewise.
* gcc.dg/compat/scalar-return-dfp_main.c: Likewise.
* gcc.dg/compat/scalar-by-value-dfp_main.c: Likewise.
* gcc.dg/compat/scalar-by-value-dfp_x.c: Likewise.
* gcc.dg/compat/scalar-return-dfp_y.c: Likewise.
* gcc.dg/compat/scalar-by-value-dfp_y.c: Likewise.
* gcc.dg/debug/dwarf2/dwarf-float.c: Likewise.
* gcc.dg/debug/dwarf2/dwarf-dfp.c: Likewise.
* gcc.dg/format/dfp-scanf-1.c: Likewise.
* gcc.dg/format/dfp-printf-1.c: Likewise.
* gcc.dg/compat/struct-layout-1.exp: Use c-compat.exp.
(compat_setup_dfp): New.
* gcc.dg/compat/compat.exp: Use it.
(compat-use-alt-compiler, compat-use-tst-compiler): Move to new file.
Make some variables global, prepend "compat_" to their names.
* gcc.dg/compat/struct-layout-1.h: Conditional DFP support.
* gcc.dg/compat/struct-layout-1_generate.c: Ditto.
* gcc.misc-tests/dectest.exp: New test driver for decTest.
* lib/compat.exp (compat_skip_list): Make global, rename.
* lib/c-compat.exp: New file.
* lib/target-supports.exp (check_effective_target_dfp): New.
* gcc.dg/dfp/dec-eval-method.c, gcc.dg/dfp/func-array.c,
gcc.dg/dfp/convert-dfp-fold.c, gcc.dg/dfp/struct-union.c,
gcc.dg/dfp/compare-rel.h, gcc.dg/dfp/convert-dfp-round.c,
gcc.dg/dfp/func-struct.c, gcc.dg/dfp/constants-c99.c,
gcc.dg/dfp/compare-eq-d32.c, gcc.dg/dfp/func-vararg-mixed.c,
gcc.dg/dfp/compare-rel-d128.c, gcc.dg/dfp/operator-comma.c,
gcc.dg/dfp/decfloat-constants.c, gcc.dg/dfp/operator-bitwise.c,
gcc.dg/dfp/func-mixed.c, gcc.dg/dfp/compare-eq-dfp.c,
gcc.dg/dfp/operator-assignment.c, gcc.dg/dfp/dfp-round.h,
gcc.dg/dfp/modes.c, gcc.dg/dfp/keywords-c99.c, gcc.dg/dfp/nan-1.c,
gcc.dg/dfp/loop-index.c, gcc.dg/dfp/compare-eq-d64.c,
gcc.dg/dfp/convert-bfp.c, gcc.dg/dfp/usual-arith-conv-const.c,
gcc.dg/dfp/convert-dfp.c, gcc.dg/dfp/compare-rel-const.c,
gcc.dg/dfp/convert-int-fold.c, gcc.dg/dfp/keywords-pedantic.c,
gcc.dg/dfp/compare-rel-d32.c, gcc.dg/dfp/call-by-value.c,
gcc.dg/dfp/constants-hex.c, gcc.dg/dfp/func-scalar.c,
gcc.dg/dfp/keywords-ignored-c99.c, gcc.dg/dfp/snan.c,
gcc.dg/dfp/usual-arith-conv.c, gcc.dg/dfp/constants-pedantic.c,
gcc.dg/dfp/operator-logical.c, gcc.dg/dfp/compare-eq-d128.c,
gcc.dg/dfp/convert-bfp-fold.c, gcc.dg/dfp/ctypes.c,
gcc.dg/dfp/convert-int.c, gcc.dg/dfp/keywords-c89.c,
gcc.dg/dfp/constants.c, gcc.dg/dfp/compare-rel-dfp.c,
gcc.dg/dfp/compare-eq-const.c, gcc.dg/dfp/cast-bad.c,
gcc.dg/dfp/operator-arith-fold.c, gcc.dg/dfp/union-init.c,
gcc.dg/dfp/struct-layout-1.c,
gcc.dg/dfp/compare-eq.hgcc.dg/dfp/convert-int-saturate.c,
gcc.dg/dfp/compare-rel-d64.c, gcc.dg/dfp/func-vararg-size0.c,
gcc.dg/dfp/Wconversion-2.c, gcc.dg/dfp/nan-2.c,
gcc.dg/dfp/operator-cond.c, gcc.dg/dfp/composite-type.c,
gcc.dg/dfp/func-vararg-dfp.c,
gcc.dg/dfp/dfp.expgcc.dg/dfp/keywords-reserved.c,
gcc.dg/dfp/convert-complex.c, gcc.dg/dfp/Wbad-function-cast-1.c,
gcc.dg/dfp/operator-unary.c, gcc.dg/dfp/altivec-types.c,
gcc.dg/dfp/cast.c, gcc.dg/dfp/typespec.c,
gcc.dg/dfp/wtr-conversion-1.c: New tests.
Co-Authored-By: Ben Elliston <bje@au.ibm.com>
Co-Authored-By: Jon Grimm <jgrimm2@us.ibm.com>
Co-Authored-By: Yao Qi <qiyaoltc@cn.ibm.com>
From-SVN: r109604
Diffstat (limited to 'gcc/testsuite/gcc.dg/format')
-rw-r--r-- | gcc/testsuite/gcc.dg/format/dfp-printf-1.c | 122 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/format/dfp-scanf-1.c | 99 |
2 files changed, 221 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/dfp-printf-1.c b/gcc/testsuite/gcc.dg/format/dfp-printf-1.c new file mode 100644 index 0000000..505e4c7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/dfp-printf-1.c @@ -0,0 +1,122 @@ +/* Test for printf formats for Decimal Floating Point types. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target dfp } */ +/* { dg-options "-Wformat" } */ + +extern int printf (const char *restrict, ...); + +void +foo (_Decimal32 x, _Decimal64 y, _Decimal128 z, int i, unsigned int j, + double d, char *p) +{ + /* See ISO/IEC DTR 24732 subclause 9.3 (currently Working Draft 5 from + 2005-03-06). */ + /* Formatted input/output specifiers. */ + + /* Check lack of warnings for valid usage. */ + + printf ("%Hf\n", x); + printf ("%HF\n", x); + printf ("%He\n", x); + printf ("%HE\n", x); + printf ("%Hg\n", x); + printf ("%HG\n", x); + + printf ("%Df\n", y); + printf ("%DF\n", y); + printf ("%De\n", y); + printf ("%DE\n", y); + printf ("%Dg\n", y); + printf ("%DG\n", y); + + printf ("%DDf\n", z); + printf ("%DDF\n", z); + printf ("%DDe\n", z); + printf ("%DDE\n", z); + printf ("%DDg\n", z); + printf ("%DDG\n", z); + + printf ("%DG%DDE%HF%DDe%He%HE%DF%DDF%De%DDG%HG%Df%Hg%DE%DDf%Dg%DDg%Hf\n", + y, z, x, z, x, x, y, z, y, z, x, y, x, y, z, y, z, x); + + /* Check warnings for type mismatches. */ + + printf ("%Hf\n", y); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%HF\n", y); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%He\n", y); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%HE\n", y); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%Hg\n", y); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%HG\n", y); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%Hf\n", z); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%HF\n", z); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%He\n", z); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%HE\n", z); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%Hg\n", z); /* { dg-warning "expects type" "bad use of %H" } */ + printf ("%HG\n", z); /* { dg-warning "expects type" "bad use of %H" } */ + + printf ("%Df\n", x); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%DF\n", x); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%De\n", x); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%DE\n", x); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%Dg\n", x); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%DG\n", x); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%Df\n", z); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%DF\n", z); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%De\n", z); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%DE\n", z); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%Dg\n", z); /* { dg-warning "expects type" "bad use of %D" } */ + printf ("%DG\n", z); /* { dg-warning "expects type" "bad use of %D" } */ + + printf ("%DDf\n", x); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDF\n", x); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDe\n", x); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDE\n", x); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDg\n", x); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDG\n", x); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDf\n", y); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDF\n", y); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDe\n", y); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDE\n", y); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDg\n", y); /* { dg-warning "expects type" "bad use of %DD" } */ + printf ("%DDG\n", y); /* { dg-warning "expects type" "bad use of %DD" } */ + + /* Check for warnings for bad use of H, D, and DD length specifiers. */ + + printf ("%Hd\n", i); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Hi\n", i); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Ho\n", j); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Hu\n", j); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Hx\n", j); /* { dg-warning "length" "bad use of %H" } */ + printf ("%HX\n", j); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Ha\n", d); /* { dg-warning "length" "bad use of %H" } */ + printf ("%HA\n", d); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Hc\n", i); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Hs\n", p); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Hp\n", p); /* { dg-warning "length" "bad use of %H" } */ + printf ("%Hn\n", p); /* { dg-warning "length" "bad use of %H" } */ + + /* Sanity checks for flags, field width, and precision in formats for + DFP types. */ + + printf ("%-Hf\n", x); + printf ("%+HF\n", x); + printf ("% He\n", x); + printf ("%#HE\n", x); + printf ("%0Hg\n", x); + printf ("%#0HG\n", x); + + printf ("%0#Df\n", y); + printf ("%0DF\n", y); + printf ("%#De\n", y); + printf ("%-#DE\n", y); + printf ("%-#0Dg\n", y); /* { dg-warning "flag ignored" "ignore flag" } */ + printf ("%0+ DG\n", y); /* { dg-warning "flag ignored" "ignore flag" } */ + + printf ("%DDf\n", z); + printf ("%0DDF\n", z); + printf ("%#0DDe\n", z); + printf ("%+DDE\n", z); + printf ("%0-#DDg\n", z); /* { dg-warning "flag ignored" "ignore flag" } */ + printf ("% DDG\n", z); +} diff --git a/gcc/testsuite/gcc.dg/format/dfp-scanf-1.c b/gcc/testsuite/gcc.dg/format/dfp-scanf-1.c new file mode 100644 index 0000000..6b010a4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/dfp-scanf-1.c @@ -0,0 +1,99 @@ +/* Test for scanf formats for Decimal Floating Point types. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target dfp } */ +/* { dg-options "-Wformat" } */ + + +#include "format.h" + +void +voo (_Decimal32 *x, _Decimal64 *y, _Decimal128 *z, int *i, unsigned int *j, + double *d, char **p) +{ + /* See ISO/IEC DTR 24732 subclause 9.3 (currently Working Draft 5 from + 2005-03-06). */ + /* Formatted input/output specifiers. */ + + /* Check lack of warnings for valid usage. */ + + scanf ("%Hf", x); + scanf ("%HF", x); + scanf ("%He", x); + scanf ("%HE", x); + scanf ("%Hg", x); + scanf ("%HG", x); + + scanf ("%Df", y); + scanf ("%DF", y); + scanf ("%De", y); + scanf ("%DE", y); + scanf ("%Dg", y); + scanf ("%DG", y); + + scanf ("%DDf", z); + scanf ("%DDF", z); + scanf ("%DDe", z); + scanf ("%DDE", z); + scanf ("%DDg", z); + scanf ("%DDG", z); + + scanf ("%DG%DDE%HF%DDe%He%HE%DF%DDF%De%DDG%HG%Df%Hg%DE%DDf%Dg%DDg%Hf\n", + y, z, x, z, x, x, y, z, y, z, x, y, x, y, z, y, z, x); + + /* Check warnings for type mismatches. */ + + scanf ("%Hf", y); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%HF", y); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%He", y); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%HE", y); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%Hg", y); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%HG", y); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%Hf", z); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%HF", z); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%He", z); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%HE", z); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%Hg", z); /* { dg-warning "expects type" "bad use of %H" } */ + scanf ("%HG", z); /* { dg-warning "expects type" "bad use of %H" } */ + + scanf ("%Df", x); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%DF", x); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%De", x); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%DE", x); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%Dg", x); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%DG", x); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%Df", z); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%DF", z); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%De", z); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%DE", z); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%Dg", z); /* { dg-warning "expects type" "bad use of %D" } */ + scanf ("%DG", z); /* { dg-warning "expects type" "bad use of %D" } */ + + scanf ("%DDf", x); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDF", x); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDe", x); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDE", x); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDg", x); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDG", x); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDf", y); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDF", y); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDe", y); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDE", y); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDg", y); /* { dg-warning "expects type" "bad use of %DD" } */ + scanf ("%DDG", y); /* { dg-warning "expects type" "bad use of %DD" } */ + + /* Check for warnings for bad use of H, D, and DD length specifiers. */ + + scanf ("%Hd\n", i); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Hi\n", i); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Ho\n", j); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Hu\n", j); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Hx\n", j); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%HX\n", j); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Ha\n", d); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%HA\n", d); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Hc\n", i); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Hs\n", p); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Hp\n", p); /* { dg-warning "length" "bad use of %H" } */ + scanf ("%Hn\n", p); /* { dg-warning "length" "bad use of %H" } */ +} |