diff options
| author | Paul Eggert | 2016-02-26 08:22:36 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-02-26 08:23:26 -0800 |
| commit | e35f99f2dd35a89b42961fc63c7e2772fb03c792 (patch) | |
| tree | 42737bbd0e7f64d9b6840516b202f0aa914db098 /src | |
| parent | 9583b9e871f89bdc1bf30c24a2090c08ed87e1b5 (diff) | |
| download | emacs-e35f99f2dd35a89b42961fc63c7e2772fb03c792.tar.gz emacs-e35f99f2dd35a89b42961fc63c7e2772fb03c792.zip | |
--enable-gcc-warnings now uses -Wjump-misses-init
When configuring with --enable-gcc-warnings, also enable
-Wjump-misses-init, as it’s confusing to use a goto to skip over
an initialization. Fix the few places in the code that run afoul
of this warning.
* configure.ac (WERROR_CFLAGS): Add -Wjump-misses-init.
* src/doc.c (Fsubstitute_command_keys):
* src/image.c (svg_load_image):
* src/regex.c (re_match_2_internal):
* src/xdisp.c (redisplay_internal, redisplay_window):
Don’t jump over initialization.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc.c | 12 | ||||
| -rw-r--r-- | src/image.c | 125 | ||||
| -rw-r--r-- | src/regex.c | 33 | ||||
| -rw-r--r-- | src/xdisp.c | 14 |
4 files changed, 89 insertions, 95 deletions
| @@ -865,16 +865,14 @@ Otherwise, return a new string. */) | |||
| 865 | \<foo> just sets the keymap used for \[cmd]. */ | 865 | \<foo> just sets the keymap used for \[cmd]. */ |
| 866 | else if (strp[0] == '\\' && (strp[1] == '{' || strp[1] == '<')) | 866 | else if (strp[0] == '\\' && (strp[1] == '{' || strp[1] == '<')) |
| 867 | { | 867 | { |
| 868 | struct buffer *oldbuf; | 868 | { |
| 869 | ptrdiff_t start_idx; | ||
| 870 | /* This is for computing the SHADOWS arg for describe_map_tree. */ | 869 | /* This is for computing the SHADOWS arg for describe_map_tree. */ |
| 871 | Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); | 870 | Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); |
| 872 | Lisp_Object earlier_maps; | ||
| 873 | ptrdiff_t count = SPECPDL_INDEX (); | 871 | ptrdiff_t count = SPECPDL_INDEX (); |
| 874 | 872 | ||
| 875 | strp += 2; /* skip \{ or \< */ | 873 | strp += 2; /* skip \{ or \< */ |
| 876 | start = strp; | 874 | start = strp; |
| 877 | start_idx = start - SDATA (string); | 875 | ptrdiff_t start_idx = start - SDATA (string); |
| 878 | 876 | ||
| 879 | while ((strp - SDATA (string) < SBYTES (string)) | 877 | while ((strp - SDATA (string) < SBYTES (string)) |
| 880 | && *strp != '}' && *strp != '>') | 878 | && *strp != '}' && *strp != '>') |
| @@ -904,7 +902,7 @@ Otherwise, return a new string. */) | |||
| 904 | } | 902 | } |
| 905 | 903 | ||
| 906 | /* Now switch to a temp buffer. */ | 904 | /* Now switch to a temp buffer. */ |
| 907 | oldbuf = current_buffer; | 905 | struct buffer *oldbuf = current_buffer; |
| 908 | set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); | 906 | set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); |
| 909 | /* This is for an unusual case where some after-change | 907 | /* This is for an unusual case where some after-change |
| 910 | function uses 'format' or 'prin1' or something else that | 908 | function uses 'format' or 'prin1' or something else that |
| @@ -929,7 +927,8 @@ Otherwise, return a new string. */) | |||
| 929 | { | 927 | { |
| 930 | /* Get the list of active keymaps that precede this one. | 928 | /* Get the list of active keymaps that precede this one. |
| 931 | If this one's not active, get nil. */ | 929 | If this one's not active, get nil. */ |
| 932 | earlier_maps = Fcdr (Fmemq (tem, Freverse (active_maps))); | 930 | Lisp_Object earlier_maps |
| 931 | = Fcdr (Fmemq (tem, Freverse (active_maps))); | ||
| 933 | describe_map_tree (tem, 1, Fnreverse (earlier_maps), | 932 | describe_map_tree (tem, 1, Fnreverse (earlier_maps), |
| 934 | Qnil, 0, 1, 0, 0, 1); | 933 | Qnil, 0, 1, 0, 0, 1); |
| 935 | } | 934 | } |
| @@ -937,6 +936,7 @@ Otherwise, return a new string. */) | |||
| 937 | Ferase_buffer (); | 936 | Ferase_buffer (); |
| 938 | set_buffer_internal (oldbuf); | 937 | set_buffer_internal (oldbuf); |
| 939 | unbind_to (count, Qnil); | 938 | unbind_to (count, Qnil); |
| 939 | } | ||
| 940 | 940 | ||
| 941 | subst_string: | 941 | subst_string: |
| 942 | start = SDATA (tem); | 942 | start = SDATA (tem); |
diff --git a/src/image.c b/src/image.c index 9ba1a7972f0..aa45b001d30 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -9257,8 +9257,8 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 9257 | eassert (gdk_pixbuf_get_has_alpha (pixbuf)); | 9257 | eassert (gdk_pixbuf_get_has_alpha (pixbuf)); |
| 9258 | eassert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8); | 9258 | eassert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8); |
| 9259 | 9259 | ||
| 9260 | #ifdef USE_CAIRO | ||
| 9261 | { | 9260 | { |
| 9261 | #ifdef USE_CAIRO | ||
| 9262 | unsigned char *data = (unsigned char *) xmalloc (width*height*4); | 9262 | unsigned char *data = (unsigned char *) xmalloc (width*height*4); |
| 9263 | uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f); | 9263 | uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f); |
| 9264 | 9264 | ||
| @@ -9284,82 +9284,77 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 9284 | 9284 | ||
| 9285 | create_cairo_image_surface (img, data, width, height); | 9285 | create_cairo_image_surface (img, data, width, height); |
| 9286 | g_object_unref (pixbuf); | 9286 | g_object_unref (pixbuf); |
| 9287 | } | ||
| 9288 | #else | 9287 | #else |
| 9289 | /* Try to create a x pixmap to hold the svg pixmap. */ | 9288 | /* Try to create a x pixmap to hold the svg pixmap. */ |
| 9290 | XImagePtr ximg; | 9289 | XImagePtr ximg; |
| 9291 | if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) | 9290 | if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) |
| 9292 | { | 9291 | { |
| 9293 | g_object_unref (pixbuf); | 9292 | g_object_unref (pixbuf); |
| 9294 | return 0; | 9293 | return 0; |
| 9295 | } | 9294 | } |
| 9296 | 9295 | ||
| 9297 | init_color_table (); | 9296 | init_color_table (); |
| 9298 | 9297 | ||
| 9299 | /* Handle alpha channel by combining the image with a background | 9298 | /* Handle alpha channel by combining the image with a background |
| 9300 | color. */ | 9299 | color. */ |
| 9301 | XColor background; | 9300 | XColor background; |
| 9302 | Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); | 9301 | Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL); |
| 9303 | if (!STRINGP (specified_bg) | 9302 | if (!STRINGP (specified_bg) |
| 9304 | || !x_defined_color (f, SSDATA (specified_bg), &background, 0)) | 9303 | || !x_defined_color (f, SSDATA (specified_bg), &background, 0)) |
| 9305 | x_query_frame_background_color (f, &background); | 9304 | x_query_frame_background_color (f, &background); |
| 9306 | 9305 | ||
| 9307 | /* SVG pixmaps specify transparency in the last byte, so right | 9306 | /* SVG pixmaps specify transparency in the last byte, so right |
| 9308 | shift 8 bits to get rid of it, since emacs doesn't support | 9307 | shift 8 bits to get rid of it, since emacs doesn't support |
| 9309 | transparency. */ | 9308 | transparency. */ |
| 9310 | background.red >>= 8; | 9309 | background.red >>= 8; |
| 9311 | background.green >>= 8; | 9310 | background.green >>= 8; |
| 9312 | background.blue >>= 8; | 9311 | background.blue >>= 8; |
| 9313 | 9312 | ||
| 9314 | /* This loop handles opacity values, since Emacs assumes | 9313 | /* This loop handles opacity values, since Emacs assumes |
| 9315 | non-transparent images. Each pixel must be "flattened" by | 9314 | non-transparent images. Each pixel must be "flattened" by |
| 9316 | calculating the resulting color, given the transparency of the | 9315 | calculating the resulting color, given the transparency of the |
| 9317 | pixel, and the image background color. */ | 9316 | pixel, and the image background color. */ |
| 9318 | for (int y = 0; y < height; ++y) | 9317 | for (int y = 0; y < height; ++y) |
| 9319 | { | 9318 | { |
| 9320 | for (int x = 0; x < width; ++x) | 9319 | for (int x = 0; x < width; ++x) |
| 9321 | { | 9320 | { |
| 9322 | int red; | 9321 | int red = *pixels++; |
| 9323 | int green; | 9322 | int green = *pixels++; |
| 9324 | int blue; | 9323 | int blue = *pixels++; |
| 9325 | int opacity; | 9324 | int opacity = *pixels++; |
| 9326 | 9325 | ||
| 9327 | red = *pixels++; | 9326 | red = ((red * opacity) |
| 9328 | green = *pixels++; | 9327 | + (background.red * ((1 << 8) - opacity))); |
| 9329 | blue = *pixels++; | 9328 | green = ((green * opacity) |
| 9330 | opacity = *pixels++; | 9329 | + (background.green * ((1 << 8) - opacity))); |
| 9331 | 9330 | blue = ((blue * opacity) | |
| 9332 | red = ((red * opacity) | 9331 | + (background.blue * ((1 << 8) - opacity))); |
| 9333 | + (background.red * ((1 << 8) - opacity))); | 9332 | |
| 9334 | green = ((green * opacity) | 9333 | XPutPixel (ximg, x, y, lookup_rgb_color (f, red, green, blue)); |
| 9335 | + (background.green * ((1 << 8) - opacity))); | 9334 | } |
| 9336 | blue = ((blue * opacity) | ||
| 9337 | + (background.blue * ((1 << 8) - opacity))); | ||
| 9338 | |||
| 9339 | XPutPixel (ximg, x, y, lookup_rgb_color (f, red, green, blue)); | ||
| 9340 | } | ||
| 9341 | 9335 | ||
| 9342 | pixels += rowstride - 4 * width; | 9336 | pixels += rowstride - 4 * width; |
| 9343 | } | 9337 | } |
| 9344 | 9338 | ||
| 9345 | #ifdef COLOR_TABLE_SUPPORT | 9339 | #ifdef COLOR_TABLE_SUPPORT |
| 9346 | /* Remember colors allocated for this image. */ | 9340 | /* Remember colors allocated for this image. */ |
| 9347 | img->colors = colors_in_color_table (&img->ncolors); | 9341 | img->colors = colors_in_color_table (&img->ncolors); |
| 9348 | free_color_table (); | 9342 | free_color_table (); |
| 9349 | #endif /* COLOR_TABLE_SUPPORT */ | 9343 | #endif /* COLOR_TABLE_SUPPORT */ |
| 9350 | 9344 | ||
| 9351 | g_object_unref (pixbuf); | 9345 | g_object_unref (pixbuf); |
| 9352 | 9346 | ||
| 9353 | img->width = width; | 9347 | img->width = width; |
| 9354 | img->height = height; | 9348 | img->height = height; |
| 9355 | 9349 | ||
| 9356 | /* Maybe fill in the background field while we have ximg handy. | 9350 | /* Maybe fill in the background field while we have ximg handy. |
| 9357 | Casting avoids a GCC warning. */ | 9351 | Casting avoids a GCC warning. */ |
| 9358 | IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg); | 9352 | IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg); |
| 9359 | 9353 | ||
| 9360 | /* Put ximg into the image. */ | 9354 | /* Put ximg into the image. */ |
| 9361 | image_put_x_image (f, img, ximg, 0); | 9355 | image_put_x_image (f, img, ximg, 0); |
| 9362 | #endif /* ! USE_CAIRO */ | 9356 | #endif /* ! USE_CAIRO */ |
| 9357 | } | ||
| 9363 | 9358 | ||
| 9364 | return 1; | 9359 | return 1; |
| 9365 | 9360 | ||
diff --git a/src/regex.c b/src/regex.c index 164eb4612ae..d5c58aeaf8b 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -5140,8 +5140,6 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, | |||
| 5140 | 5140 | ||
| 5141 | if (p == pend) | 5141 | if (p == pend) |
| 5142 | { | 5142 | { |
| 5143 | ptrdiff_t dcnt; | ||
| 5144 | |||
| 5145 | /* End of pattern means we might have succeeded. */ | 5143 | /* End of pattern means we might have succeeded. */ |
| 5146 | DEBUG_PRINT ("end of pattern ... "); | 5144 | DEBUG_PRINT ("end of pattern ... "); |
| 5147 | 5145 | ||
| @@ -5149,19 +5147,22 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, | |||
| 5149 | longest match, try backtracking. */ | 5147 | longest match, try backtracking. */ |
| 5150 | if (d != end_match_2) | 5148 | if (d != end_match_2) |
| 5151 | { | 5149 | { |
| 5152 | /* 1 if this match ends in the same string (string1 or string2) | 5150 | /* True if this match is the best seen so far. */ |
| 5153 | as the best previous match. */ | 5151 | bool best_match_p; |
| 5154 | boolean same_str_p = (FIRST_STRING_P (match_end) | 5152 | |
| 5155 | == FIRST_STRING_P (d)); | 5153 | { |
| 5156 | /* 1 if this match is the best seen so far. */ | 5154 | /* True if this match ends in the same string (string1 |
| 5157 | boolean best_match_p; | 5155 | or string2) as the best previous match. */ |
| 5158 | 5156 | bool same_str_p = (FIRST_STRING_P (match_end) | |
| 5159 | /* AIX compiler got confused when this was combined | 5157 | == FIRST_STRING_P (d)); |
| 5160 | with the previous declaration. */ | 5158 | |
| 5161 | if (same_str_p) | 5159 | /* AIX compiler got confused when this was combined |
| 5162 | best_match_p = d > match_end; | 5160 | with the previous declaration. */ |
| 5163 | else | 5161 | if (same_str_p) |
| 5164 | best_match_p = !FIRST_STRING_P (d); | 5162 | best_match_p = d > match_end; |
| 5163 | else | ||
| 5164 | best_match_p = !FIRST_STRING_P (d); | ||
| 5165 | } | ||
| 5165 | 5166 | ||
| 5166 | DEBUG_PRINT ("backtracking.\n"); | 5167 | DEBUG_PRINT ("backtracking.\n"); |
| 5167 | 5168 | ||
| @@ -5290,7 +5291,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, | |||
| 5290 | nfailure_points_pushed - nfailure_points_popped); | 5291 | nfailure_points_pushed - nfailure_points_popped); |
| 5291 | DEBUG_PRINT ("%u registers pushed.\n", num_regs_pushed); | 5292 | DEBUG_PRINT ("%u registers pushed.\n", num_regs_pushed); |
| 5292 | 5293 | ||
| 5293 | dcnt = POINTER_TO_OFFSET (d) - pos; | 5294 | ptrdiff_t dcnt = POINTER_TO_OFFSET (d) - pos; |
| 5294 | 5295 | ||
| 5295 | DEBUG_PRINT ("Returning %td from re_match_2.\n", dcnt); | 5296 | DEBUG_PRINT ("Returning %td from re_match_2.\n", dcnt); |
| 5296 | 5297 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 4330f106002..acb275481ad 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -13989,9 +13989,6 @@ redisplay_internal (void) | |||
| 13989 | } | 13989 | } |
| 13990 | else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) | 13990 | else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) |
| 13991 | { | 13991 | { |
| 13992 | Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); | ||
| 13993 | struct frame *mini_frame; | ||
| 13994 | |||
| 13995 | displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents); | 13992 | displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents); |
| 13996 | /* Use list_of_error, not Qerror, so that | 13993 | /* Use list_of_error, not Qerror, so that |
| 13997 | we catch only errors and don't run the debugger. */ | 13994 | we catch only errors and don't run the debugger. */ |
| @@ -13999,8 +13996,8 @@ redisplay_internal (void) | |||
| 13999 | list_of_error, | 13996 | list_of_error, |
| 14000 | redisplay_window_error); | 13997 | redisplay_window_error); |
| 14001 | if (update_miniwindow_p) | 13998 | if (update_miniwindow_p) |
| 14002 | internal_condition_case_1 (redisplay_window_1, mini_window, | 13999 | internal_condition_case_1 (redisplay_window_1, |
| 14003 | list_of_error, | 14000 | FRAME_MINIBUF_WINDOW (sf), list_of_error, |
| 14004 | redisplay_window_error); | 14001 | redisplay_window_error); |
| 14005 | 14002 | ||
| 14006 | /* Compare desired and current matrices, perform output. */ | 14003 | /* Compare desired and current matrices, perform output. */ |
| @@ -14050,8 +14047,8 @@ redisplay_internal (void) | |||
| 14050 | have put text on a frame other than the selected one, so the | 14047 | have put text on a frame other than the selected one, so the |
| 14051 | above call to update_frame would not have caught it. Catch | 14048 | above call to update_frame would not have caught it. Catch |
| 14052 | it here. */ | 14049 | it here. */ |
| 14053 | mini_window = FRAME_MINIBUF_WINDOW (sf); | 14050 | Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); |
| 14054 | mini_frame = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); | 14051 | struct frame *mini_frame = XFRAME (WINDOW_FRAME (XWINDOW (mini_window))); |
| 14055 | 14052 | ||
| 14056 | if (mini_frame != sf && FRAME_WINDOW_P (mini_frame)) | 14053 | if (mini_frame != sf && FRAME_WINDOW_P (mini_frame)) |
| 14057 | { | 14054 | { |
| @@ -16041,6 +16038,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) | |||
| 16041 | bool last_line_misfit = false; | 16038 | bool last_line_misfit = false; |
| 16042 | ptrdiff_t beg_unchanged, end_unchanged; | 16039 | ptrdiff_t beg_unchanged, end_unchanged; |
| 16043 | int frame_line_height; | 16040 | int frame_line_height; |
| 16041 | bool use_desired_matrix; | ||
| 16044 | 16042 | ||
| 16045 | SET_TEXT_POS (lpoint, PT, PT_BYTE); | 16043 | SET_TEXT_POS (lpoint, PT, PT_BYTE); |
| 16046 | opoint = lpoint; | 16044 | opoint = lpoint; |
| @@ -16763,7 +16761,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) | |||
| 16763 | startp = run_window_scroll_functions (window, it.current.pos); | 16761 | startp = run_window_scroll_functions (window, it.current.pos); |
| 16764 | 16762 | ||
| 16765 | /* Redisplay the window. */ | 16763 | /* Redisplay the window. */ |
| 16766 | bool use_desired_matrix = false; | 16764 | use_desired_matrix = false; |
| 16767 | if (!current_matrix_up_to_date_p | 16765 | if (!current_matrix_up_to_date_p |
| 16768 | || windows_or_buffers_changed | 16766 | || windows_or_buffers_changed |
| 16769 | || f->cursor_type_changed | 16767 | || f->cursor_type_changed |