From: Martin Sebor Date: Thu, 9 Jun 2016 16:32:25 +0000 (+0000) Subject: PR c/70883 - inconsistent error message for calls to __builtin_add_overflow X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e01b4e16930ba0183bff94c88bce20501af8bbe4;p=gcc.git PR c/70883 - inconsistent error message for calls to __builtin_add_overflow PR c/70883 - inconsistent error message for calls to __builtin_add_overflow with too few arguments gcc/c-family/ChangeLog: 2016-06-09 Martin Sebor PR c/70883 * c-common.c (builtin_function_validate_nargs): Make text of error message consistent with others like it. gcc/testsuite/ChangeLog: 2016-06-09 Martin Sebor PR c/70883 * c-c++-common/builtin-arith-overflow-1.c: Adjust diagnostic text. * gcc.dg/builtin-constant_p-1.c: Same. * gcc.dg/builtins-error.c: Same. * gcc.dg/pr70859.c: Same. From-SVN: r237268 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 5ebeaf90ff5..23ff800e41f 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2016-06-09 Martin Sebor + + PR c/70883 + * c-common.c (builtin_function_validate_nargs): Make text of error + message consistent with others like it. + 2016-06-08 Martin Sebor Jakub Jelinek diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index d008b040d0d..94005ff8260 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -9828,7 +9828,7 @@ builtin_function_validate_nargs (location_t loc, tree fndecl, int nargs, { if (nargs < required) { - error_at (loc, "not enough arguments to function %qE", fndecl); + error_at (loc, "too few arguments to function %qE", fndecl); return false; } else if (nargs > required) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6e792aad5ef..9ae6294a1ce 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2016-06-09 Martin Sebor + + PR c/70883 + * c-c++-common/builtin-arith-overflow-1.c: Adjust diagnostic text. + * gcc.dg/builtin-constant_p-1.c: Same. + * gcc.dg/builtins-error.c: Same. + * gcc.dg/pr70859.c: Same. + 2016-06-09 Senthil Kumar Selvaraj * gcc.c-torture/execute/bswap-2.c: Require int32plus. diff --git a/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c b/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c index 0d97f6a9fad..3332c4ec44d 100644 --- a/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c +++ b/gcc/testsuite/c-c++-common/builtin-arith-overflow-1.c @@ -3,12 +3,12 @@ int f1 (void) { - int x = __builtin_add_overflow (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_sub_overflow (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_mul_overflow (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_add_overflow_p (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_sub_overflow_p (); /* { dg-error "not enough arguments to function" } */ - x += __builtin_mul_overflow_p (); /* { dg-error "not enough arguments to function" } */ + int x = __builtin_add_overflow (); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow (); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow (); /* { dg-error "too few arguments to function" } */ + x += __builtin_add_overflow_p (); /* { dg-error "too few arguments to function" } */ + x += __builtin_sub_overflow_p (); /* { dg-error "too few arguments to function" } */ + x += __builtin_mul_overflow_p (); /* { dg-error "too few arguments to function" } */ return x; } @@ -21,7 +21,7 @@ f2 (int a, int b, int *c, int d) x += __builtin_add_overflow_p (a, b, d, d); /* { dg-error "too many arguments to function" } */ x += __builtin_sub_overflow_p (a, b, d, d, 1, d); /* { dg-error "too many arguments to function" } */ x += __builtin_mul_overflow_p (a, b, d, d); /* { dg-error "too many arguments to function" } */ - + return x; } diff --git a/gcc/testsuite/gcc.dg/builtin-constant_p-1.c b/gcc/testsuite/gcc.dg/builtin-constant_p-1.c index b0b34f4a1e1..f177fe34b2c 100644 --- a/gcc/testsuite/gcc.dg/builtin-constant_p-1.c +++ b/gcc/testsuite/gcc.dg/builtin-constant_p-1.c @@ -2,9 +2,9 @@ int main() { - if (__builtin_constant_p ()) /* { dg-error "not enough" } */ + if (__builtin_constant_p ()) /* { dg-error "too few arguments" } */ return 0; - if (__builtin_constant_p (5, 6)) /* { dg-error "too many" } */ + if (__builtin_constant_p (5, 6)) /* { dg-error "too many arguments" } */ return 1; return 0; } diff --git a/gcc/testsuite/gcc.dg/builtins-error.c b/gcc/testsuite/gcc.dg/builtins-error.c index 9ddf1b1e2ae..945d239d608 100644 --- a/gcc/testsuite/gcc.dg/builtins-error.c +++ b/gcc/testsuite/gcc.dg/builtins-error.c @@ -23,19 +23,19 @@ int test1(struct X x) int test2(double x) { - if (x == 1) return __builtin_fpclassify(1,2,3,4,5); /* { dg-error "not enough arguments" } */ - if (x == 2) return __builtin_isfinite(); /* { dg-error "not enough arguments" } */ - if (x == 3) return __builtin_isinf_sign(); /* { dg-error "not enough arguments" } */ - if (x == 4) return __builtin_isinf(); /* { dg-error "not enough arguments" } */ - if (x == 5) return __builtin_isnan(); /* { dg-error "not enough arguments" } */ - if (x == 6) return __builtin_isnormal(); /* { dg-error "not enough arguments" } */ - if (x == 7) return __builtin_isgreater(x); /* { dg-error "not enough arguments" } */ - if (x == 8) return __builtin_isgreaterequal(x); /* { dg-error "not enough arguments" } */ - if (x == 9) return __builtin_isless(x); /* { dg-error "not enough arguments" } */ - if (x == 10) return __builtin_islessequal(x); /* { dg-error "not enough arguments" } */ - if (x == 11) return __builtin_islessgreater(x); /* { dg-error "not enough arguments" } */ - if (x == 12) return __builtin_isunordered(x); /* { dg-error "not enough arguments" } */ - if (x == 13) return __builtin_signbit(); /* { dg-error "not enough arguments" } */ + if (x == 1) return __builtin_fpclassify(1,2,3,4,5); /* { dg-error "too few arguments" } */ + if (x == 2) return __builtin_isfinite(); /* { dg-error "too few arguments" } */ + if (x == 3) return __builtin_isinf_sign(); /* { dg-error "too few arguments" } */ + if (x == 4) return __builtin_isinf(); /* { dg-error "too few arguments" } */ + if (x == 5) return __builtin_isnan(); /* { dg-error "too few arguments" } */ + if (x == 6) return __builtin_isnormal(); /* { dg-error "too few arguments" } */ + if (x == 7) return __builtin_isgreater(x); /* { dg-error "too few arguments" } */ + if (x == 8) return __builtin_isgreaterequal(x); /* { dg-error "too few arguments" } */ + if (x == 9) return __builtin_isless(x); /* { dg-error "too few arguments" } */ + if (x == 10) return __builtin_islessequal(x); /* { dg-error "too few arguments" } */ + if (x == 11) return __builtin_islessgreater(x); /* { dg-error "too few arguments" } */ + if (x == 12) return __builtin_isunordered(x); /* { dg-error "too few arguments" } */ + if (x == 13) return __builtin_signbit(); /* { dg-error "too few arguments" } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/pr70859.c b/gcc/testsuite/gcc.dg/pr70859.c index 0a3c8437c66..e71b05237b0 100644 --- a/gcc/testsuite/gcc.dg/pr70859.c +++ b/gcc/testsuite/gcc.dg/pr70859.c @@ -41,19 +41,19 @@ fn0 (int n) int fn1 (void) { - if (__builtin_constant_p ()) /* { dg-error "7:not enough" } */ + if (__builtin_constant_p ()) /* { dg-error "7:too few" } */ return 0; if (__builtin_constant_p (1, 2)) /* { dg-error "7:too many" } */ return 1; - if (__builtin_isfinite ()) /* { dg-error "7:not enough" } */ + if (__builtin_isfinite ()) /* { dg-error "7:too few" } */ return 3; if (__builtin_isfinite (1, 2)) /* { dg-error "7:too many" } */ return 4; - if (__builtin_isless (0)) /* { dg-error "7:not enough" } */ + if (__builtin_isless (0)) /* { dg-error "7:too few" } */ return 5; if (__builtin_isless (1, 2, 3)) /* { dg-error "7:too many" } */ return 6; - if (__builtin_fpclassify (1, 2, 3, 4, 5)) /* { dg-error "7:not enough" } */ + if (__builtin_fpclassify (1, 2, 3, 4, 5)) /* { dg-error "7:too few" } */ return 7; if (__builtin_fpclassify (1, 2, 3, 4, 5, r, 6)) /* { dg-error "7:too many" } */ return 8; @@ -61,7 +61,7 @@ fn1 (void) return 9; if (__builtin_assume_aligned (p, r, p, p)) /* { dg-error "7:too many" } */ return 10; - if (__builtin_add_overflow ()) /* { dg-error "7:not enough" } */ + if (__builtin_add_overflow ()) /* { dg-error "7:too few" } */ return 11; if (__builtin_add_overflow (1, 2, 3, &r)) /* { dg-error "7:too many" } */ return 12;