Created attachment 431958 [details] [diff] [review] patch PR_STATIC_ASSERT is wanted in code (e.g. headers) that doesn't want the side-effects of including prlog.h, so we move it to prtypes.h.
I landed this in CVS for you: Checking in pr/include/prlog.h; /cvsroot/mozilla/nsprpub/pr/include/prlog.h,v <-- prlog.h new revision: 3.18; previous revision: 3.17 done Checking in pr/include/prtypes.h; /cvsroot/mozilla/nsprpub/pr/include/prtypes.h,v <-- prtypes.h new revision: 3.42; previous revision: 3.41 done
Thanks for landing the patch. I presume we need to wait for the next NSPR code drop before we can start assuming PR_STATIC_ASSERT is in prtypes.h?
I marked that with TM 4.8.6 as this is the first RTM with that change AFAIK. Please correct if I'm wrong.
Zack: What's the side effects of including prlog.h that you don't want? The reason PR_STATIC_ASSERT was defined in prlog.h was that the similar PR_ASSERT macro (run-time assertions) is defined in prlog.h.
(In reply to comment #5) > Zack: What's the side effects of including prlog.h > that you don't want? It decides whether PR_LOG is compiled in. In some cases, we want to make that decision on a per-.cpp-file basis, *after* including many other headers.
Zack: thanks for the explanation. Let me confirm my understanding with a concret example. This seems to be what you described: ----- Begin Foo.cpp ----- #include "prtypes.h" #include "header1.h" #include "header2.h" #if defined(CONDITION1) #define FORCE_PR_LOG 1 #endif #include "prlog.h" #include "header3.h" #include "header4.h" // Actual C++ code ----- End Foo.cpp ----- If I understand you correctly, the CONDITION1 macro cannot be tested until you have included header1.h and header2.h, but you want to use PR_STATIC_ASSERT in header1.h and header2.h. Is this correct?
Yeah, that's my understanding of it. I can't point you to any concrete cases in mozilla, though.