]> code.delx.au - gnu-emacs/commitdiff
* xdisp.c (display_line): Mark variables that gcc -Wuninitialized cannot
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 6 Mar 2011 20:15:10 +0000 (12:15 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 6 Mar 2011 20:15:10 +0000 (12:15 -0800)
deduce are never used uninitialized.
* lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c
which in turn is copied from coreutils.

src/ChangeLog
src/lisp.h
src/xdisp.c

index 8582bf67e04dead540128a9b1029393254beb737..23bf646f7422fc3300ddce22c4b630f7ae58345c 100644 (file)
@@ -4,6 +4,10 @@
        Add a FIXME comment, since the code still doesn't look right.
        (Fcurrent_bidi_paragraph_direction): Simplify slightly; this
        avoids a gcc -Wuninitialized diagnostic.
+       (display_line): Mark variables that gcc -Wuninitialized cannot
+       deduce are never used uninitialized.
+       * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c
+       which in turn is copied from coreutils.
 
        current_column: Now returns EMACS_INT, fixing some iftc.
        * bytecode.c (Fbyte_code): Don't cast current_column () to int.
index e38d6a8ec3cf43cc09782d12f3296391e031774d..719d72d28a4df9caf5b6bfe37a48477ff0c553da 100644 (file)
@@ -3524,6 +3524,13 @@ extern void init_system_name (void);
             && (circular_list_error ((list)), 1)))     \
         : 0)))
 
+/* Use this to suppress gcc's `...may be used before initialized' warnings. */
+#ifdef lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
+#endif
+
 /* The ubiquitous min and max macros.  */
 
 #ifdef max
index 174312ccab345ab76d8b4c2841f8874391a92b96..180c65d18edf4a7ce23bd0b18c1fcb52644181b5 100644 (file)
@@ -17231,14 +17231,16 @@ display_line (struct it *it)
   struct glyph_row *row = it->glyph_row;
   Lisp_Object overlay_arrow_string;
   struct it wrap_it;
-  int may_wrap = 0, wrap_x;
-  int wrap_row_used = -1, wrap_row_ascent, wrap_row_height;
-  int wrap_row_phys_ascent, wrap_row_phys_height;
-  int wrap_row_extra_line_spacing;
-  EMACS_INT wrap_row_min_pos, wrap_row_min_bpos;
-  EMACS_INT wrap_row_max_pos, wrap_row_max_bpos;
+  int may_wrap = 0, wrap_x IF_LINT (= 0);
+  int wrap_row_used = -1;
+  int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0);
+  int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0);
+  int wrap_row_extra_line_spacing IF_LINT (= 0);
+  EMACS_INT wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0);
+  EMACS_INT wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0);
   int cvpos;
-  EMACS_INT min_pos = ZV + 1, min_bpos, max_pos = 0, max_bpos;
+  EMACS_INT min_pos = ZV + 1, max_pos = 0;
+  EMACS_INT min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0);
 
   /* We always start displaying at hpos zero even if hscrolled.  */
   xassert (it->hpos == 0 && it->current_x == 0);