Add informational warning when -Og is used

This commit is contained in:
Wilson Snyder 2008-07-02 06:48:50 -04:00
parent e6a43fc127
commit a4f3199427
3 changed files with 9 additions and 2 deletions

View File

@ -261,6 +261,7 @@ void V3Error::abortIfWarnings() {
bool V3Error::isError(V3ErrorCode code) {
if (code==V3ErrorCode::SUPPRESS) return false;
else if (code==V3ErrorCode::INFO) return false;
else if (code==V3ErrorCode::FATAL) return true;
else if (code==V3ErrorCode::ERROR) return true;
else if (code<V3ErrorCode::FIRST_WARN
@ -270,6 +271,7 @@ bool V3Error::isError(V3ErrorCode code) {
string V3Error::msgPrefix(V3ErrorCode code) {
if (code==V3ErrorCode::SUPPRESS) return "-arning-suppressed: ";
else if (code==V3ErrorCode::INFO) return "-Info: ";
else if (code==V3ErrorCode::FATAL) return "%Error: ";
else if (code==V3ErrorCode::ERROR) return "%Error: ";
else if (isError(code)) return "%Error-"+(string)code.ascii()+": ";
@ -311,7 +313,8 @@ void V3Error::v3errorEnd (ostringstream& sstr) {
if (sstr.str()[sstr.str().length()-1] != '\n') {
cerr<<endl;
}
if (s_errorCode!=V3ErrorCode::SUPPRESS) {
if (s_errorCode!=V3ErrorCode::SUPPRESS
&& s_errorCode!=V3ErrorCode::INFO) {
if (!s_describedEachWarn[s_errorCode]
&& !s_pretendError[s_errorCode]) {
s_describedEachWarn[s_errorCode] = true;

View File

@ -34,6 +34,7 @@ class V3ErrorCode {
public:
enum en {
SUPPRESS, // Warning suppressed by user
INFO, // General information out
FATAL, // Kill the program
ERROR, // General error out, can't suppress
// Error codes:
@ -74,7 +75,7 @@ public:
const char* ascii() const {
const char* names[] = {
// Leading spaces indicate it can't be disabled.
" SUPPRESS", " FATAL", " ERROR",
" SUPPRESS", " INFO", " FATAL", " ERROR",
"MULTITOP", "TASKNSVAR",
" FIRST_WARN",
"BLKANDNBLK",
@ -159,6 +160,7 @@ inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); }
// These allow errors using << operators: v3error("foo"<<"bar");
// Careful, you can't put () around msg, as you would in most macro definitions
#define v3info(msg) v3errorEnd(((V3Error::v3errorPrep(V3ErrorCode::INFO)<<msg),V3Error::v3errorStr()));
#define v3fatal(msg) v3errorEnd(((V3Error::v3errorPrep(V3ErrorCode::FATAL)<<msg),V3Error::v3errorStr()));
#define v3error(msg) v3errorEnd(((V3Error::v3errorPrep(V3ErrorCode::ERROR)<<msg),V3Error::v3errorStr()));
#define v3warn(code,msg) v3errorEnd(((V3Error::v3errorPrep(V3ErrorCode::code)<<msg),V3Error::v3errorStr()));

View File

@ -307,6 +307,8 @@ void process () {
V3Gate::gateAll(v3Global.rootp());
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("gate.tree"));
// V3Gate calls constant propagation itself.
} else {
v3info("Command Line disabled gate optimization with -Og/-O0. This may cause ordering problems.");
}
// Remove unused vars