aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-04 02:33:09 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-04 02:33:09 +0200
commit8e1dcecd79a91976629362c2a05f5c1ef2495710 (patch)
tree9c7b9e376d8d887ec018402cd99bee391ab43908
parentfix warnings (diff)
downloadlibgammamm-8e1dcecd79a91976629362c2a05f5c1ef2495710.tar.gz
libgammamm-8e1dcecd79a91976629362c2a05f5c1ef2495710.tar.bz2
libgammamm-8e1dcecd79a91976629362c2a05f5c1ef2495710.tar.xz
add -Wshadow
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--Makefile4
-rw-r--r--src/libgamma-error.cc11
-rw-r--r--src/libgamma-method.cc9
-rw-r--r--src/libgamma-method.hh71
4 files changed, 56 insertions, 39 deletions
diff --git a/Makefile b/Makefile
index 1b15304..1e221d3 100644
--- a/Makefile
+++ b/Makefile
@@ -68,7 +68,7 @@ DEFS = __GCC__
# Warning flags, set to empty if you are not using GCC
WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self \
- -Wmissing-include-dirs -Wtrampolines -Wfloat-equal \
+ -Wmissing-include-dirs -Wtrampolines -Wfloat-equal -Wshadow \
-Wmissing-declarations -Wredundant-decls -Winline -Wno-variadic-macros \
-Weffc++ -Wc++11-compat -Wzero-as-null-pointer-constant -Wuseless-cast \
-Wsync-nand -Wunsafe-loop-optimizations -Wcast-align -Wstrict-overflow \
@@ -78,7 +78,7 @@ WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self \
-Wsuggest-attribute=format -Wnormalized=nfkc -Wconversion \
-fstrict-aliasing -fstrict-overflow -fipa-pure-const -ftree-vrp \
-fstack-usage -funsafe-loop-optimizations
-# ignored: -Waggregate-return -Wshadow
+# ignored: -Waggregate-return
diff --git a/src/libgamma-error.cc b/src/libgamma-error.cc
index 951db22..7233584 100644
--- a/src/libgamma-error.cc
+++ b/src/libgamma-error.cc
@@ -75,7 +75,12 @@ namespace libgamma
return libgamma_value_of_error(cstr);
}
-
+
+#ifdef __GCC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wshadow"
+#endif
+
/**
* Constructor.
*
@@ -106,6 +111,10 @@ namespace libgamma
return strerror(this->error_code);
}
+#ifdef __GCC__
+# pragma GCC diagnostic pop
+#endif
+
/**
* Create an exception from an error code
diff --git a/src/libgamma-method.cc b/src/libgamma-method.cc
index 16d61ff..dae9929 100644
--- a/src/libgamma-method.cc
+++ b/src/libgamma-method.cc
@@ -332,7 +332,10 @@ namespace libgamma
return *this;
}
-
+#ifdef __GCC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wshadow"
+#endif
/**
* Constructor.
@@ -540,5 +543,9 @@ namespace libgamma
return r != 0;
}
+#ifdef __GCC__
+# pragma GCC diagnostic pop
+#endif
+
}
diff --git a/src/libgamma-method.hh b/src/libgamma-method.hh
index d4bfed3..09a93bb 100644
--- a/src/libgamma-method.hh
+++ b/src/libgamma-method.hh
@@ -521,13 +521,13 @@ namespace libgamma
/**
* Constructor.
*
- * @param ramp The ramp.
- * @param size The size of the ramp.
+ * @param native_ramp The ramp.
+ * @param ramp_size The size of the ramp.
*/
- Ramp(T* ramp, size_t size)
+ Ramp(T* native_ramp, size_t ramp_size)
{
- this->ramp = ramp;
- this->size = size;
+ this->ramp = native_ramp;
+ this->size = ramp_size;
}
/**
@@ -597,20 +597,21 @@ namespace libgamma
/**
* Constructor.
*
- * @param red The red gamma ramp.
- * @param green The green gamma ramp.
- * @param blue The blue gamma ramp.
- * @param red_size The size of the gamma ramp for the red channel.
- * @param green_size The size of the gamma ramp for the green channel.
- * @param blue_size The size of the gamma ramp for the blue channel.
- * @param depth The bit-depth of the gamma ramps, -1 for single precision
- * floating point, and -2 for double precision floating point.
- */
- GammaRamps(T* red, T* green, T* blue, size_t red_size, size_t green_size, size_t blue_size, signed depth) :
- red(Ramp<T>(red, red_size)),
- green(Ramp<T>(green, green_size)),
- blue(Ramp<T>(blue, blue_size)),
- depth(depth)
+ * @param red_ramp The red gamma ramp.
+ * @param green_ramp The green gamma ramp.
+ * @param blue_ramp The blue gamma ramp.
+ * @param red_size The size of the gamma ramp for the red channel.
+ * @param green_size The size of the gamma ramp for the green channel.
+ * @param blue_size The size of the gamma ramp for the blue channel.
+ * @param gamma_depth The bit-depth of the gamma ramps, -1 for single precision
+ * floating point, and -2 for double precision floating point.
+ */
+ GammaRamps(T* red_ramp, T* green_ramp, T* blue_ramp,
+ size_t red_size, size_t green_size, size_t blue_size, signed gamma_depth) :
+ red(Ramp<T>(red_ramp, red_size)),
+ green(Ramp<T>(green_ramp, green_size)),
+ blue(Ramp<T>(blue_ramp, blue_size)),
+ depth(gamma_depth)
{
/* Do nothing. */
}
@@ -838,15 +839,15 @@ namespace libgamma
bool information(CRTCInformation* output, int32_t fields);
#define __LIBGAMMA_GET_GAMMA(AFFIX) \
- libgamma_gamma_ramps ## AFFIX ## _t native; \
+ libgamma_gamma_ramps ## AFFIX ## _t ramps_; \
int r; \
- native.red = ramps->red.ramp; \
- native.green = ramps->green.ramp; \
- native.blue = ramps->blue.ramp; \
- native.red_size = ramps->red.size; \
- native.green_size = ramps->green.size; \
- native.blue_size = ramps->blue.size; \
- r = libgamma_crtc_get_gamma_ramps ## AFFIX(this->native, &native); \
+ ramps_.red = ramps->red.ramp; \
+ ramps_.green = ramps->green.ramp; \
+ ramps_.blue = ramps->blue.ramp; \
+ ramps_.red_size = ramps->red.size; \
+ ramps_.green_size = ramps->green.size; \
+ ramps_.blue_size = ramps->blue.size; \
+ r = libgamma_crtc_get_gamma_ramps ## AFFIX(this->native, &ramps_); \
if (r != 0) \
throw create_error(r)
@@ -913,15 +914,15 @@ namespace libgamma
#undef __LIBGAMMA_GET_GAMMA
#define __LIBGAMMA_SET_GAMMA(AFFIX) \
- libgamma_gamma_ramps ## AFFIX ## _t native; \
+ libgamma_gamma_ramps ## AFFIX ## _t ramps_; \
int r; \
- native.red = ramps->red.ramp; \
- native.green = ramps->green.ramp; \
- native.blue = ramps->blue.ramp; \
- native.red_size = ramps->red.size; \
- native.green_size = ramps->green.size; \
- native.blue_size = ramps->blue.size; \
- r = libgamma_crtc_set_gamma_ramps ## AFFIX(this->native, native); \
+ ramps_.red = ramps->red.ramp; \
+ ramps_.green = ramps->green.ramp; \
+ ramps_.blue = ramps->blue.ramp; \
+ ramps_.red_size = ramps->red.size; \
+ ramps_.green_size = ramps->green.size; \
+ ramps_.blue_size = ramps->blue.size; \
+ r = libgamma_crtc_set_gamma_ramps ## AFFIX(this->native, ramps_); \
if (r != 0) \
throw create_error(r)