Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsqS1-0003Hr-Kc for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Jul 2019 15:23:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hsqS0-0005cF-63 for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Jul 2019 15:23:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsqRz-0005c6-PJ for pgsql-hackers@lists.postgresql.org; Wed, 31 Jul 2019 15:23:35 +0000 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsqRs-0003pe-3D for pgsql-hackers@postgresql.org; Wed, 31 Jul 2019 15:23:35 +0000 Received: by mail-qk1-x742.google.com with SMTP id w190so49507892qkc.6 for ; Wed, 31 Jul 2019 08:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=PZRwlgZqMQJFknFkZ0kiKG1X1oTwfm9jNCtHZrVpnP8=; b=cqJcD4ElpMn15STHJds+DgDAE+2QtekUAtCicXcWfhW7pKI5hZIU/6cL2KaPSeTCby 0pC+r1hqJYk7uf07SvTQoQFE9mzadAOV4g48/do5VXw9dGkwzfDjXYQdcjL1r666LNog zkzUqplJWnrdJsxnB6POOARbJ8BIBnzhnWJmT2IxGNOKSAPzwS3tXgZkPeiTZc1nd8mJ IHBXUOFBVv7YHxmVPK8nF+8VEHYWAJBZtZe23TKGePJfREun4z3YdNGOPAcHqzFBsKae a+YkKQIhZCMbn5WmeDfJknB3IeT9HeNjxvmIkbNcN2F6PkCt47tGPdJes0Tavdtc096l M/1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=PZRwlgZqMQJFknFkZ0kiKG1X1oTwfm9jNCtHZrVpnP8=; b=cnM22/C79cGVZiPwAiDlP7Y6138x4VABfUlrCPh+DfJ0VsMgtYmLXaRIgMb006bY7K G5QojoWcwi+mkkwH5Uc1NR4eC/OJ1wDIMbjfWbvh3qU3ZH4jvo1BVNhzUQ+qaZUevwTe buN3HyBpbV1lVKHxJXGeE/2G4q0bYUcOjzxrIRKwG5W+EPBwepOhoEW44Cut8cdL4tcH LjHw9ReNa+jMZnNEx0RCCOpz4SrY0VZHez8nhyvCM/KuRF278LnnUZDnkeGDBsz2CBCr Jy0+QVyc8ldQO0ud8yvmDOgxPucCj5VGabX902X/kWzYDoZ33dLifzec/O9Qd0v0vjLV HCZg== X-Gm-Message-State: APjAAAXLuGdD+gAc+f6wDnzo/nhMenKRt5xRZYX9kGCOfwbsf/8YUmsA 9CJl1hp54Oq1oklqRY8/mqvtMw== X-Google-Smtp-Source: APXvYqwi4swurjzK70XRGBHAm57uSdreYBnkmPp4VhFzNspUaGuEYTy3ylCW1u9ETqDrIzTC0YFIrw== X-Received: by 2002:a37:9b01:: with SMTP id d1mr79543661qke.46.1564586604905; Wed, 31 Jul 2019 08:23:24 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([191.126.227.221]) by smtp.gmail.com with ESMTPSA id c14sm26746709qko.84.2019.07.31.08.23.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 08:23:24 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 446D9120876; Wed, 31 Jul 2019 11:23:22 -0400 (-04) Date: Wed, 31 Jul 2019 11:23:22 -0400 From: Alvaro Herrera To: vignesh C Cc: Pg Hackers Subject: Re: Unused header file inclusion Message-ID: <20190731152322.GA30941@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jul-31, vignesh C wrote: > I noticed that there are many header files being > included which need not be included. Yeah, we have tooling for this already in src/tools/pginclude. It's been used before, and it has wreaked considerable havoc; see "git log --grep pgrminclude". I think doing this sort of cleanup is useful to a point -- as Andres mentions, some includes are somewhat more "important" than others, so judgement is needed in each case. I think removing unnecessary include lines from header files is much more useful than from .c files. However, nowadays even I am not very convinced that that is a very fruitful use of time, since many/most developers use ccache which will reduce the compile times anyway in many cases; and development machines are typically much faster than ten years ago. Also, I think addition of new include lines to existing .c files should be a point worth specific attention in patch review, to avoid breaking reasonable modularity boundaries unnecessarily. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services