Skip to content

Commit

Permalink
- The compiler flag +showErrorMessages now also shows Error.mo messag…
Browse files Browse the repository at this point in the history
…es as they occur. This should make it easier to relate Error messages to failtrace messages.

  - If a message would be reverted, this is of course sort of bad
  + Keeps memory consumption low for large models
  + For looping models, you can now see errors even though instantation will never succeed


git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/sjoelund-functiontree@6517 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 22, 2010
1 parent b5a5226 commit d259096
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions Compiler/runtime/errorext.cpp
Expand Up @@ -36,6 +36,7 @@
#include <string.h>
#include <stdlib.h>
#include <utility>
#include "rtopts.h"

using namespace std;

Expand All @@ -59,6 +60,14 @@ static stack<ErrorMessage*> errorMessageQueue; // Global variable of all error m
static vector<pair<int,string> > checkPoints; // a checkpoint has a message index no, and a unique identifier
static string lastDeletedCheckpoint = "";

static void push_message(ErrorMessage *msg)
{
if (showErrorMessages)
std::cerr << msg->getFullMessage() << std::endl;
else
errorMessageQueue.push(msg);
}

/* Adds a message without file info. */
void add_message(int errorID,
const char* type,
Expand All @@ -77,7 +86,7 @@ void add_message(int errorID,
ErrorMessage *msg = new ErrorMessage((long)errorID, std::string(type ), std::string(severity), /*std::string(message),*/ tmp, tokens);
if (errorMessageQueue.empty() || (!errorMessageQueue.empty() && errorMessageQueue.top()->getFullMessage() != msg->getFullMessage())) {
// std::cerr << "inserting error message "<< msg->getFullMessage() << " on variable "<< currVariable << std::endl; fflush(stderr);
errorMessageQueue.push(msg);
push_message(msg);
}
} else {
ErrorMessage *msg = new ErrorMessage((long)errorID, std::string(type ), std::string(severity), /*std::string(message),*/ tmp, tokens,
Expand All @@ -86,7 +95,7 @@ void add_message(int errorID,
if (errorMessageQueue.empty() || (!errorMessageQueue.empty() && errorMessageQueue.top()->getFullMessage() != msg->getFullMessage())) {
// std::cerr << "inserting error message "<< msg->getFullMessage() << " on variable "<< currVariable << std::endl;
// std::cerr << "values: " << finfo.rs << " " << finfo.ce << std::endl; fflush(stderr);
errorMessageQueue.push(msg);
push_message(msg);
}
}
}
Expand Down Expand Up @@ -132,7 +141,7 @@ void add_source_message(int errorID,
std::string(filename));
if (errorMessageQueue.empty() || (!errorMessageQueue.empty() && errorMessageQueue.top()->getFullMessage() != msg->getFullMessage())) {
// std::cerr << "inserting error message "<< msg->getFullMessage() << std::endl; fflush(stderr);
errorMessageQueue.push(msg);
push_message(msg);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Compiler/runtime/rtopts.h
Expand Up @@ -34,5 +34,5 @@
int check_debug_flag(char const* strdata);
int accept_meta_modelica_grammar(void);
extern int running_testsuite;

extern int showErrorMessages;
#endif

0 comments on commit d259096

Please sign in to comment.