Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit b606842

Browse files
Monte Gouldingmontegoulding
authored andcommitted
Turn on -Werror=parentheses
1 parent 51e6ff7 commit b606842

26 files changed

+139
-100
lines changed

config/mac.gypi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
'-Werror=conversion-null',
131131
'-Werror=missing-declarations',
132132
'-Werror=mismatched-new-delete',
133+
'-Werror=parentheses',
133134
'-Werror=unused-variable',
134135
'-Werror=constant-logical-operand',
135136
'-Werror=unknown-pragmas',

engine/src/button.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3283,7 +3283,7 @@ uint2 MCButton::getmousetab(int2 &curx)
32833283
totalwidth += MCFontMeasureTextSubstring(m_font, t_tab, t_range, getstack() -> getdevicetransform()) + 23;
32843284
}
32853285
if (totalwidth < rect.width)
3286-
curx += rect.width - totalwidth >> 1;
3286+
curx += (rect.width - totalwidth) >> 1;
32873287
if (mx < curx)
32883288
return MAXUINT2;
32893289
}

engine/src/buttondraw.cpp

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
125125
Boolean macoption = IsMacEmulatedLF() && style == F_MENU
126126
&& (menumode == WM_OPTION || menumode == WM_COMBO);
127127
Boolean white = MClook != LF_MOTIF && !macoption && !(t_isvista && style == F_MENU && menumode == WM_OPTION)
128-
&& (style == F_MENU && (menumode == WM_OPTION || menumode == WM_COMBO)
129-
|| flags & F_AUTO_ARM && state & CS_ARMED
130-
&& !(flags & F_SHOW_BORDER));
128+
&& ((style == F_MENU && (menumode == WM_OPTION || menumode == WM_COMBO))
129+
|| (flags & F_AUTO_ARM && state & CS_ARMED
130+
&& !(flags & F_SHOW_BORDER)));
131131
if (flags & F_3D && MClook == LF_WIN95
132132
&& state & CS_HILITED && (style == F_STANDARD
133-
|| indicator && flags & F_SHOW_ICON))
133+
|| (indicator && flags & F_SHOW_ICON)))
134134
loff = 1;
135135

