Skip to content

Commit 4ca50e0

Browse files
committed
Avoid inconsistent type declaration
Clang 3.3 correctly complains that a variable of type enum MultiXactStatus cannot hold a value of -1, which makes sense. Change the declared type of the variable to int instead, and apply casting as necessary to avoid the warning. Per notice from Andres Freund
1 parent 81166a2 commit 4ca50e0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/backend/access/heap/heapam.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,15 @@ static bool ConditionalMultiXactIdWait(MultiXactId multi,
116116
* update them). This table (and the macros below) helps us determine the
117117
* heavyweight lock mode and MultiXactStatus values to use for any particular
118118
* tuple lock strength.
119+
*
120+
* Don't look at lockstatus/updstatus directly! Use get_mxact_status_for_lock
121+
* instead.
119122
*/
120123
static const struct
121124
{
122125
LOCKMODE hwlock;
123-
MultiXactStatus lockstatus;
124-
MultiXactStatus updstatus;
126+
int lockstatus;
127+
int updstatus;
125128
}
126129

127130
tupleLockExtraInfo[MaxLockTupleMode + 1] =
@@ -3847,7 +3850,7 @@ simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
38473850
static MultiXactStatus
38483851
get_mxact_status_for_lock(LockTupleMode mode, bool is_update)
38493852
{
3850-
MultiXactStatus retval;
3853+
int retval;
38513854

38523855
if (is_update)
38533856
retval = tupleLockExtraInfo[mode].updstatus;
@@ -3858,7 +3861,7 @@ get_mxact_status_for_lock(LockTupleMode mode, bool is_update)
38583861
elog(ERROR, "invalid lock tuple mode %d/%s", mode,
38593862
is_update ? "true" : "false");
38603863

3861-
return retval;
3864+
return (MultiXactStatus) retval;
38623865
}
38633866

38643867

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy