c++: Make diagnostic translatable [PR109309]

Message ID 20230328155057.1187204-1-jwakely@redhat.com
State Dropped
Headers
Series c++: Make diagnostic translatable [PR109309] |

Commit Message

Jonathan Wakely March 28, 2023, 3:50 p.m. UTC
  Tested x86_64-linux. OK for trunk?

-- >8 --

gcc/cp/ChangeLog:

	PR c++/109309
	* contracts.cc (check_postcondition_result): Use complete
	strings for diagnostics, so they can be translated.
---
 gcc/cp/contracts.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Jonathan Wakely March 28, 2023, 3:52 p.m. UTC | #1
Ignore this one - jakub just committed a fix.
  

Patch

diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc
index 8aca1bade89..20ae4e3b14b 100644
--- a/gcc/cp/contracts.cc
+++ b/gcc/cp/contracts.cc
@@ -639,12 +639,12 @@  check_postcondition_result (tree decl, tree type, location_t loc)
   {
     const char* what;
     if (DECL_CONSTRUCTOR_P (decl))
-      what = "constructor";
+      what = "constructor does not return a value to test";
     else if (DECL_DESTRUCTOR_P (decl))
-      what  = "destructor";
+      what = "destructor does not return a value to test";
     else
-      what = "function";
-    error_at (loc, "%s does not return a value to test", what);
+      what = "function does not return a value to test";
+    error_at (loc, "%s", what);
     return false;
   }