From fcf830abf7b3fc12d6127ca500d04405ef0efe54 Mon Sep 17 00:00:00 2001 From: Prathamesh Kulkarni Date: Fri, 19 Aug 2016 13:17:09 +0000 Subject: [PATCH] expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic. 2016-08-19 Prathamesh Kulkarni libcpp/ * expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic. testsuite/ * gcc.dg/cpp/warn-undef.c: Append "evaluates to 0" to dg-error. * gcc.dg/cpp/warn-undef-2.c: Likewise. From-SVN: r239609 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/cpp/warn-undef-2.c | 2 +- gcc/testsuite/gcc.dg/cpp/warn-undef.c | 2 +- libcpp/ChangeLog | 4 ++++ libcpp/expr.c | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4567c7e1f46..6590fab9c29 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-19 Prathamesh Kulkarni + + * gcc.dg/cpp/warn-undef.c: Append "evaluates to 0" to dg-error. + * gcc.dg/cpp/warn-undef-2.c: Likewise. + 2016-08-19 Richard Biener PR tree-optimization/77286 diff --git a/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c b/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c index 15fdde95c10..e71aebafcf0 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c @@ -1,5 +1,5 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=undef" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#if x // { dg-error "\"x\" is not defined .-Werror=undef." } +#if x // { dg-error "\"x\" is not defined, evaluates to 0 .-Werror=undef." } #endif diff --git a/gcc/testsuite/gcc.dg/cpp/warn-undef.c b/gcc/testsuite/gcc.dg/cpp/warn-undef.c index dd4524d8136..2c2c4219e2e 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-undef.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-undef.c @@ -1,5 +1,5 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Wundef" } -#if x // { dg-warning "\"x\" is not defined .-Wundef." } +#if x // { dg-warning "\"x\" is not defined, evaluates to 0 .-Wundef." } #endif diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 5d4a09450e0..e8e43f7285b 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2016-08-19 Prathamesh Kulkarni + + * expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic. + 2016-08-18 David Malcolm * directives.c (directive_names): New array. diff --git a/libcpp/expr.c b/libcpp/expr.c index 5cdca6f1bec..d32f5a97189 100644 --- a/libcpp/expr.c +++ b/libcpp/expr.c @@ -1073,7 +1073,7 @@ eval_token (cpp_reader *pfile, const cpp_token *token, result.low = 0; if (CPP_OPTION (pfile, warn_undef) && !pfile->state.skip_eval) cpp_warning_with_line (pfile, CPP_W_UNDEF, virtual_location, 0, - "\"%s\" is not defined", + "\"%s\" is not defined, evaluates to 0", NODE_NAME (token->val.node.node)); } break; -- 2.30.2