Jump to content

__SUNPRO_CC trouble


Alex Romana

Recommended Posts

Hi everybody,

I have some trouble understanding why sc_interface.h in systemc 2.3 contains:

private:
static sc_event m_never_notified;
#if __SUNPRO_CC == 0x520
// Workaround for a bug in the Sun WorkShop 6 update 2 compiler.
// An empty virtual base class can cause the optimizer to
// generate wrong code.
char dummy;
#endif
};

and nobody ran into this issue? Should __SUNPRO_CC be defined by default by the compiler on any platform?

with the right set of flags I get with gcc:

systemc-2.3.0/include/sysc/communication/sc_interface.h:72: error: "__SUNPRO_CC" is not defined

Is it an already reported bug?

To me the right code would be

private:
static sc_event m_never_notified;
#if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x520)
// Workaround for a bug in the Sun WorkShop 6 update 2 compiler.
// An empty virtual base class can cause the optimizer to
// generate wrong code.
char dummy;
#endif
};

Best regards,

Alexandre

Link to comment
Share on other sites

with the right set of flags I get with gcc:

The "right set of flags" obviously include (explicitly or implicitly) "-Wundef -Werror".

From the C(++) preprocessor standard point of view, it is not a bug. All undefined symbols are supposed to be interpreted as 0:

After all replacements due to macro expansion and the defined unary operator have been performed, all remaining identifiers (including those lexically identical to keywords) are replaced with the pp-number 0

Side note: When using strict GCC compiler flags in your models (which is a very good idea!), you might want to include third-party libraries like SystemC as "system headers" to avoid such problems coming from external sources:

 $(CXX) $(CXXFLAGS) -isystem $(SYSTEMC_HOME)/include ...

It is probably still a good idea to explicitly check for __SUNPRO_CC in sc_interface.h first.

Thanks for reporting.

Greetings from Oldenburg,

Philipp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...