[x264-devel] commit: Shut up some incorrect gcc uninitialized variable warnings ( Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Mon Jan 10 22:00:57 CET 2011


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Wed Jan  5 23:29:36 2011 -0500| [b519e0fba6959fc9725e8c2f83f5926eca8621f8] | committer: Jason Garrett-Glaser 

Shut up some incorrect gcc uninitialized variable warnings

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=b519e0fba6959fc9725e8c2f83f5926eca8621f8
---

 common/osdep.h        |    2 ++
 encoder/encoder.c     |    2 +-
 encoder/ratecontrol.c |    2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/osdep.h b/common/osdep.h
index cc51847..d2dcb79 100644
--- a/common/osdep.h
+++ b/common/osdep.h
@@ -89,6 +89,8 @@
     ALIGNED_16( type name sub1 __VA_ARGS__ )
 #endif
 
+#define UNINIT(x) x=x
+
 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
 #define UNUSED __attribute__((unused))
 #define ALWAYS_INLINE __attribute__((always_inline)) inline
diff --git a/encoder/encoder.c b/encoder/encoder.c
index b5f1d1d..e8138be 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -1862,7 +1862,7 @@ static int x264_slice_write( x264_t *h )
     int i_skip;
     int mb_xy, i_mb_x, i_mb_y;
     int i_skip_bak = 0; /* Shut up GCC. */
-    bs_t bs_bak;
+    bs_t UNINIT(bs_bak);
     x264_cabac_t cabac_bak;
     uint8_t cabac_prevbyte_bak = 0; /* Shut up GCC. */
     int mv_bits_bak = 0;
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index c1896d1..227443a 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -2028,7 +2028,7 @@ static float rate_estimate_qscale( x264_t *h )
 {
     float q;
     x264_ratecontrol_t *rcc = h->rc;
-    ratecontrol_entry_t rce;
+    ratecontrol_entry_t UNINIT(rce);
     int pict_type = h->sh.i_type;
     int64_t total_bits = 8*(h->stat.i_frame_size[SLICE_TYPE_I]
                           + h->stat.i_frame_size[SLICE_TYPE_P]



More information about the x264-devel mailing list