gcc/testsuite/
authorYvan Roux <yvan.roux@linaro.org>
Tue, 6 Sep 2016 12:44:22 +0000 (14:44 +0200)
committerYvan Roux <yvan.roux@linaro.org>
Wed, 7 Sep 2016 20:09:05 +0000 (22:09 +0200)
Backport from trunk r239609.
2016-08-19  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

* gcc.dg/cpp/warn-undef.c: Append "evaluates to 0" to dg-error.
* gcc.dg/cpp/warn-undef-2.c: Likewise.

libcpp/
Backport from trunk r239609.
2016-08-19  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

* expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic.

Change-Id: I363be41700a632019b206fdda9b8d94a4a734432

gcc/testsuite/gcc.dg/cpp/warn-undef-2.c
gcc/testsuite/gcc.dg/cpp/warn-undef.c
libcpp/expr.c

index 15fdde9..e71aeba 100644 (file)
@@ -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
index dd4524d..2c2c421 100644 (file)
@@ -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
index 5cdca6f..d32f5a9 100644 (file)
@@ -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;