On 05/12/20 00:40, Kinney, Michael D wrote: > Vitaly, > > Thank you for the contribution. > > There are a couple points about this approach that need to be discussed. > > You have included the <Library/DebugCommonLib.h> from > MdePkg/Include/Library/DebugLib.h.
Right, I've noticed it. I agree it's unusual. I didn't think it was wrong. > It is very rare for a > lib class to include another lib class. This means that a module > that has a dependency on the DebugLib class inherits a hidden > dependency on the DebugCommonLib class. I agree. I think it should be fine. Any header H1 should include such further headers H2, H3, ... Hn that are required for making the interfaces declared in H1 usable in client modules. > For module INF files, > we require the INF file to list all the lib classes that the > module sources directly use. Yes, keyword being "directly". > Since a module that uses the > DebugLib uses the ASSERT() and DEBUG() macros, all the APIs > that the ASSERT() and DEBUG() macros use are also directly > used by the module. I believe this is where I disagree. The replacement texts of the ASSERT() and DEBUG() function-like macros are internals of the DebugLib.h lib class header, in my opinion. Those internals place requirements on specific DebugLib instances, not on DebugLib class consumers. In other words, when writing a new DebugLib instance, the implementor has to ensure that the ASSERT() and DEBUG() macros, as defined in the DebugLib class header, will continue working in DebugLib consumer modules. The implementor may then choose to make the new DebugLib instance dependent on the (singleton) DebugCommonLib instance, for example. (This is being done in patches #3, #4, #16, maybe more.) The DebugLib consumer module will inherit that dependency, and everything will work. Just because ASSERT() and DEBUG() are function-like macros and not actual functions, I don't think the INF file requirements in DebugLib-consumer modules should change. > With this patch series, these macros > now use the DebugCommonLib class APIs, which means any module > that uses the DebugLib also directly uses the DebugCommonLib. In my opinion: indirectly. Thanks, Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59260): https://edk2.groups.io/g/devel/message/59260 Mute This Topic: https://groups.io/mt/74138532/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-