aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Nazarewicz2016-09-12 21:36:28 +0200
committerMichal Nazarewicz2016-09-12 21:57:36 +0200
commitee98ca67f886698b6072095e55b820b1c31e1236 (patch)
tree1aa59f40034ba0f90bcd814d61063b34e4fa383d
parentef474bd3d686cbf43a11056017ca8c92a304a25e (diff)
downloademacs-ee98ca67f886698b6072095e55b820b1c31e1236.tar.gz
emacs-ee98ca67f886698b6072095e55b820b1c31e1236.zip
Fix compiler thinking width and height may be unitialised in frame.c
This fixes the following warning: frame.c: In function ‘x_set_frame_parameters’: frame.c:3329:25: error: ‘width’ may be used uninitialized in this function [-Werror=maybe-uninitialized] adjust_frame_size (f, width_change ? width : -1, ^ * src/frame.c (x_set_frame_parameters): Drop width_changed and height_changed variables in favour of storing that information in width and height variables.
-rw-r--r--src/frame.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/frame.c b/src/frame.c
index 6de55e46c09..166623c980c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3136,8 +3136,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
3136 /* If both of these parameters are present, it's more efficient to 3136 /* If both of these parameters are present, it's more efficient to
3137 set them both at once. So we wait until we've looked at the 3137 set them both at once. So we wait until we've looked at the
3138 entire list before we set them. */ 3138 entire list before we set them. */
3139 int width, height; 3139 int width = -1, height = -1; /* -1 denotes they were not changed. */
3140 bool width_change = false, height_change = false;
3141 3140
3142 /* Same here. */ 3141 /* Same here. */
3143 Lisp_Object left, top; 3142 Lisp_Object left, top;
@@ -3213,30 +3212,18 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
3213 if (EQ (prop, Qwidth)) 3212 if (EQ (prop, Qwidth))
3214 { 3213 {
3215 if (RANGED_INTEGERP (0, val, INT_MAX)) 3214 if (RANGED_INTEGERP (0, val, INT_MAX))
3216 { 3215 width = XFASTINT (val) * FRAME_COLUMN_WIDTH (f) ;
3217 width = XFASTINT (val) * FRAME_COLUMN_WIDTH (f) ;
3218 width_change = true;
3219 }
3220 else if (CONSP (val) && EQ (XCAR (val), Qtext_pixels) 3216 else if (CONSP (val) && EQ (XCAR (val), Qtext_pixels)
3221 && RANGED_INTEGERP (0, XCDR (val), INT_MAX)) 3217 && RANGED_INTEGERP (0, XCDR (val), INT_MAX))
3222 { 3218 width = XFASTINT (XCDR (val));
3223 width = XFASTINT (XCDR (val));
3224 width_change = true;
3225 }
3226 } 3219 }
3227 else if (EQ (prop, Qheight)) 3220 else if (EQ (prop, Qheight))
3228 { 3221 {
3229 if (RANGED_INTEGERP (0, val, INT_MAX)) 3222 if (RANGED_INTEGERP (0, val, INT_MAX))
3230 { 3223 height = XFASTINT (val) * FRAME_LINE_HEIGHT (f);
3231 height = XFASTINT (val) * FRAME_LINE_HEIGHT (f);
3232 height_change = true;
3233 }
3234 else if (CONSP (val) && EQ (XCAR (val), Qtext_pixels) 3224 else if (CONSP (val) && EQ (XCAR (val), Qtext_pixels)
3235 && RANGED_INTEGERP (0, XCDR (val), INT_MAX)) 3225 && RANGED_INTEGERP (0, XCDR (val), INT_MAX))
3236 { 3226 height = XFASTINT (XCDR (val));
3237 height = XFASTINT (XCDR (val));
3238 height_change = true;
3239 }
3240 } 3227 }
3241 else if (EQ (prop, Qtop)) 3228 else if (EQ (prop, Qtop))
3242 top = val; 3229 top = val;
@@ -3318,16 +3305,15 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
3318 3305
3319 XSETFRAME (frame, f); 3306 XSETFRAME (frame, f);
3320 3307
3321 if ((width_change && width != FRAME_TEXT_WIDTH (f)) 3308 if ((width != -1 && width != FRAME_TEXT_WIDTH (f))
3322 || (height_change && height != FRAME_TEXT_HEIGHT (f))) 3309 || (height != -1 && height != FRAME_TEXT_HEIGHT (f)))
3323 /* We could consider checking f->after_make_frame here, but I 3310 /* We could consider checking f->after_make_frame here, but I
3324 don't have the faintest idea why the following is needed at 3311 don't have the faintest idea why the following is needed at
3325 all. With the old setting it can get a Heisenbug when 3312 all. With the old setting it can get a Heisenbug when
3326 EmacsFrameResize intermittently provokes a delayed 3313 EmacsFrameResize intermittently provokes a delayed
3327 change_frame_size in the middle of adjust_frame_size. */ 3314 change_frame_size in the middle of adjust_frame_size. */
3328 /** || (f->can_x_set_window_size && (f->new_height || f->new_width))) **/ 3315 /** || (f->can_x_set_window_size && (f->new_height || f->new_width))) **/
3329 adjust_frame_size (f, width_change ? width : -1, 3316 adjust_frame_size (f, width, height, 1, 0, Qx_set_frame_parameters);
3330 height_change ? height : -1, 1, 0, Qx_set_frame_parameters);
3331 3317
3332 if ((!NILP (left) || !NILP (top)) 3318 if ((!NILP (left) || !NILP (top))
3333 && ! (left_no_change && top_no_change) 3319 && ! (left_no_change && top_no_change)