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 1tiEoU-00DHzv-PU for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 15:38:10 +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 1tiEoS-00AFNa-OZ for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 15:38:09 +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 1tiEoS-00AFLB-Ed for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 15:38:09 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tiEoR-000Qzp-1Q for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 15:38:08 +0000 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-851c4ee2a37so532390039f.3 for ; Wed, 12 Feb 2025 07:38:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739374686; x=1739979486; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Rc7n3iJQ5aIdx6kYjT9TCP7nhF9CsiSQTb4jPBehcyc=; b=CVtY47m3T85ouiiF4/BwLHmGOgN3dpgJ0XqbH9ncJTqOZdA8AMYCBW2fAmToNl+Ux9 b5ObevB+YiUowNQ+aQ0CC/F6vZ0Ay5ZkGd5zW6rYLJf4e+z5ZIxSoSZs9bY7CEonUvkZ mIgehiI6TBJZbq9o87tbrziekdpp1DD+UqXcZOGFcGplQyWSVYP/1bIXMVqx98M3f+Zt Gxi9ike8firKr7wKp3eSNSgFDBKY3HxC3OaefeN8IYbQyO1X9jt77F+2iNucpPIiHgPC pKAk6mhta4tPaTXVYwJfwXQfMoejPaPiQa1AlMssyzTpPIq3oUOLQxeUSsorEkacBR6W qzoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739374686; x=1739979486; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Rc7n3iJQ5aIdx6kYjT9TCP7nhF9CsiSQTb4jPBehcyc=; b=isTHk7qJGdIgCjKX1sobnOH+8varmMVy08EnRG3e2Tp3OAro5GBA1bVi0jyGcaP7j7 loAZMVDOZAjNtqRRhJNHJ2SNldbAjClQELJYYEvnb7tF10uTh5oxlfF32g9RIalsUUiq +q7fKayyUWr9YIXneVDtiVVgq2uIF9/vUEn9Zi/cLdBazMAsDd2i6j2j8Vpd0AC5yjCy 0OuOlykDh8zA9YyZRH5nworUago0FjiIo2Ng+eA/ilFwghdgXnzoJQ5iaIcCuJype2Zu wP7uA6Wi3SP1WMW52f3xb9Un6pTH9G+Fv8X79IRfUaHfCZ176ptW1Vtt1Drmuw9VYM0G 8+qw== X-Forwarded-Encrypted: i=1; AJvYcCVwdiACA1A+j0e2Hn5BG/ANtqyqV94pBDt+31z/g14R1IYo09Mke0x7c7ulC4bxti9c289rNlintH62arc6@lists.postgresql.org X-Gm-Message-State: AOJu0YzP52iYMWllc04wW1qe5f52Zu59vvDqIl9qgbBCj189fCbv7oOM fD+JIWu1/TN0eS963vpBbCwK8NxhkXTbZPGOct5hdCCBIjI6hqEBnCEnhA== X-Gm-Gg: ASbGncvsDo8x4d+1VjY1H4e977vN7OBhaoJe7rTGUINOGxQfeU2ojbqKazI1TATGJ5h bhZjDsayXPO5Mjn1OZrqqekpxNuDq4EyQ+Gh1wpNrOPo+pbp3S+E5AIfTLdh7c08+keoGMMF5mn r/6SeUR6IlqdyFy+4P/CkUkrEx89dWwn9X6GInnaZ5TCC9vyozQOMZ6fN0uRqmZ9P72jsHrvr5A G0gAlGow4NwZUJshWd83wqSfiNw5qhLbH/RTNEBktMFdvFsgZxooaT1GDLMNFD6jusnRyNrrbuV MjXCb0Pvb65uSFMhXZAHFc7umVRszfJRz6zIW8uFhBevLO4qiSxXNx/TfbpJFzPJwkvtm/rKXYx rawqjcw== X-Google-Smtp-Source: AGHT+IF/VIQQLvNEHs/9Ud/ey2OtnrvMOFjpK+N41gC67nW7ayvmQ1AcatyPLTWuwpVnxwaHA6d/9g== X-Received: by 2002:a05:6602:3fd5:b0:849:a2bb:ffdd with SMTP id ca18e2360f4ac-85555cbe80amr426281939f.4.1739374686690; Wed, 12 Feb 2025 07:38:06 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ecff1643d9sm1421586173.140.2025.02.12.07.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 07:38:06 -0800 (PST) Date: Wed, 12 Feb 2025 09:38:04 -0600 From: Nathan Bossart To: Bertrand Drouvot Cc: Julien Rouhaud , pgsql-hackers@lists.postgresql.org Subject: Re: Unneeded volatile qualifier in fmgr.c Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Feb 12, 2025 at 08:41:34AM +0000, Bertrand Drouvot wrote: > On Wed, Feb 12, 2025 at 04:25:38PM +0800, Julien Rouhaud wrote: >> While reading some code in fmgr.c I noticed that the save_nestlevel variable is >> declared as volatile. I'm assuming that's because a long time ago it was >> modified in the PG_TRY / PG_CATCH block but it doesn't look needed anymore. >> >> Trivial patch attached. > > Yeah, makes sense to me. It was modified in the PG_CATCH section when it was first added in commit 2abae34, but that part was removed a week later in commit 82a4798. But I'm not even sure it needed the volatile marker in the first commit, based on the comment in elog.h: * Note: if a local variable of the function containing PG_TRY is modified * in the PG_TRY section and used in the PG_CATCH section, that variable * must be declared "volatile" for POSIX compliance. AFAICT it was never modified in the PG_TRY section. In any case, I don't see a problem with removing "volatile" now, so I'll plan on committing this later today if there are no objections. -- nathan