From: Paul Eggert Date: Sat, 18 Jun 2011 18:09:17 +0000 (-0700) Subject: * lisp.h (lint_assume): New macro. X-Git-Tag: emacs-pretest-24.0.90~104^2~473^2~48 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f2ed8a709551a7125d2e024757262c5bf770766b;p=emacs.git * lisp.h (lint_assume): New macro. * composite.c (composition_gstring_put_cache): * ftfont.c (ftfont_shape_by_flt): Use it to pacify GCC 4.6.0. --- diff --git a/src/ChangeLog b/src/ChangeLog index b0a461fb108..62d6a5b4a04 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-06-18 Paul Eggert + * lisp.h (lint_assume): New macro. + * composite.c (composition_gstring_put_cache): + * ftfont.c (ftfont_shape_by_flt): Use it to pacify GCC 4.6.0. + * editfns.c: Omit unnecessary forward decls, to simplify future changes. * ftfont.c (ftfont_shape_by_flt): Use signed integers for lengths. diff --git a/src/composite.c b/src/composite.c index 1bc7b435e11..f494f454a9c 100644 --- a/src/composite.c +++ b/src/composite.c @@ -680,6 +680,7 @@ composition_gstring_put_cache (Lisp_Object gstring, EMACS_INT len) len = j; } + lint_assume (len <= TYPE_MAXIMUM (EMACS_INT) - 2); copy = Fmake_vector (make_number (len + 2), Qnil); LGSTRING_SET_HEADER (copy, Fcopy_sequence (header)); for (i = 0; i < len; i++) diff --git a/src/ftfont.c b/src/ftfont.c index d1effaa88a9..4e313a89021 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -2412,7 +2412,10 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, if (CHAR_VARIATION_SELECTOR_P (c)) with_variation_selector++; } + len = i; + lint_assume (len <= TYPE_MAXIMUM (EMACS_INT) - 2); + if (with_variation_selector) { setup_otf_gstring (len); diff --git a/src/lisp.h b/src/lisp.h index 1e3036344f5..0d51fc7be71 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3608,11 +3608,19 @@ extern void init_system_name (void); ? 0 \ : (wrong_type_argument (Qlistp, (list))), 1)) -/* Use this to suppress gcc's `...may be used before initialized' warnings. */ +/* Use this to suppress gcc's warnings. */ #ifdef lint + +/* Use CODE only if lint checking is in effect. */ # define IF_LINT(Code) Code + +/* Assume that the expression COND is true. This differs in intent + from 'assert', as it is a message from the programmer to the compiler. */ +# define lint_assume(cond) ((cond) ? (void) 0 : abort ()) + #else # define IF_LINT(Code) /* empty */ +# define lint_assume(cond) ((void) (0 && (cond))) #endif /* The ubiquitous min and max macros. */