Re: [PATCH 2/2] selftests/powerpc/pmu: fix including of utils.h when event.h is included
From: Madhavan Srinivasan <maddy@linux.ibm.com>
Date: 2023-03-07 06:03:44
On 3/2/23 8:49 AM, Madhavan Srinivasan wrote:
On 3/2/23 3:35 AM, Benjamin Gray wrote:quoted
On Wed, 2023-03-01 at 22:39 +0530, Kajol Jain wrote:quoted
From: Madhavan Srinivasan <maddy@linux.ibm.com> event.h header already includes utlis.h. Avoid including the same explicitly in the code when event.h included. Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>As I understand, transitive includes should not be depended upon. If you use a thing, and the thing is declared in a header, you should include _that_ header. Anything else is a recipe for weird include dependencies, ordering of the includes, etc. These files all use FAIL_IF, etc., which are declared in utils.h. So utils.h is a legitimate include. The fact that events.h also includes it (for u64) is a coincidence. If the u64 type def gets moved to, e.g., types.h, and utils.h is removed from events.h, suddenly all these files stop compiling.thanks for the review. IIUC utils.h also carries the some test harness func declarations, also some of these tests does not use type defs anyway. I should have had a better commit message, my bad. But i will try out the suggested case.
yeah, "utils.h" included in the testcase files are for the tast_harness declarations. So we could get typedef moved from utils.h. Good catch. Thanks. Kajol, kindly drop this patch. Maddy
Maddy