136136
if (style == F_MENU && menumode == WM_PULLDOWN && MCcurtheme != NULL &&
@@ -152,10 +152,10 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
152152
else
153153
{
154154
if (flags & F_OPAQUE && (MCcurtheme == NULL || !noback
155-
|| (style == F_STANDARD && (MCcurtheme != NULL &&
156-
!MCcurtheme->iswidgetsupported(WTHEME_TYPE_PUSHBUTTON)) ||
157-
style == F_RECTANGLE && (MCcurtheme != NULL &&
158-
!MCcurtheme->iswidgetsupported(WTHEME_TYPE_BEVELBUTTON)))
155+
|| ((style == F_STANDARD && (MCcurtheme != NULL &&
156+
!MCcurtheme->iswidgetsupported(WTHEME_TYPE_PUSHBUTTON))) ||
157+
(style == F_RECTANGLE && (MCcurtheme != NULL &&
158+
!MCcurtheme->iswidgetsupported(WTHEME_TYPE_BEVELBUTTON))))
159159
|| !(flags & F_SHOW_BORDER)
160160
|| flags & F_SHADOW))
161161
{//define when to not draw using themes
@@ -169,16 +169,15 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
169169
if (flags & F_SHOW_BORDER)
170170
trect = MCU_reduce_rect(trect, borderwidth >> 1);
171171
setforeground(dc, DI_BACK,
172-
(state & CS_HILITED && flags & F_HILITE_FILL
173-
|| state & CS_ARMED && flags & F_ARM_FILL
174-
|| state & CS_ARMED && !(flags & F_SHOW_BORDER)
175-
176-
&& MClook != LF_MOTIF) && loff == 0
177-
&& (flags & F_SHOW_ICON || !indicator)
178-
|| white && state & CS_KFOCUSED && !(state & CS_SUBMENU)
179-
|| macoption && state & CS_SUBMENU,
180-
(white || state & CS_ARMED && !(flags & F_SHOW_BORDER))
181-
&& !macoption);
172+
(((state & CS_HILITED && flags & F_HILITE_FILL)
173+
|| (state & CS_ARMED && flags & F_ARM_FILL)
174+
|| (state & CS_ARMED && !(flags & F_SHOW_BORDER)
175+
&& MClook != LF_MOTIF)) && loff == 0
176+
&& (flags & F_SHOW_ICON || !indicator))
177+
|| (white && state & CS_KFOCUSED && !(state & CS_SUBMENU))
178+
|| (macoption && state & CS_SUBMENU),
179+
(white || ((state & CS_ARMED && !(flags & F_SHOW_BORDER))
180+
&& !macoption)));
182181
switch (style)
183182
{
184183
case F_MENU:
@@ -247,9 +246,8 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
247246
switch (menumode)
248247
{
249248
case WM_PULLDOWN:
250-
if (state & CS_ARMED && !(flags & F_SHOW_BORDER) &&
251-
(MClook == LF_MOTIF || MCcurtheme &&
252-
MCcurtheme->getthemeid() == LF_NATIVEGTK)
249+
if ((state & CS_ARMED && !(flags & F_SHOW_BORDER) &&
250+
(MClook == LF_MOTIF || (MCcurtheme && MCcurtheme->getthemeid() == LF_NATIVEGTK)))
253251
|| flags & F_SHOW_BORDER)
254252
drawpulldown(dc, shadowrect);
255253
break;
@@ -272,9 +270,9 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
272270
drawshadow(dc, rect, shadowoffset);
273271
if (flags & F_3D)
274272
{
275-
if (state & CS_HILITED && flags & F_HILITE_BORDER
276-
|| flags & F_AUTO_ARM && state & CS_ARMED && flags & F_ARM_BORDER
277-
&& !indicator && MClook == LF_MOTIF)
273+
if ((state & CS_HILITED && flags & F_HILITE_BORDER)
274+
|| (flags & F_AUTO_ARM && state & CS_ARMED && flags & F_ARM_BORDER
275+
&& !indicator && MClook == LF_MOTIF))
278276
if (isstdbtn && noback)
279277
drawstandardbutton(dc, shadowrect);
280278
else
@@ -288,16 +286,16 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
288286
draw3d(dc, shadowrect, flags & F_SHOW_BORDER ? ETCH_SUNKEN_BUTTON
289287
: ETCH_RAISED, borderwidth);
290288
else
291-
if (flags & F_SHOW_BORDER || MClook == LF_MOTIF
292-
&& state & (CS_ARMED | CS_KFOCUSED) && flags & F_ARM_BORDER)
289+
if (flags & F_SHOW_BORDER || (MClook == LF_MOTIF
290+
&& (state & (CS_ARMED | CS_KFOCUSED)) && flags & F_ARM_BORDER))
293291
{
294292
if (isstdbtn && noback)
295293
drawstandardbutton(dc, shadowrect);
296294
else
297295
{
298296
uint2 bwidth = borderwidth;
299297
draw3d(dc, shadowrect, shadowrect.height <= bwidth
300-
|| state & CS_HILITED && flags & F_HILITE_BORDER
298+
|| (state & CS_HILITED && flags & F_HILITE_BORDER)
301299
? ETCH_SUNKEN_BUTTON : ETCH_RAISED, bwidth);
302300
}
303301
}
@@ -321,9 +319,9 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
321319

322320
}
323321
else
324-
if (state & CS_HILITED && flags & F_HILITE_BORDER
322+
if ((state & CS_HILITED && flags & F_HILITE_BORDER)
325323
|| flags & F_SHOW_BORDER
326-
|| state & (CS_ARMED | CS_KFOCUSED) && flags & F_ARM_BORDER)
324+
|| ((state & (CS_ARMED | CS_KFOCUSED)) && flags & F_ARM_BORDER))
327325
drawborder(dc, shadowrect, borderwidth);
328326
break;
329327
case F_ROUNDRECT:
@@ -339,9 +337,9 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
339337
}
340338
break;
341339
case F_OVAL_BUTTON:
342-
if (state & CS_HILITED && flags & F_HILITE_BORDER
340+
if ((state & CS_HILITED && flags & F_HILITE_BORDER)
343341
|| flags & F_SHOW_BORDER
344-
|| state & (CS_ARMED | CS_KFOCUSED) && flags & F_ARM_BORDER)
342+
|| ((state & (CS_ARMED | CS_KFOCUSED)) && flags & F_ARM_BORDER))
345343
{
346344
setforeground(dc, DI_FORE, False);
347345
dc->drawarc(shadowrect, 0, 360);
@@ -371,8 +369,8 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
371369
(MClook != LF_MOTIF && style == F_MENU && flags & F_OPAQUE && state & CS_ARMED && !(flags & F_SHOW_BORDER)))
372370
setforeground(dc, DI_PSEUDO_BUTTON_TEXT_SEL, False, True);
373371
else
374-
setforeground(dc, DI_FORE, (state & CS_HILITED && flags & F_HILITE_FILL
375-
|| state & CS_ARMED && flags & F_ARM_FILL) && flags & F_OPAQUE && ((MClook != LF_WIN95 && !MCaqua)
372+
setforeground(dc, DI_FORE, ((state & CS_HILITED && flags & F_HILITE_FILL)
373+
|| ((state & CS_ARMED && flags & F_ARM_FILL) && flags & F_OPAQUE && ((MClook != LF_WIN95 && !MCaqua)))
376374
|| style != F_STANDARD), False);
377375
}
378376
}
@@ -510,8 +508,8 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
510508
}
511509
}
512510
if (MCaqua && IsMacLFAM()
513-
&& ((style == F_STANDARD && noback)|| style == F_MENU
514-
&& menumode == WM_OPTION))
511+
&& ((style == F_STANDARD && noback)|| (style == F_MENU
512+
&& menumode == WM_OPTION)))
515513
sx += 5;
516514
}
517515
break;
@@ -520,7 +518,7 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
520518
if (menumode == WM_OPTION || menumode == WM_COMBO)
521519
sx -= optionrect.width;
522520
// MH-2007-03-16 [[ Bug 3598 ]] Centering of the label did not work correctly on mac os classic and non vista windows option buttons.
523-
if (menumode == WM_OPTION && (MClook == LF_WIN95 && !t_themed_menu || MClook == LF_MAC))
521+
if (menumode == WM_OPTION && ((MClook == LF_WIN95 && !t_themed_menu) || MClook == LF_MAC))
524522
sx = t_content_rect . x + (t_content_rect . width - leftmargin) / 2 - twidth / 2;
525523
if (menumode == WM_CASCADE)
526524
sx -= rect.height >> 1;
@@ -564,7 +562,7 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
564562

