[libcamera-devel,v4,15/15] meson: Enable shadowed variable warning
diff mbox series

Message ID 20201021154148.511505-16-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • Shadowed Variables
Related show

Commit Message

Kieran Bingham Oct. 21, 2020, 3:41 p.m. UTC
Shadowing variables can lead to unexpected bugs where a code path
utilises a variable that may not have been intended by the developer,
leading to hard to find bugs.

Enable warnings for shadowed variables as defined at:
  https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow

As an effect of utilising -Werror, this will cause variable or type
shadowing to become a build-time error.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 meson.build | 1 +
 1 file changed, 1 insertion(+)

Patch
diff mbox series

diff --git a/meson.build b/meson.build
index b0c17d3e430b..e6f6c84a13e0 100644
--- a/meson.build
+++ b/meson.build
@@ -38,6 +38,7 @@  if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOUR
 endif
 
 common_arguments = [
+    '-Wshadow',
     '-include', 'config.h',
 ]