[MXS-2185] Add -Wshadow to MaxScale Created: 2018-11-23  Updated: 2023-09-12  Resolved: 2023-09-12

Status: Closed
Project: MariaDB MaxScale
Component/s: Core
Affects Version/s: None
Fix Version/s: 23.08.1

Type: Task Priority: Trivial
Reporter: markus makela Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None

Sprint: MXS-SPRINT-190

 Description   

This removes ambiguity from the code and prevents surprises.

A bunch of global variables are exposed in paths.h and some constructors have arguments with the same name as a member variable.



 Comments   
Comment by markus makela [ 2021-11-22 ]

At the same time -Wextra could be added.

Comment by markus makela [ 2023-09-04 ]

Turns out that -Wshadow causes a bunch of problems with globals like the MYSQL struct where they conflict with enum class declarations. I'm not sure if this is a bug in GCC but it doesn't seem helpful. With -Wshadow=local only local variables trigger the warnings. With it, variables and parameters to lambda function also cause warnings but this could be considered useful since it's possible for them to refer to variables outside of the lambda function.

Generated at Thu Feb 08 04:12:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.