565563
if (getstyleint(flags) == F_MENU && menumode == WM_CASCADE && !t_themed_menu)
566564
drawcascade(dc, shadowrect); // draw arrow in text color
567-
if (flags & F_DISABLED && MClook == LF_WIN95 || t_themed_menu)
565+
if ((flags & F_DISABLED && MClook == LF_WIN95) || t_themed_menu)
568566
setforeground(dc, DI_TOP, False);
569567
sy += fheight;
570568

@@ -1518,7 +1516,7 @@ void MCButton::drawtabs(MCDC *dc, MCRectangle &srect)
15181516
twidth += 12;
15191517
uint2 index;
15201518
if (i + 1 == menuhistory
1521-
|| !getcindex(DI_SHADOW, index) && !getpindex(DI_SHADOW, index))
1519+
|| (!getcindex(DI_SHADOW, index) && !getpindex(DI_SHADOW, index)))
15221520
setforeground(dc, DI_BACK, False); //fill with background color
15231521
else
15241522
setforeground(dc, DI_SHADOW, False);

engine/src/deploy_macosx.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,7 +2386,9 @@ static bool diet_strip_symbols(MCDeployDietContext& context, bool p_big_endian,
23862386
t_symtab_command = nil;
23872387
t_dysymtab_command = nil;
23882388
if (t_success)
2389+
{
23892390
for(uint32_t i = 0; i < t_header . ncmds; i++)
2391+
{
23902392
if (t_commands[i] -> cmd == LC_SEGMENT)
23912393
{
23922394
segment_command *t_command;
@@ -2398,6 +2400,8 @@ static bool diet_strip_symbols(MCDeployDietContext& context, bool p_big_endian,
23982400
t_symtab_command = (symtab_command *)t_commands[i];
23992401
else if (t_commands[i] -> cmd == LC_DYSYMTAB)
24002402
t_dysymtab_command = (dysymtab_command *)t_commands[i];
2403+
}
2404+
}
24012405

24022406
// The 'linkedit' segment contains all the data used by the symtab
24032407
// and dysymtab commands. We need to rebuild this segment in the following

engine/src/deploy_windows.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,8 +1691,8 @@ Exec_stat MCDeployToWindows(const MCDeployParameters& p_params)
16911691
// Next we check that there are at least two sections, and they are the
16921692
// right ones.
16931693
if (t_success &&
1694-
(MCStringIsEmpty(p_params . payload) && t_section_count < 2 ||
1695-
!MCStringIsEmpty(p_params . payload) && t_section_count < 3))
1694+
((MCStringIsEmpty(p_params . payload) && t_section_count < 2) ||
1695+
(!MCStringIsEmpty(p_params . payload) && t_section_count < 3)))
16961696
t_success = MCDeployThrow(kMCDeployErrorWindowsMissingSections);
16971697
if (t_success && memcmp(t_resource_section -> Name, ".rsrc", 6) != 0)
16981698
t_success = MCDeployThrow(kMCDeployErrorWindowsNoResourceSection);

engine/src/desktop-dc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ Boolean MCScreenDC::wait(real8 duration, Boolean dispatch, Boolean anyevent)
821821
// Handle pending events
822822
real8 eventtime = exittime;
823823
if (handlepending(curtime, eventtime, dispatch) ||
824-
dispatch && MCEventQueueDispatch())
824+
(dispatch && MCEventQueueDispatch()))
825825
{
826826
if (anyevent)
827827
done = True;

engine/src/desktop-menu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ void MCScreenDC::updatemenubar(Boolean force)
582582
newMenuGroup = MCdefaultmenubar;
583583

584584
//if doesn't need update and not force update then exit
585-
if (newMenuGroup == NULL || newMenuGroup == curMenuGroup && !force && !curMenuGroup->getstate(CS_NEED_UPDATE))
585+
if (newMenuGroup == NULL || (newMenuGroup == curMenuGroup && !force && !curMenuGroup->getstate(CS_NEED_UPDATE)))
586586
return;
587587

588588
// Count the number of menus.

engine/src/eps.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,12 @@ void MCEPS::draw(MCDC *dc, const MCRectangle &dirty, bool p_isolated, bool p_spr
320320
if (flags & F_SHOW_BORDER)
321321
trect = MCU_reduce_rect(trect, -borderwidth);
322322
if (flags & F_SHOW_BORDER)
323+
{
323324
if (flags & F_3D)
324325
draw3d(dc, trect, ETCH_SUNKEN, borderwidth);
325326
else
326327
drawborder(dc, trect, borderwidth);
328+
}
327329
if (getstate(CS_KFOCUSED))
328330
drawfocus(dc, dirty);
329331
}

engine/src/ijpg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static bool read_exif_orientation(j_decompress_ptr cinfo, uint32_t *r_orientatio
188188
jpeg_saved_marker_ptr t_marker;
189189
t_marker = nil;
190190
for(t_marker = cinfo -> marker_list; t_marker != nil; t_marker = t_marker -> next)
191-
if ((t_marker->marker == (JPEG_APP0 + 1)))
191+
if (t_marker->marker == (JPEG_APP0 + 1))
192192
break;
193193

194194
if (t_marker == nil)

engine/src/opensslsocket.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ bool MCSocketsAddToFileDescriptorSets(int4 &r_maxfd, fd_set &r_rmaskfd, fd_set &
330330
if (!fd || MCsockets[i]->resolve_state == kMCSocketStateResolving ||
331331
MCsockets[i]->resolve_state == kMCSocketStateError)
332332
continue;
333-
if (MCsockets[i]->connected && !MCsockets[i]->closing
334-
&& !MCsockets[i]->shared || MCsockets[i]->accepting)
333+
if ((MCsockets[i]->connected && !MCsockets[i]->closing
334+
&& !MCsockets[i]->shared) || MCsockets[i]->accepting)
335335
FD_SET(fd, &r_rmaskfd);
336336
if (!MCsockets[i]->connected || MCsockets[i]->wevents != NULL)
337337
FD_SET(fd, &r_wmaskfd);

0 commit comments

Comments
 (0)