From e0e6ee3e5f10a95a6cc9dbfdcdd29fc1b4d12256 Mon Sep 17 00:00:00 2001
From: "James K. Lowden" <jklowden@symas.com>
Date: Wed, 15 Jan 2025 11:57:11 -0500
Subject: [PATCH] message cleanup

---
 gcc/cobol/util.cc | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index d6f7ca27651c..a8bb7d692a8f 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -244,7 +244,7 @@ is_numeric_edited( const char picture[] ) {
   assert(picture);
 
   if( strstr(picture, "(0)") ) {
-    numed_message = "error: '(0)' invalid in PICTURE (ISO 2023 13.18.40.3)";
+    numed_message = "'(0)' invalid in PICTURE (ISO 2023 13.18.40.3)";
     return false;
   }
 
@@ -255,11 +255,11 @@ is_numeric_edited( const char picture[] ) {
     numed_message = NULL;
 
     if( n == -1  ) {
-      numed_message = "error: invalid repeat-count in PICTURE";
+      numed_message = "invalid repeat-count in PICTURE";
     } else if( n == 0  ) {
-      numed_message = "error: invalid repeat-count in PICTURE";
+      numed_message = "invalid repeat-count in PICTURE";
     } else if( p[pos] != ')' ) {
-      numed_message = "error: unbalanced parentheses in PICTURE";
+      numed_message = "unbalanced parentheses in PICTURE";
     }
     if( numed_message ) return false;
   }
@@ -269,13 +269,13 @@ is_numeric_edited( const char picture[] ) {
     while( picture < prior-- ) {
       if( ISDIGIT(*prior) ) continue;
       if( *prior  == '(' ) break;
-      numed_message = "error: unbalanced parentheses in PICTURE";
+      numed_message = "unbalanced parentheses in PICTURE";
       return false;
     }
   }
 
   if( (strchr(picture, 'Z') || strchr(picture, 'z')) && strchr(picture, '*') ) {
-    numed_message = "error: Z and * are mutually exclusive";
+    numed_message = "Z and * are mutually exclusive";
     return false;
   }
 
@@ -288,24 +288,23 @@ is_numeric_edited( const char picture[] ) {
     switch(*p) { // test for CR or DB
     case 'C': case 'c':
       if( TOUPPER(*++p) == 'R' ) continue;
-      numed_message = "error: expected CR in PICTURE";
+      numed_message = "expected CR in PICTURE";
       break;
     case 'D': case 'd':
       if( TOUPPER(*++p) == 'B' ) continue;
-      numed_message = "error: expected DB in PICTURE";
+      numed_message = "expected DB in PICTURE";
       break;
     default:
-      asprintf(&s, "error: invalid PICTURE  character "
+      asprintf(&s, "invalid PICTURE  character "
                "'%c' at offset %zu in '%s'",
                *p, p - picture, picture);
       numed_message = s;
       break;
     }
 
-    if( yydebug ) {
-      yywarn( "%s: no, because '%c' at %.*s<-- in '%s'",
-             __func__, *p, int(p - picture) + 1, picture, picture );
-    }
+    dbgmsg( "%s: no, because '%c' at %.*s<-- in '%s'",
+	    __func__, *p, int(p - picture) + 1, picture, picture );
+
     return false;
   }
   return true;
@@ -2158,7 +2157,7 @@ class temp_loc_t : protected YYLTYPE {
   temp_loc_t() : orig(token_location) {
     if( yychar < 3 ) return;
     
-    gcc_location_set(yylloc);
+    gcc_location_set(yylloc); // use lookahead location
   }
   temp_loc_t( const YYLTYPE& loc) : orig(token_location) {
     gcc_location_set(loc);
-- 
GitLab