Nux

Merge lp:~3v1n0/nux/gcc-7-fixes into lp:nux

Proposed by Marco Trevisan (Treviño) on 2017-08-16
Status: Merged
Approved by: Andrea Azzarone on 2017-08-18
Approved revision: 890
Merged at revision: 889
Proposed branch: lp:~3v1n0/nux/gcc-7-fixes
Merge into: lp:nux
Diff against target: 258 lines (+79/-18)
6 files modified
Nux/InputMethodIBus.cpp (+1/-0)
Nux/RGBValuator.cpp (+2/-0)
Nux/TextEntry.cpp (+38/-9)
NuxCore/Character/NUni.cpp (+32/-8)
debian/rules (+1/-1)
tests/geis_mock.cpp (+5/-0)
To merge this branch: bzr merge lp:~3v1n0/nux/gcc-7-fixes
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) 2017-08-16 Approve on 2017-08-18
Review via email: mp+329151@code.launchpad.net

Commit message

Nux: mark explicit fallthrough jumps (to please gcc7)

To post a comment you must log in.
Andrea Azzarone (azzar1) wrote :

+1

review: Approve
lp:~3v1n0/nux/gcc-7-fixes updated on 2017-09-22
891. By Marco Trevisan (Treviño) on 2017-09-15

geis-mock: add geis definitions inside extern "C"

892. By Marco Trevisan (Treviño) on 2017-09-22

