@@ -191,9 +191,6 @@ ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg)
191191 attr = errmsg->Attribute (" verbose" );
192192 mVerboseMessage = attr ? attr : " " ;
193193
194- attr = errmsg->Attribute (" generic" );
195- mGenericMessage = attr ? attr : " " ;
196-
197194 attr = errmsg->Attribute (" hash" );
198195 hash = attr ? strToInt<std::size_t >(attr) : 0 ;
199196
@@ -221,75 +218,6 @@ ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg)
221218}
222219
223220// Convert instance-specific messages to generic ones
224- static std::string makeGeneric (const std::string &message)
225- {
226- std::string result = message;
227-
228- // Handle format string patterns first (before general single-quoted replacement)
229- result = std::regex_replace (result, std::regex (R"( %[a-zA-Z0-9]+)" ), " format specifier" );
230-
231- // Handle specific casting patterns
232- result = std::regex_replace (
233- result,
234- std::regex (
235- R"( Casting between (?:(?:const\s+|unsigned\s+|signed\s+)*[a-zA-Z_][a-zA-Z0-9_]*\s*\*+\s*and\s*(?:const\s+|unsigned\s+|signed\s+)*[a-zA-Z_][a-zA-Z0-9_]*\s*\*+) which have)" ),
236- " Casting between incompatible pointer types which have" );
237-
238- // Handle specific pointer type patterns (after casting patterns)
239- result = std::regex_replace (
240- result, std::regex (R"( \b(?:const\s+|unsigned\s+|signed\s+)*[a-zA-Z_][a-zA-Z0-9_]*\s*\*+)" ), " pointer type" );
241-
242- // Handle specific patterns that need special treatment
243- // Iterator condition patterns
244- result = std::regex_replace (
245- result,
246- std::regex (
247- R"( Either the condition '[^']*' is redundant or there is possible dereference of an invalid iterator[^.]*\.)" ),
248- " Either the condition is redundant or there is possible dereference of an invalid iterator." );
249-
250- // Access moved variable patterns
251- result = std::regex_replace (result, std::regex (R"( Access of moved variable '[^']*')" ), " Access of moved variable" );
252-
253- // Variable/function/parameter patterns (before general replacement)
254- result = std::regex_replace (result, std::regex (R"( Variable '[^']*')" ), " Variable" );
255- result = std::regex_replace (result, std::regex (R"( variable '[^']*')" ), " variable" );
256- result = std::regex_replace (result, std::regex (R"( Function '[^']*')" ), " Function" );
257- result = std::regex_replace (result, std::regex (R"( function '[^']*')" ), " function" );
258- result = std::regex_replace (result, std::regex (R"( Parameter '[^']*')" ), " Parameter" );
259- result = std::regex_replace (result, std::regex (R"( parameter '[^']*')" ), " parameter" );
260- result = std::regex_replace (result, std::regex (R"( Member variable '[^']*')" ), " Member variable" );
261- result = std::regex_replace (result, std::regex (R"( member variable '[^']*')" ), " member variable" );
262-
263- // Replace double-quoted strings with generic placeholder
264- result = std::regex_replace (result, std::regex (R"( "(?:[^"\\]|\\.)*")" ), " \" string\" " );
265-
266- // Replace all remaining single-quoted identifiers with generic placeholder
267- result = std::regex_replace (result, std::regex (R"( '[^']*')" ), " 'identifier'" );
268-
269- // Replace all numbers with generic placeholder
270- result = std::regex_replace (result, std::regex (R"( \b\d+\b)" ), " N" );
271-
272- // Replace array access patterns
273- result = std::regex_replace (result, std::regex (R"( \[[^\]]+\])" ), " [index]" );
274-
275- // Clean up patterns that may have resulted in redundant text
276- result = std::regex_replace (result, std::regex (R"( Variable 'identifier')" ), " Variable" );
277- result = std::regex_replace (result, std::regex (R"( Function 'identifier')" ), " Function" );
278- result = std::regex_replace (result, std::regex (R"( Parameter 'identifier')" ), " Parameter" );
279- result = std::regex_replace (result, std::regex (R"( Member variable 'identifier')" ), " Member variable" );
280-
281- // Clean up trailing colons that don't reference anything
282- result = std::regex_replace (result, std::regex (R"( :\s*$)" ), " " );
283-
284- // Clean up multiple spaces
285- result = std::regex_replace (result, std::regex (R"( \s+)" ), " " );
286-
287- // Trim whitespace
288- result = std::regex_replace (result, std::regex (R"( ^\s+|\s+$)" ), " " );
289-
290- return result;
291- }
292-
293221void ErrorMessage::setmsg (const std::string &msg)
294222{
295223 // If a message ends to a '\n' and contains only a one '\n'
@@ -307,18 +235,12 @@ void ErrorMessage::setmsg(const std::string &msg)
307235 if (pos == std::string::npos) {
308236 mShortMessage = replaceStr (msg, " $symbol" , symbolName);
309237 mVerboseMessage = replaceStr (msg, " $symbol" , symbolName);
310- // Set generic message (remove symbol names and make generic)
311- const std::string msgWithoutSymbol = replaceStr (msg, " $symbol" , " " );
312- mGenericMessage = makeGeneric (msgWithoutSymbol);
313238 } else if (startsWith (msg," $symbol:" )) {
314239 mSymbolNames += msg.substr (8 , pos-7 );
315240 setmsg (msg.substr (pos + 1 ));
316241 } else {
317242 mShortMessage = replaceStr (msg.substr (0 , pos), " $symbol" , symbolName);
318243 mVerboseMessage = replaceStr (msg.substr (pos + 1 ), " $symbol" , symbolName);
319- // Set generic message (remove symbol names and make generic)
320- const std::string msgWithoutSymbol = replaceStr (msg.substr (0 , pos), " $symbol" , " " );
321- mGenericMessage = makeGeneric (msgWithoutSymbol);
322244 }
323245}
324246
@@ -369,12 +291,10 @@ std::string ErrorMessage::serialize() const
369291
370292 const std::string saneShortMessage = fixInvalidChars (mShortMessage );
371293 const std::string saneVerboseMessage = fixInvalidChars (mVerboseMessage );
372- const std::string saneGenericMessage = fixInvalidChars (mGenericMessage );
373294
374295 serializeString (oss, saneShortMessage);
375296 serializeString (oss, saneVerboseMessage);
376297 serializeString (oss, mSymbolNames );
377- serializeString (oss, saneGenericMessage);
378298 oss += std::to_string (callStack.size ());
379299 oss += " " ;
380300
@@ -402,9 +322,9 @@ void ErrorMessage::deserialize(const std::string &data)
402322 callStack.clear ();
403323
404324 std::istringstream iss (data);
405- std::array<std::string, 11 > results;
325+ std::array<std::string, 10 > results;
406326 std::size_t elem = 0 ;
407- while (iss.good () && elem < 11 ) {
327+ while (iss.good () && elem < 10 ) {
408328 unsigned int len = 0 ;
409329 if (!(iss >> len))
410330 throw InternalError (nullptr , " Internal Error: Deserialization of error message failed - invalid length" );
@@ -430,7 +350,7 @@ void ErrorMessage::deserialize(const std::string &data)
430350 if (!iss.good ())
431351 throw InternalError (nullptr , " Internal Error: Deserialization of error message failed - premature end of data" );
432352
433- if (elem != 11 )
353+ if (elem != 10 )
434354 throw InternalError (nullptr , " Internal Error: Deserialization of error message failed - insufficient elements" );
435355
436356 id = std::move (results[0 ]);
@@ -454,7 +374,6 @@ void ErrorMessage::deserialize(const std::string &data)
454374 mShortMessage = std::move (results[7 ]);
455375 mVerboseMessage = std::move (results[8 ]);
456376 mSymbolNames = std::move (results[9 ]);
457- mGenericMessage = std::move (results[10 ]);
458377
459378 unsigned int stackSize = 0 ;
460379 if (!(iss >> stackSize))
0 commit comments