Hi all, I just got a run with CFLAGS with the following options: -Wunused-function -Wunused-variable -Wunused-const-variable -Wno-unused-result -Wunused-parameter -Wunused-macros
And while this generates a lot of noise for callbacks and depending on the environment used, this is also pointing to things which could be simplified: Unused arguments in functions: heap_getsysattr() => tupleDesc brin_start_evacuating_page() => idxRel UpdateIndexRelation() => parentIndexOid SerializeReindexState() => maxsize ginRedoInsertEntry() => isLeaf ginReadTuple() => ginstate, attnum startScanKey() => ginstate resolve_unique_index_expr() => heapRel gistGetNodeBuffer() => giststate heap_tuple_needs_freeze() => buf log_heap_visible() => rnode transformSQLValueFunction() => pstate HeapTupleSatisfiesSelf() => snapshot, buffer HeapTupleSatisfiesAny() (Style enforced by HeapTupleSatisfiesVisibility) _hash_get_newbucket_from_oldbucket => rel RelationPutHeapTuple => relation checkNameSpaceConflicts => pstate toast_delete_datum => rel visibilitymap_clear => rel _bt_relbuf => rel (Quite some cleanup here for the btree code) ReindexPartitionedIndex => parentIdx assignOperTypes => typeinfo storeProcedures => amoid dropOperators => amoid dropProcedures => amoid ATExecColumnDefault => lockmode rename_constraint_internal => recursing ATExecDropIdentity => recursing ATPrepSetStatistics => colNum, newValue, lockmode ATExecAlterColumnGenericOptions => lockmode ATPostAlterTypeParse => lockmode ATExecEnableDisableRule => lockmode sendAuthRequest => port (Quite some simplification) get_qual_from_partbound => rel alloc_edge_table, free_edge_table, gimme_edge, remove_gene => root set_tablefunc_pathlist => rte cost_bitmap_and_node cost_gather_merge cost_gather eclass_useful_for_merging => root initial_cost_hashjoin clear_external_function_hash => filehandle (could be extended) pg_SASL_init => payloadlen reached_end_position => timeline, segment_finished syncTargetDirectory => argv0 parseAclItem => name describeAggregates => verbose blackholeNoticeProcessor => arg There are also some unused constants and macros: PREFER in regcomp.c STATHDRSIZE in tsvector_op.c NAMESPACE_SQLXML in xml.c (here for documentation) messageEquals in parallel.c For some of these functions, the format is determined by the context, take HeapTupleSatisfiesSelf or some planner routines. For others, it usually comes from some code deleted which did not actually correct the related function. Anyway, simplifying all that means usually a back-patch pain. However, in some cases, like for example _bt_relbuf, ReindexPartitionedIndex or sendAuthRequest it can simplify the code as there is no need to move some extra arguments around from an upper layer. Fixing all of these makes little sense, still it seems to me that the cases where we can get extra simplifications for other code paths calling the functions makes sense and that we should fix them. Thoughts? -- Michael
signature.asc
Description: PGP signature