From: Paul Eggert Date: Sun, 6 Mar 2011 20:15:10 +0000 (-0800) Subject: * xdisp.c (display_line): Mark variables that gcc -Wuninitialized cannot X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~605^2^2~81 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dba6549815e211c820a249cbfe857a92c7418896;p=emacs.git * xdisp.c (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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 8582bf67e04..23bf646f742 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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. diff --git a/src/lisp.h b/src/lisp.h index e38d6a8ec3c..719d72d28a4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -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 diff --git a/src/xdisp.c b/src/xdisp.c index 174312ccab3..180c65d18ed 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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);