Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s5MwM-004zn9-Ti for pgsql-hackers@arkaria.postgresql.org; Fri, 10 May 2024 09:53:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s5MwJ-00DQ14-43 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 May 2024 09:53:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s5MwI-00DQ0o-Nx for pgsql-hackers@lists.postgresql.org; Fri, 10 May 2024 09:53:19 +0000 Received: from meesny.iki.fi ([2001:67c:2b0:1c1::201]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s5MwF-000KMr-8w for pgsql-hackers@postgresql.org; Fri, 10 May 2024 09:53:18 +0000 Received: from [192.168.1.115] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 4VbPMY1dy2zyRg; Fri, 10 May 2024 12:53:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1715334793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GI6J1T/TFqlZGr5V8yLPVe5ibaKbxxAQtr3TvknIwN0=; b=uKInLboFw6TurVsJwyZZAOE/1QzyZ2FAVrgf2JkPtHcWlOS/ZNR1qc0RQsozGuhIroXD9S td7bw2L/4zNhXqxYyZh1XwLWTqNC42DPAbrWdNplpo4E32iyy2XKXiZTQQY2sVGvi8IYKJ GC53QeM80xyoXEYQpSZnuHUFZ6AUOR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1715334793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GI6J1T/TFqlZGr5V8yLPVe5ibaKbxxAQtr3TvknIwN0=; b=Hbosh0jcQtUVMP3z8oBRne6O8VKTgyVOtLzGvCI/fi877mQdFs4R/a3Gk2Kmpb9fUVDwHx FKRLW9k3kebuDjlrwET9Ctqmeheyco7k5yGOJ+el0e4Oviz8od1Yt0TmOmt4AQhP4eCQLF EVyKDGeKqWG/InYpTff/NwwZtOsqzew= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=meesny; d=iki.fi; t=1715334793; a=rsa-sha256; cv=none; b=XZdTyVR45ekOKlTp3kMvlatlRI/bnz6VIGmS8eptzltUjo+Zj13+gSKwJgT4/n/FMMcoU7 v3Kk9SNuHf5VVa0TW0C1XWiNPERInNt88F90eXC/KlFlB1yHS5zAdCA8FD4H6sFFLCMhNU 8V4N1pSNRQLZTJZnr8zhNXc7IGQ1yro= Message-ID: <69d9824f-00ea-49b6-b68d-96f0806ec454@iki.fi> Date: Fri, 10 May 2024 12:53:10 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: consider -Wmissing-variable-declarations To: Peter Eisentraut , pgsql-hackers References: Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 09/05/2024 12:23, Peter Eisentraut wrote: > In [0] I had noticed that we have no automated verification that global > variables are declared in header files. (For global functions, we have > this through -Wmissing-prototypes.) As I mentioned there, I discovered > the Clang compiler option -Wmissing-variable-declarations, which does > exactly that. Clang has supported this for quite some time, and GCC 14, > which was released a few days ago, now also supports it. I went and > installed this option into the standard build flags and cleaned up the > warnings it found, which revealed a number of interesting things. Nice! More checks like this is good in general. > Attached are patches organized by sub-topic. The most dubious stuff is > in patches 0006 and 0007. A bunch of GUC-related variables are not in > header files but are pulled in via ad-hoc extern declarations. I can't > recognize an intentional scheme there, probably just done for > convenience or copied from previous practice. These should be organized > into appropriate header files. +1 for moving all these to header files. Also all the "other stuff" in patch 0007. -- Heikki Linnakangas Neon (https://neon.tech)