Alex Romana Posted March 1, 2013 Report Share Posted March 1, 2013 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 Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted March 1, 2013 Report Share Posted March 1, 2013 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 maehne 1 Quote Link to comment Share on other sites More sharing options...
Alex Romana Posted March 4, 2013 Author Report Share Posted March 4, 2013 Philipp, Thanks for this clear & detailed answer! As you said it wouldn't hurt to update sometime for paranoid compiler flags fans Best regards, Alexandre Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.