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 1uhmbw-00428u-VH for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Aug 2025 10:03:37 +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 1uhmbv-0070UH-H5 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Aug 2025 10:03:35 +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.94.2) (envelope-from ) id 1uhmbu-0070U9-PW for pgsql-hackers@lists.postgresql.org; Fri, 01 Aug 2025 10:03:35 +0000 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uhmbr-000Agq-1i for pgsql-hackers@postgresql.org; Fri, 01 Aug 2025 10:03:33 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 96B7A7A074E; Fri, 1 Aug 2025 06:03:31 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Fri, 01 Aug 2025 06:03:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1754042611; x=1754129011; bh=E1dfEpkpUEqK7EtI/5fvkDEbK3vVBqU8 DIt0Z6Op9EE=; b=LEmmY2CxFjVs5LaPNiD+zqaCg7tFHQnmqsWpL0Zz5bGlaWKi ltntYNryRtflpj6tVzl4qyKmMMj29D31RYh0LvkKgqENPwHlDMEp3tmj/IxsKUaf cJTz8XgEjwsMVkfg3jYtxvSZWPAUctb4FRlPu7aOZtXGglbLBJzzvNBG++XNdZZU AfMfFVid6pk/ZxezKsLIweyjs4tsSmvOaRx71G8MUv+Dvrc5we5ZgWB1VZctaBWd vBtxVUmsHmR5ltOKNj5uF5k6L7zGxaL866Yc/x9CmhMu9E/uaVOAr7lzy5Pkjbs9 Bq7GhV6B8Ye2xV0KPVNQpoxbyjAqXDnQtoboGA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1754042611; x= 1754129011; bh=E1dfEpkpUEqK7EtI/5fvkDEbK3vVBqU8DIt0Z6Op9EE=; b=j kSX6xd0rpbQoLfBZgJgty/zgkqogY1+gDlVrO27aGOebAiFiggztTJBDgCge3LsA pNmcfEmqT0ea+XDqgcX2byEZ3EuTYvhOCs5CGQpAZ+x21/siyrE6riQ9CyJ07CbI Wu6fsX5VTDJNVKBSeAaR6JM0cxIfQKGxJpWbISB1N01Mz/2HGINsENm7Azh54jwu NN2UrRLBrN7Yjhrl7RPRf1wloPAU0ijXAh3vrIHdykx59YH1ESTqqqsJYNOrlu5t EvO1riv9R3gnOB2t8UgZeKlLt22hBcBTfwcWpjTgsxjjH4ZJhUUgGV4U6bx4HIrU gsnxxTIhkwyiGepLPAYfA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddutdefgedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejre dttddvjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhes vghishgvnhhtrhgruhhtrdhorhhgqeenucggtffrrghtthgvrhhnpefgjedthfekfedtue fgieelheetleejgefhueeltdfhueetvdffudekfeejhfegheenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrsegvihhsvghnthhrrg huthdrohhrghdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghp thhtohepughgrhhofihlvgihmhhlsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgsh hqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 1 Aug 2025 06:03:30 -0400 (EDT) Message-ID: <37cf44be-9983-47da-a2be-e0fff6cec5d3@eisentraut.org> Date: Fri, 1 Aug 2025 12:03:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: C11 / VS 2019 To: David Rowley Cc: pgsql-hackers References: <01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org> Content-Language: en-US From: Peter Eisentraut 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 29.07.25 11:46, David Rowley wrote: > ../src/backend/parser/gram.y:19362:12: error: call to undeclared > function 'typeof'; ISO C99 and later do not support implicit function > declarations [-Wimplicit-function-declaration] > 19362 | result = copyObject(p->argType); > > It's not quite clear to me why the C11 test passes but then the build > fails. I assumed the mixed -std=gnu11 then -std=c99 are passed in the > test as well. I don't know how to check. The equivalent of config.log is in build/meson-logs/meson-log.txt. > Strangely, if I swap the order of the c11_test_args so the test tries > and uses -std=c11 first, it works ok. > > @@ -558,7 +558,7 @@ if not cc.compiles(c11_test, name: 'C11') > if cc.get_id() == 'msvc' > c11_test_args = ['/std:c11'] > else > - c11_test_args = ['-std=gnu11', '-std=c11'] > + c11_test_args = ['-std=c11', '-std=gnu11'] > endif The situation is that with my original code, the C11 test picks the option -std=gnu11, and the typeof() test is then run with cc ... -std=c99 ... -std=gnu11 which makes the test for typeof() pass (last option wins), but the actual build is run with cc ... -std=gnu11 ... -std=c99 which disables the availability of typeof(), but pg_config.h says it's available, so the compilation fails. If you flip the order of the arguments to be tested, then the C11 test picks -std=c11, and the typeof() test runs with cc ... -std=c99 ... -std=c11 which will fail to detect typeof() (since it's neither in strict C99 nor in strict C11), and then later the actual compilation won't see typeof() at all. Ideally, the tests should be run with the arguments in the same order as the actual compilation, but I don't think meson is equipped to support that. I've been digging around the code and the documentation and don't find any mention about the *order* of the arguments supplied by various means like global, project, per-target, tests, environment, etc. So I don't think there is any hope right now to sanely support "competing" arguments supplied from different sources. (One might have valid concerns about -I and -L options, but that's a different potential topic.) But since this is not how the patch was supposed to be used anyway, this shouldn't be a problem in practice. It's not a new problem anyway. FWIW, if you do this with autoconf, you get an early failure: ./configure CFLAGS='-std=c90' ... checking for gcc option to accept ISO C89... none needed checking for gcc option to accept ISO C99... unsupported configure: error: C compiler "gcc" does not support C99 So putting "-std=" options into CFLAGS was never working.