-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADBDEV-6655: Fix -Wunused-but-set-variable errors #1107
base: adb-7.2.0
Are you sure you want to change the base?
Conversation
#ifdef USE_ASSERT_CHECKING | ||
AOCODMLState *state; | ||
#endif | ||
Assert(aocoDMLStates.state_table); | ||
|
||
state = (AOCODMLState *) hash_search(aocoDMLStates.state_table, | ||
#ifdef USE_ASSERT_CHECKING | ||
state = (AOCODMLState *) | ||
#endif | ||
hash_search(aocoDMLStates.state_table, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to use one ifdef and don't cast, because the type of state
does not matter
Assert(aocoDMLStates.state_table);
#ifdef USE_ASSERT_CHECKING
void* state =
#endif
hash_search(aocoDMLStates.state_table,
/* Remember if it's a system catalog */ | ||
is_system_catalog = IsSystemRelation(heapRelation); | ||
#endif | ||
|
||
/* Appendoptimized catalog tables are not supported. */ | ||
Assert(!is_system_catalog); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about Assert(!IsSystemRelation(heapRelation));
? IsSystemRelation doesn't change anything
@@ -1858,6 +1868,7 @@ aoco_index_build_range_scan(Relation heapRelation, | |||
* only one of those is requested. | |||
*/ | |||
Assert(!(anyvisible && checking_uniqueness)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can replace checking_uniqueness
with (indexInfo->ii_Unique || indexInfo->ii_ExclusionOps != NULL)
. In this case we can remove variable and ifdef
#ifdef USE_ASSERT_CHECKING | ||
err = | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use one ifdef instead of two
#ifdef USE_ASSERT_CHECKING | |
err = | |
#endif | |
#ifdef USE_ASSERT_CHECKING | |
int err = | |
#endif |
@@ -1611,7 +1613,9 @@ aorow_compression_ratio_internal(Relation parentrel) | |||
|
|||
/* Do the query. */ | |||
ret = SPI_execute(sqlstmt.data, false, 0); | |||
#ifdef USE_ASSERT_CHECKING | |||
proc = (int) SPI_processed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use SPI_processed in Assert and remove the proc variable?
Fix -Wunused-but-set-variable errors
Commit 4be34c4 fixed the most part of 'unused-but-set-variable' errors, but some
of them were suppressed by
-Wno-unused-but-set-variable
flag in configurescript.
This patch removes this flag and fixes all the errors that emerged after. The
error can't be fixed for files generated by Yacc, so
-Wno-unused-but-set-variable
was remained intact for them.Co-authored-by: Vladimir Sarmin <[email protected]>