- 
                Notifications
    
You must be signed in to change notification settings  - Fork 727
 
Document cyclic dependency. #8407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Document cyclic dependency. #8407
Conversation
| 
           clang-tidy review says "All clean, LGTM! 👍"  | 
    
To be fixed later, but this way it is already documented. (what needs to be done is probably break out the libraries in the BUILD file better). Signed-off-by: Henner Zeller <[email protected]>
206cef2    to
    55b2b1f      
    Compare
  
    | 
           clang-tidy review says "All clean, LGTM! 👍"  | 
    
| 
           It would be helpful to state the actual symbols involved in the circular dependency.  | 
    
| 
           I mentioned one in one of the files (  | 
    
| 
           You can get that from sta/include/sta/NetworkClass.hh  | 
    
| 
           Ok, looked NetwokClass.hh only has a forward declare, not a definition.  | 
    
| 
           There is no definition - it is just used for type puning.  | 
    
| 
           yes, but even opaque types should be defined (like what you do in dbSta.hh; and the comment even gives a reason why this is needed for the RTTI constructs).  | 
    
| 
           As it states there // talking to the OpenSTA author about implementing these is the right fix. Putting it in dbSta was a hack and causes the cycles you see. @QuantamHD what came of those discussions? We can put it in our fork if necessary.  | 
    
| 
           This might be one of the cases where a Macro can improve readability because it describes the intent. #define MAKE_OPAQUE_TYPE(T)                     \
class T                                         \
{                                               \
 public:                                        \
  T() = delete;                                 \
}
MAKE_OPAQUE_TYPE(Cell);
MAKE_OPAQUE_TYPE(Instance);
// ...
#undef  MAKE_OPAQUE_TYPESince it will not only improve the use of the types in RTTI context, but also strictly improve the readability, it might be easier to upstream such change to   | 
    
| 
           Converting this to draft, as other includes should be used; but leaving it open so that we don't forget to move the opaque type stuff into sta.  | 
    
| 
           I think the easiest way to break the cycle is to just move these defintions into their own header and make it a more base level dep than dbSta which is more high level.  | 
    
| 
           w.r.t. #8407 (comment) The change would be something like --- a/include/sta/NetworkClass.hh
+++ b/include/sta/NetworkClass.hh
@@ -34,19 +34,29 @@
 
 namespace sta {
 
+#define MAKE_OPAQUE_TYPE(T)                     \
+class T                                         \
+{                                               \
+ public:                                        \
+  T() = delete;                                 \
+}
+
+MAKE_OPAQUE_TYPE(Cell);
+MAKE_OPAQUE_TYPE(Library);
+MAKE_OPAQUE_TYPE(Port);
+MAKE_OPAQUE_TYPE(Instance);
+MAKE_OPAQUE_TYPE(Pin);
+MAKE_OPAQUE_TYPE(Term);
+MAKE_OPAQUE_TYPE(Net);
+MAKE_OPAQUE_TYPE(ViewType);
+
+#undef  MAKE_OPAQUE_TYPE
+
 class Network;
 class NetworkEdit;
 class NetworkReader;
-class Library;
-class Cell;
-class Port;
 class PortDirection;
-class Instance;
-class Pin;
-class Term;
-class Net;
 class ConstantPinIterator;
-class ViewType;
 class LibertyLibrary;
 
 typedef Iterator<Library*> LibraryIterator;should I file a PR against https://github.com/The-OpenROAD-Project/OpenSta or try to parallaxsw ?  | 
    
| 
           I have no idea if you can get it into parallax but let's see. I would include a description of the motivating issue with RTTI.  | 
    
To be fixed later, but this way it is already documented. (what needs to be done is probably break out the libraries in the BUILD file better).