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.96) (envelope-from ) id 1w4w13-002iBQ-1s for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 07:17:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w4w12-0054fB-0I for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 07:17:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w4w0S-0051NZ-2W for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 07:16:53 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w4w0R-00000000klc-29va for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 07:16:52 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-486b96760easo8193245e9.2 for ; Tue, 24 Mar 2026 00:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774336610; x=1774941410; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=a4HnkSh3BMpCFqze3xv+EgLQBbGlk+nz16zrjUKXbl8=; b=ORXDADvYj+T/B27xkO3065mik6HzIBwe7RA8c4SvcqXUSjCCEUHWP8dcaQbyBiTZ5a XmZmXbHtHW3cnFDrJ8LYR97wIDzHzfOmaRlPBB3n6ChiRKoatGcSi20mXBdCuyfUH6gh jUufmXh22A/HPpVhrxjnhM/2k4JLev4JGcWiBjG08Ala1VYk0P3jgf0AlwWea9lMujXy nYj7nzpBRJa1xV8ivmlKqU+NtKck+JGDuEv4OM9AKrN9HZ5P2Vxct1jIgrZkEtUWa4j/ nTIEqFwZFGDR/i3sQYB4VFGHe2gQZNcui4iHiRRRwtHDI+o9O7eS7c4MACMAC2ajPxM5 F1xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774336610; x=1774941410; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a4HnkSh3BMpCFqze3xv+EgLQBbGlk+nz16zrjUKXbl8=; b=ljqoDyGjpJA9lFHECqcmnLBAa9XeiFFmYNDYDiKPFK7xDtfne4qiwe8Csl2dNo9Ek1 vJKtnteQa62VaLN9XpzIE58mN4XOwynz/VC+lyWW23lmZvrWd27Rdk6g7H9Ox+hlEf/k 7/mPahjHaYyc6xpN2SgClqLWRoeNPOT7Z0zoU2BH99LI+R6a20Pbhj0EszPdCX3+xsH1 7iXTgwQATeMGyEY4pzVq+IvBE5QQU3gqXozXKG3cDMey7B9oVgu/5g9NwJki5nPchA18 4SKkNryU4YWIHu/+N3A1+Df3TTbrleruW7/dDHnINK+wZCBOhQmZFui7a4VBkuJXpQd/ qFtw== X-Gm-Message-State: AOJu0YwebRcJA8r7QeQESwPWJuCc1X4DikEGqxwuoy2zVBYXSdk1PqK2 StNXCXDSuMiTtCcQYZpQfoa3oMcJkp2lC6q9ZiUHi/lyuFOWU4sXwwIDBjOVXQ== X-Gm-Gg: ATEYQzw1eji8ZN+lmspHfw5HKs2HZUqjvDCUxUGJcYKq/KNzx30AHi9HuWT3xk1H6Bm h105SwO3rDHngNNg0UtCY28QSOWdIDSDDnvUW+4uH4tVKK5m9smXpj6r64+cKGligyYmz2ZiETE 3PEoTt58I5SnUqTRGyujeL0E98VUemALzHTpnFU7DZtAfK5enMsebwsISvQvo1Zl+35lR3fsn+V t1w8M0jI7MetOYJEMygDTHQs/HjxgJmXvORviOi9KvjsGqjbB7ItPIqOZdm3U+c+PISqORIFaBD fV60lvLDvwox6uuw3rdP4lo2stxAWlVdP7VdQH8s8xMk/LmTnPVh6gYnTpILgbExRaBhE0IfgHA 6iikz2jmZV315CJmh5j3K6Mnaq67/dq64qG7jCidDkZUl6zceS2uS3e1zfP6nJHi2ka0sHouFN3 WuueMYIJy0G6RRxXK9NZ30SDu0OfTI88S/CLH24gpw4qocKuoVDMkJ9dANVWTXmtdn5pMpzkgQq RsDu/KnXT7dEMl0o0l3od6wmaVZZN+a4KJsvQqoVP81lIKAaAySIpLD2A== X-Received: by 2002:a05:600c:3b07:b0:477:6d96:b3e5 with SMTP id 5b1f17b1804b1-486fedab303mr209116525e9.7.1774336609549; Tue, 24 Mar 2026 00:16:49 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48711007753sm17459945e9.5.2026.03.24.00.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 00:16:49 -0700 (PDT) Date: Tue, 24 Mar 2026 07:16:47 +0000 From: Bertrand Drouvot To: Peter Eisentraut Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Enable -Wstrict-prototypes and -Wold-style-definition by default Message-ID: References: <44885d54-0376-46b3-b574-59e0e3098580@eisentraut.org> <4ab608af-2f90-47d8-88a5-6329f6630fff@eisentraut.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4ab608af-2f90-47d8-88a5-6329f6630fff@eisentraut.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Mon, Mar 23, 2026 at 04:13:20PM +0100, Peter Eisentraut wrote: > On 18.03.26 14:32, Peter Eisentraut wrote: > > On 16.03.26 10:55, Peter Eisentraut wrote: > > > On 09.03.26 17:39, Bertrand Drouvot wrote: > > > > 0001: Prevent -Wstrict-prototypes and -Wold-style-definition warnings > > > > > > > > It fixes the remaining warnings that those new flags would generate. > > > > > > I have committed this one.  I'll look at the rest next. > > > > Also committed. > > I have a couple of follow-up patches that I had developed while playing with > this. Thanks! > There is a warning option for MSVC that appears to have a very similar > effect to the ones we added here, so I propose we add that one as well. > > Additionally, there is an option for MSVC to disable warnings in system > headers, similar to the default behavior of GCC. This would be required > here because some system header files have non-strict prototypes. Some comments: 0001: + '/external:anglebrackets', + '/external:W0', The doc [1], states: " The /external compiler options are available starting in Visual Studio 2017 version 15.6. In versions of Visual Studio before Visual Studio 2019 version 16.10, the /external options require you also set the /experimental:external compiler option. " We currently require MSVC 2019, but what if one is using a version < 16.10? 0003: " This has been the default since gcc 4.0. (Introduced in 3.3, so it was only available but turned off for a relatively short time.) " It looks like it was default to on since its introduction in 909de5da19 ([2]), means since 3.3. In 90689ae11db ([3]), added in 4.0, the documentation has been updated to mention it (but I think that it was already on by default since 3.3). 0004: --- a/meson.build +++ b/meson.build @@ -2199,6 +2199,7 @@ unroll_loops_cflags = cc.get_supported_arguments(['-funroll-loops']) common_warning_flags = [ '-Wmissing-prototypes', + '-Wold-style-declaration', Nit, what about adding it with (as the comment is also accurate for the new one)? " # These are C-only flags, supported in all C11-capable GCC/Clang versions. cflags_warn += cc.get_supported_arguments(['-Wstrict-prototypes', '-Wold-style-definition']) " [1]: https://learn.microsoft.com/en-us/cpp/build/reference/external-external-headers-diagnostics?view=msvc-170 [2]: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=909de5da192 [3]: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=90689ae11db Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com