debian/rules: disable tests on s390x

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/InputMethodIBus.cpp'
2--- Nux/InputMethodIBus.cpp 2015-04-22 16:48:10 +0000
3+++ Nux/InputMethodIBus.cpp 2017-09-22 13:11:49 +0000
4@@ -472,6 +472,7 @@
5 case XK_Super_L:
6 case XK_Super_R:
7 ev.key_modifiers |= KEY_MODIFIER_SUPER;
8+ break;
9 case XK_Caps_Lock:
10 ev.key_modifiers |= KEY_MODIFIER_CAPS_LOCK;
11 break;
12
13=== modified file 'Nux/RGBValuator.cpp'
14--- Nux/RGBValuator.cpp 2012-11-05 21:31:06 +0000
15+++ Nux/RGBValuator.cpp 2017-09-22 13:11:49 +0000
16@@ -85,12 +85,14 @@
17 SetColorModel(color::HSV);
18 SetHSV(x, y, z);
19 SetAlpha(alpha);
20+ break;
21 }
22 case color::HLS:
23 {
24 SetColorModel(color::HLS);
25 SetHLS(x, y, z);
26 SetAlpha(alpha);
27+ break;
28 }
29 default:
30 case color::RGB:
31
32=== modified file 'Nux/TextEntry.cpp'
33--- Nux/TextEntry.cpp 2017-02-13 12:41:29 +0000
34+++ Nux/TextEntry.cpp 2017-09-22 13:11:49 +0000
35@@ -2630,18 +2630,47 @@
36 {
37 default: return false;
38 // Everything else falls through when "true"...
39- case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
40- case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
41- case 2: if ((a = (*--srcptr)) > 0xBF) return false;
42+ case 4:
43+ if ((a = (*--srcptr)) < 0x80 || a > 0xBF)
44+ return false;
45+ [[gnu::fallthrough]];
46+ case 3:
47+ if ((a = (*--srcptr)) < 0x80 || a > 0xBF)
48+ return false;
49+ [[gnu::fallthrough]];
50+ case 2:
51+ if ((a = (*--srcptr)) > 0xBF)
52+ return false;
53+
54 switch (ch) {
55 // No fall-through in this inner switch
56- case 0xE0: if (a < 0xA0) return false; break;
57- case 0xED: if (a > 0x9F) return false; break;
58- case 0xF0: if (a < 0x90) return false; break;
59- case 0xF4: if (a > 0x8F) return false; break;
60- default: if (a < 0x80) return false;
61+ case 0xE0:
62+ if (a < 0xA0)
63+ return false;
64+ break;
65+ case 0xED:
66+ if (a > 0x9F)
67+ return false;
68+ break;
69+ case 0xF0:
70+ if (a < 0x90)
71+ return false;
72+ break;
73+ case 0xF4:
74+ if (a > 0x8F)
75+ return false;
76+ break;
77+ default:
78+ if (a < 0x80)
79+ return false;
80 }
81- case 1: if (ch >= 0x80 && ch < 0xC2) return false;
82+
83+ [[gnu::fallthrough]];
84+ case 1:
85+ if (ch >= 0x80 && ch < 0xC2)
86+ return false;
87+
88+ [[gnu::fallthrough]];
89 }
90
91 if (ch > 0xF4) return false;
92
93=== modified file 'NuxCore/Character/NUni.cpp'
94--- NuxCore/Character/NUni.cpp 2013-11-05 14:15:00 +0000
95+++ NuxCore/Character/NUni.cpp 2017-09-22 13:11:49 +0000
96@@ -371,12 +371,15 @@
97 case 4:
98 *--target = (unsigned char) ( (ch | byteMark) & byteMask);
99 ch >>= 6;
100+ [[gnu::fallthrough]];
101 case 3:
102 *--target = (unsigned char) ( (ch | byteMark) & byteMask);
103 ch >>= 6;
104+ [[gnu::fallthrough]];
105 case 2:
106 *--target = (unsigned char) ( (ch | byteMark) & byteMask);
107 ch >>= 6;
108+ [[gnu::fallthrough]];
109 case 1:
110 *--target = (unsigned char) (ch | firstByteMark[bytesToWrite]);
111 }
112@@ -413,16 +416,19 @@
113 return false;
114 /* Everything else falls through when "true"... */
115 case 4:
116-
117- if ( (a = (*--srcptr) ) < 0x80 || a > 0xBF) return false;
118-
119+ if ( (a = (*--srcptr) ) < 0x80 || a > 0xBF)
120+ return false;
121+
122+ [[gnu::fallthrough]];
123 case 3:
124-
125- if ( (a = (*--srcptr) ) < 0x80 || a > 0xBF) return false;
126-
127+ if ( (a = (*--srcptr) ) < 0x80 || a > 0xBF)
128+ return false;
129+
130+ [[gnu::fallthrough]];
131 case 2:
132
133- if ( (a = (*--srcptr) ) > 0xBF) return false;
134+ if ( (a = (*--srcptr) ) > 0xBF)
135+ return false;
136
137 switch (*source)
138 {
139@@ -452,9 +458,13 @@
140 if (a < 0x80) return false;
141 }
142
143+ [[gnu::fallthrough]];
144+
145 case 1:
146+ if (*source >= 0x80 && *source < 0xC2)
147+ return false;
148
149- if (*source >= 0x80 && *source < 0xC2) return false;
150+ [[gnu::fallthrough]];
151 }
152
153 if (*source > 0xF4) return false;
154@@ -597,18 +607,23 @@
155 case 5:
156 ch += *source++;
157 ch <<= 6; /* remember, illegal UTF-8 */
158+ [[gnu::fallthrough]];
159 case 4:
160 ch += *source++;
161 ch <<= 6; /* remember, illegal UTF-8 */
162+ [[gnu::fallthrough]];
163 case 3:
164 ch += *source++;
165 ch <<= 6;
166+ [[gnu::fallthrough]];
167 case 2:
168 ch += *source++;
169 ch <<= 6;
170+ [[gnu::fallthrough]];
171 case 1:
172 ch += *source++;
173 ch <<= 6;
174+ [[gnu::fallthrough]];
175 case 0:
176 ch += *source++;
177 }
178@@ -748,12 +763,15 @@
179 case 4:
180 *--target = (unsigned char) ( (ch | byteMark) & byteMask);
181 ch >>= 6;
182+ [[gnu::fallthrough]];
183 case 3:
184 *--target = (unsigned char) ( (ch | byteMark) & byteMask);
185 ch >>= 6;
186+ [[gnu::fallthrough]];
187 case 2:
188 *--target = (unsigned char) ( (ch | byteMark) & byteMask);
189 ch >>= 6;
190+ [[gnu::fallthrough]];
191 case 1:
192 *--target = (unsigned char) (ch | firstByteMark[bytesToWrite]);
193 }
194@@ -802,18 +820,23 @@
195 case 5:
196 ch += *source++;
197 ch <<= 6;
198+ [[gnu::fallthrough]];
199 case 4:
200 ch += *source++;
201 ch <<= 6;
202+ [[gnu::fallthrough]];
203 case 3:
204 ch += *source++;
205 ch <<= 6;
206+ [[gnu::fallthrough]];
207 case 2:
208 ch += *source++;
209 ch <<= 6;
210+ [[gnu::fallthrough]];
211 case 1:
212 ch += *source++;
213 ch <<= 6;
214+ [[gnu::fallthrough]];
215 case 0:
216 ch += *source++;
217 }
218@@ -875,6 +898,7 @@
219 ch += *source++;
220 --tmpBytesToRead;
221 if (tmpBytesToRead) ch <<= 6;
222+ [[gnu::fallthrough]];
223 } while (tmpBytesToRead > 0);
224 }
225 In UTF-8 writing code, the switches on "bytesToWrite" are
226
227=== modified file 'debian/rules'
228--- debian/rules 2016-04-18 13:56:06 +0000
229+++ debian/rules 2017-09-22 13:11:49 +0000
230@@ -7,7 +7,7 @@
231 gles2_architectures := armel armhf
232
233 ifneq (,$(filter $(DEB_HOST_ARCH),s390x))
234- DEB_BUILD_OPTIONS := $(DEB_BUILD_OPTIONS) noopt
235+ DEB_BUILD_OPTIONS := $(DEB_BUILD_OPTIONS) noopt nocheck
236 export DEB_BUILD_OPTIONS
237 endif
238
239
240=== modified file 'tests/geis_mock.cpp'
241--- tests/geis_mock.cpp 2012-09-30 23:28:23 +0000
242+++ tests/geis_mock.cpp 2017-09-22 13:11:49 +0000
243@@ -96,6 +96,9 @@
244 vector.push_back(std::move(attr));
245 }
246
247+extern "C"
248+{
249+
250 /******* Geis *******/
251
252 Geis geis_new(GeisString /* init_arg_name */, ...)
253@@ -481,3 +484,5 @@
254 }
255 return GEIS_STATUS_BAD_ARGUMENT;
256 }
257+
258+} // extern "C"

Subscribers

People subscribed via source and target branches