Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3446610ybi; Tue, 18 Jun 2019 00:36:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzRAlp1//6d9DWRPDcddUm7AkUyaqnCWS1DCH5UvD+pmPm80YSPxlondHoZxcWbiaOrjPn X-Received: by 2002:a17:902:7d86:: with SMTP id a6mr88118338plm.199.1560843396921; Tue, 18 Jun 2019 00:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560843396; cv=none; d=google.com; s=arc-20160816; b=NvfYLpmbdw7ygeh3XH0EeiZkrcjuD3NhYKIC9fHpomyQTILTsv+rFiovPxukbwyfk0 gyI5awblqWBtrOOSQOJ/JdBHAIxbF3vFxpqQ6poHZOAjRqp32B4YyXxoc3GPKpXS+dB8 SEXTvbgMnh672LwlWxAKFT3pWwURJmSNgZsfk7ltOaq0g080R7+4kwYfvxXLaRPwfNVH tD+2/L5ScVtpXTBByyUvFqioiqH+qGLysNPNlWu0PhYrkMrHz0c1Qom8xQ5FqIcger8L MLm+zml9tCDNXS+i1KxfwbI2yKI2SkyglUuPt2uwG5T8EQyyacI7/G4HPQXbT1pr3Ptg dGqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:date:from :dkim-signature; bh=k9obQVqJhJdcEWxTNyyv7zM7pVmu5cowlAzUxzKSDdU=; b=gaFfhv7VGnTRQSUebQtFYRDcNgK8FszouXy8kRspt93/q8ebiwry0WMxtim+fKfpkr Pd1+Y1mhnKMDSHO/QReplgPnU3ZtVRzMxUrJd/eqbBcQM9WWhN2auNQ1prnRIWBWiEuJ PBJL1auhhuzI+PN3rMU73QSXgo+xNCGC1KA51w+L3Guc9IhCi/WsZ9foBcmUNlTYWx3F D5uz/3a2X/nmPkEcUthmJC8yiIMF9D5wKRiLbOOyLMzrE4bWAr/R8pNpalAQhlie5Nnl zDCB4hDXGRKOJTooEaBNl18fB369Hh7NsPuhXCujBFxK634wEtrXR/7n9Kgq1tmkGlH2 Wz4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b="BY/SsPgb"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8si12867260pgj.322.2019.06.18.00.36.07; Tue, 18 Jun 2019 00:36:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b="BY/SsPgb"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725919AbfFRHgE (ORCPT + 99 others); Tue, 18 Jun 2019 03:36:04 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:42214 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfFRHgE (ORCPT ); Tue, 18 Jun 2019 03:36:04 -0400 Received: by mail-lf1-f66.google.com with SMTP id y13so8446819lfh.9 for ; Tue, 18 Jun 2019 00:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silvair-com.20150623.gappssmtp.com; s=20150623; h=from:date:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=k9obQVqJhJdcEWxTNyyv7zM7pVmu5cowlAzUxzKSDdU=; b=BY/SsPgbfiFLE9zULsxD4VxWim0mQhsuow5PSXyfkd4CCrYLpzX3zGMUqU1ztsxXBw SREZjIg4hyHjRHFiribU9NhkUFNPDxqjiu0BRGFf1wfOUmIFKES69Qswy/lH+UwSEgn/ ogr4JXRpxqqPUgiUIUZ2NiOVl6ul2+TiEsocTbLjQb/YpbEdZU5M603YClUFK9dq/br6 XlrAIINYzobmUZLJlkiHX7XwWCLxuE1Tpqz3hnrb6EsZT/otHCsdD9b1MaBewiF83pA7 iVvHbZwhZ47ARFHzgpScu7QiFtqLdSSZEUi86acEJ9HiO68og16JmfB8uGiKI4BGIRJK OjDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=k9obQVqJhJdcEWxTNyyv7zM7pVmu5cowlAzUxzKSDdU=; b=QxQLH5mAVCp3rbSgde0Ym6S1xEchGRMSD3DONdfiiV+8mPhUuxksgQWsXna/Gu+850 Pc9RqgPdEeeWPJJhV4ldgXyS2URKKjVqEday/L/9x1gfVhkqYOe1wV6/r05qTe8vEi9J 38Z7t6HAPJeHbiUkmZ9bs3YkShLpyWYi/EFNmfTB7MRD5TAmwTSGN41+eho7+UWGntxt gXcZhHV0imjFRtayU6oCmnKeSCjJ6LRu8i60p94ShDVRaCZKjLkhwg3hMm8O9abaUVA7 X77IXm40mViqraiEY8xvetviVcOBST+V8d6+7JUUyVwcq+xh8+IW5qNgVHMiRGzP0Nj+ uVRw== X-Gm-Message-State: APjAAAVJAisS3Waf4ezRoBYlF8Ns5xwkg7vU+u8jqtlxD0uZuF5WrGuJ yt+GTopftL4T+iJb367CHK6yZA== X-Received: by 2002:ac2:41d3:: with SMTP id d19mr29366903lfi.127.1560843362380; Tue, 18 Jun 2019 00:36:02 -0700 (PDT) Received: from mlowasrzechonek2133 ([217.153.94.18]) by smtp.gmail.com with ESMTPSA id r11sm2723692ljh.90.2019.06.18.00.36.01 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 18 Jun 2019 00:36:01 -0700 (PDT) From: "=?utf-8?Q?Micha=C5=82?= Lowas-Rzechonek" X-Google-Original-From: =?utf-8?Q?Micha=C5=82?= Lowas-Rzechonek Date: Tue, 18 Jun 2019 09:35:59 +0200 To: Inga Stotland Cc: linux-bluetooth@vger.kernel.org, brian.gix@intel.com Subject: Re: [PATCH BlueZ] mesh: Clean up includes Message-ID: <20190618073559.tmpaj2oellkf5354@mlowasrzechonek2133> Mail-Followup-To: Inga Stotland , linux-bluetooth@vger.kernel.org, brian.gix@intel.com References: <20190617213847.21705-1-inga.stotland@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190617213847.21705-1-inga.stotland@intel.com> User-Agent: NeoMutt/20180716 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Inga, On 06/17, Inga Stotland wrote: > This adds #include for json-c/json.h in mesh-db.h and removes this > include from the other files that don't need to reference json-c. While I agree about removal from cfgmod-server, model and node, I don't think we should remove the include from storage and move it to mesh-db. I'd rather see #includes follow https://include-what-you-use.org/ approach, that is: (...) for every symbol (type, function variable, or macro) that you use in foo.cc, either foo.cc or foo.h should #include a .h file that exports the declaration of that symbol. Moreover, I think headers should only be included as-needed (mostly in .c files), and headers should contain forward declarations of various types, to make them opaque. Such an approach cuts implicit dependencies, making code maintenance easier: when, for example, someone decides to refactor mesh-db not to use json_object anymore, they shouldn't need to suddenly deal with missing declarations in other modules (in this case, storage). Moreover, each header should be self-sufficient: in order to use API exposed by a given header, it should be enough to include that header only. At the moment, this is not the case. A minor side-effect would be faster builds and less rebuilds when code is being worked on. If you agree, I am more than happy to fix this throughout the mesh/ codebase. regards -- Michał Lowas-Rzechonek Silvair http://silvair.com Jasnogórska 44, 31-358 Krakow, POLAND