Commit 7ad99f7d by Roman Zhuykov Committed by Jeff Law

opts-common.c (integral_argument): Set errno properly in one case.

    * opts-common.c (integral_argument): Set errno properly in one case.

    * gcc.dg/diag-sanity.c: New test.

From-SVN: r270022
parent c072398e
2019-03-29 Roman Zhuykov <zhroma@ispras.ru>
* opts-common.c (integral_argument): Set errno properly in one case.
2019-03-29 Martin Liska <mliska@suse.cz> 2019-03-29 Martin Liska <mliska@suse.cz>
* doc/invoke.texi: Remove -Wchkp from documentation. * doc/invoke.texi: Remove -Wchkp from documentation.
......
...@@ -205,8 +205,10 @@ integral_argument (const char *arg, int *err, bool byte_size_suffix) ...@@ -205,8 +205,10 @@ integral_argument (const char *arg, int *err, bool byte_size_suffix)
value = strtoull (arg, &end, 0); value = strtoull (arg, &end, 0);
if (*end) if (*end)
{ {
/* errno is most likely EINVAL here. */ if (errno)
*err = errno; *err = errno;
else
*err = EINVAL;
return -1; return -1;
} }
......
2019-03-29 Roman Zhuykov <zhroma@ispras.ru>
* gcc.dg/diag-sanity.c: New test.
2019-03-29 Marek Polacek <polacek@redhat.com> 2019-03-29 Marek Polacek <polacek@redhat.com>
PR c++/89871 PR c++/89871
......
/* Verify that an invalid argument is diagnosed correcly.
{ dg-do compile }
{ dg-options "-fdiagnostics-minimum-margin-width=42xyz -flto-compression-level=2-O2" } */
/* { dg-error "argument to '-fdiagnostics-minimum-margin-width=' should be a non-negative integer" "" { target *-*-* } 0 }
{ dg-error "argument to '-flto-compression-level=' should be a non-negative integer" "" { target *-*-* } 0 } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment