Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhD5a-0003eX-JR for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Apr 2022 16:21:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nhD5Z-0008Vp-0D for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Apr 2022 16:21:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhD5Y-0008Vg-0G for pgsql-bugs@lists.postgresql.org; Wed, 20 Apr 2022 16:21:56 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhD5V-0003GO-4g for pgsql-bugs@lists.postgresql.org; Wed, 20 Apr 2022 16:21:55 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D3CC05C0125; Wed, 20 Apr 2022 12:21:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 20 Apr 2022 12:21:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1650471711; x=1650558111; bh=+208ek5UM0sVWMTHYFOd+3Yi7Uii ylfjn8RsX6AFNfs=; b=r72Gi/5ZeZzqX2RG7aNWZulBKtiWlJbHNR4Ulx8TJ98W zDyPEvGJDA49huRl9hTMr6wl51ZtyTXA11U8f1jio1PeHc25Nzcj6WMmU7zF1BMO 95Wg9wuNFBgAhTK5g2smInPXkrIxmCHb9MVsJ/Kv8x21GFCHOEe+nHvAvks5aX2q WboDuxgkka2lXFFu5g5SWnRH9AT9g+OwNWNGhvSE6P5/M+3tQfP2iGBaoUUWOvsI wU6HxJ7X9QMk7bva51wqTTg9PhBitA7Jhq+vgJ5jfkHdfguxoXmKRzLwF6fLvZVl fN2eeHP9yo1fR9Leas/GvqC/Qw6IixlH+O85OSrowA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrtddtgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekre dttdefjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdr vghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomheqnecuggftrfgrth htvghrnheplefgteefiedtleelgeegjeevhfeuteefvddtjeehveeuieefgedvhfeuledu teeunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepph gvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 20 Apr 2022 12:21:50 -0400 (EDT) Message-ID: <56b4ea59-936f-c54f-2e7c-81ac7e638849@enterprisedb.com> Date: Wed, 20 Apr 2022 18:21:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: =?UTF-8?Q?Re=3a_BUG_=2317466=3a_Is_it_possible_to_supplement_the_de?= =?UTF-8?Q?fault_compilation_options_of_CFLAGS_in_configure_file=ef=bc=9f?= Content-Language: en-US To: wysunxavier@gmail.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form References: <17466-6ab1e589e78a166a@postgresql.org> From: Peter Eisentraut In-Reply-To: <17466-6ab1e589e78a166a@postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 19.04.22 05:36, PG Bug reporting form wrote: > When I try to specify some compilation options in CFLAGS, such as compiling > with macros, when I execute “./configure CFLAGS='-DUSE_TOOLS'”,it will use > '-O0' to compile by default, which is easy to miscompile into a debug > version. I wonder if it is possible to supplement the judgment conditions in > the postgresql source code: If the compilation option is not specified in > CFLAGS, '-O2' is used by default to avoid compiling the wrong debug > version. The use case you are describing is not without merit. But ultimately, the handling of these compiler option variables has decades of history behind it, and just poking at that for one specific case is going to break someone else's use case somehow. We generally avoid the need to add CFLAGS to the configure command line except in cases where you actually want to override the defaults. Other cases should have a command-line option or perhaps a spot in pg_config_manual.h. In your specific case you could also pass CPPFLAGS instead, which is more correct anyway, and it doesn't have a default that you can accidentally override.