public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Masahiko Sawada <[email protected]>
Cc: David Rowley <[email protected]>
Cc: [email protected]
Subject: Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p
Date: Wed, 12 Mar 2025 01:18:09 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAD21AoDQJdQG3V3zvH7x9rEF97E8VD5OarArfpY+f4bEK5wNkw@mail.gmail.com>
References: <[email protected]>
	<CAApHDvqrhFfnetbcwgGkJ=z63T8HfQ_OyP=vX8BYiXyxFKt67w@mail.gmail.com>
	<CAD21AoDQJdQG3V3zvH7x9rEF97E8VD5OarArfpY+f4bEK5wNkw@mail.gmail.com>

Masahiko Sawada <[email protected]> writes:
> On Tue, Mar 11, 2025 at 7:08 PM David Rowley <[email protected]> wrote:
>> This introduces a new compiler warning for compilers that don't know
>> the ereport(ERROR) does not return.

> Thank you for the report. Can we generate the warning using some gcc's
> warning flags? I'd like to add a check to my personal pre-commit test.

I don't know of an easy way.  I experimented with doing this:

diff --git a/src/include/c.h b/src/include/c.h
index a14c6315162..467b1f58ae8 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -315,7 +315,7 @@
 #elif defined(_MSC_VER) && !defined(USE_ASSERT_CHECKING)
 #define pg_unreachable() __assume(0)
 #else
-#define pg_unreachable() abort()
+#define pg_unreachable() ((void) 0)
 #endif
 
 /*

which seems like it ought to be enough to provoke such warnings
(in assert-enabled builds).  I got upwards of sixty build warnings
this way, but the place David mentions was *not* among them.
So I'm confused.

			regards, tom lane





view thread (16+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox