Skip to content

Commit

Permalink
Warn if result of ts_set_flags_32 is not used
Browse files Browse the repository at this point in the history
The ts_set_flags_32 function takes a bitmap and flags and returns an
updated bitmap. However, if the returned value is not used, the function
call has no effect. An unused result may indicate the improper use of this
function.

This patch adds the qualifier pg_nodiscard to the function which
triggers a warning if the returned value is not used.
  • Loading branch information
jnidzwetzki committed Jul 5, 2023
1 parent 06d20b1 commit 490bc91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ ts_flags_are_set_32(uint32 bitmap, uint32 flags)
return (bitmap & flags) == flags;
}

static inline uint32
static inline pg_nodiscard uint32
ts_set_flags_32(uint32 bitmap, uint32 flags)
{
return bitmap | flags;
Expand Down

0 comments on commit 490bc91

Please sign in to comment.