Merge lp:~jpakkane/libcolumbus/wextra into lp:libcolumbus

Proposed by Jussi Pakkanen
Status: Merged
Approved by: Jussi Pakkanen
Approved revision: 443
Merged at revision: 443
Proposed branch: lp:~jpakkane/libcolumbus/wextra
Merge into: lp:libcolumbus
Diff against target: 414 lines (+41/-37)
26 files modified
CMakeLists.txt (+5/-3)
include/ColumbusCore.hh.in (+2/-0)
src/IndexMatches.cc (+1/-1)
src/Matcher.cc (+1/-1)
src/MatcherStatistics.cc (+1/-1)
test/CAPITest.c (+1/-1)
test/CorpusTest.cc (+1/-1)
test/CustomErrorTest.cc (+1/-1)
test/DocumentTest.cc (+1/-1)
test/ErrorValuesTest.cc (+1/-1)
test/HelpersTest.cc (+1/-1)
test/IndexWeightsTest.cc (+1/-1)
test/LevIndexTest.cc (+1/-1)
test/LevTrieTest.cc (+1/-1)
test/MatchResultsTest.cc (+1/-1)
test/MatcherTest.cc (+1/-1)
test/ResultFilterTest.cc (+1/-1)
test/TrieTest.cc (+1/-1)
test/WordListTest.cc (+1/-1)
test/WordStoreTest.cc (+1/-1)
test/WordTest.cc (+1/-1)
tools/hudtest.cc (+3/-3)
tools/numberpad.cc (+3/-3)
tools/queryapp.cc (+3/-3)
tools/sctest.cc (+3/-3)
tools/singleword.cc (+3/-3)
To merge this branch: bzr merge lp:~jpakkane/libcolumbus/wextra
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+156856@code.launchpad.net

Commit message

Compile with -Wextra.

Description of the change

Always use -Wextra and fix the warnings raised. Also make it easy to use -Weffc++. It is not enabled by default because it causes a lot of noise.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

This can't land now as we use libcolumbus trunk directly for daily release into raring. Trunk probably needs to be split to a 13.04 branch to allow for new development in trunk at this point.

BTW, why the comments for the variable names? (It's late for me..)

review: Needs Fixing
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Splitting the 13/04 branch is fine by me. What is the correct way to get it done?

The argument names are commented out because that is C++ shorthand for "this argument is not used in the function". This does not work in C, so we need to declare the UNUSED macro for that case.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

The split has been done. This can now be merged. If everything is set up correctly it will not end up in raring...

Revision history for this message
Iain Lane (laney) wrote :

It did. I'm rejecting it from the queue. Also, it landed with no commit message - please ensure this doesn't happen again.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-02-15 15:07:55 +0000
3+++ CMakeLists.txt 2013-04-03 13:54:35 +0000
4@@ -7,7 +7,7 @@
5
6 option(enable_tests "Enable tests." ON)
7 option(enable_scalability_tests "Additional scalability tests that are potentially very slow to run." OFF)
8-option(full_warnings "Full compiler warnings." ON)
9+option(full_warnings "All possible compiler warnings." OFF)
10 option(debug_messages "Print debug messages.")
11 option(full_unicode "Enable full Unicode support (takes lots of memory).")
12 option(use_python2 "Build Python bindings against Python 2 (UNSUPPORTED)." OFF)
13@@ -21,9 +21,11 @@
14 include(cmake/python.cmake)
15 include(cmake/coverage.cmake)
16
17+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra")
18+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra")
19 if(${full_warnings})
20- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
21- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
22+# C does not have any more warning flags.
23+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++")
24 endif()
25
26 if(${debug_messages})
27
28=== modified file 'include/ColumbusCore.hh.in'
29--- include/ColumbusCore.hh.in 2013-01-30 10:21:36 +0000
30+++ include/ColumbusCore.hh.in 2013-04-03 13:54:35 +0000
31@@ -47,6 +47,8 @@
32 #endif
33 #endif
34
35+#define UNUSED_VAR __attribute__ ((unused))
36+
37 #ifdef __cplusplus
38 #include <cstddef>
39 #include <cstdint>
40
41=== modified file 'src/IndexMatches.cc'
42--- src/IndexMatches.cc 2012-12-07 11:01:33 +0000
43+++ src/IndexMatches.cc 2013-04-03 13:54:35 +0000
44@@ -50,7 +50,7 @@
45 delete p;
46 }
47
48-void IndexMatches::addMatch(const Word &queryWord, const WordID matchedWord, int error) {
49+void IndexMatches::addMatch(const Word &/*queryWord*/, const WordID matchedWord, int error) {
50 MatchData m;
51 m.matchedWord = matchedWord;
52 m.error = error;
53
54=== modified file 'src/Matcher.cc'
55--- src/Matcher.cc 2013-01-30 15:21:02 +0000
56+++ src/Matcher.cc 2013-04-03 13:54:35 +0000
57@@ -153,7 +153,7 @@
58 return int((1+len/4.0)*LevenshteinIndex::getDefaultError()); // Permit a typo for every fourth letter.
59 }
60
61-static void addMatches(MatcherPrivate *p, BestIndexMatches &bestIndexMatches, const Word &queryWord, const WordID indexID, IndexMatches &matches) {
62+static void addMatches(MatcherPrivate */*p*/, BestIndexMatches &bestIndexMatches, const Word &/*queryWord*/, const WordID indexID, IndexMatches &matches) {
63 MatchIndIterator it = bestIndexMatches.find(indexID);
64 map<WordID, int> *indexMatches;
65 if(it == bestIndexMatches.end()) {
66
67=== modified file 'src/MatcherStatistics.cc'
68--- src/MatcherStatistics.cc 2013-01-30 13:48:22 +0000
69+++ src/MatcherStatistics.cc 2013-04-03 13:54:35 +0000
70@@ -64,7 +64,7 @@
71
72 }
73
74-void MatcherStatistics::addedWordToIndex(const WordID word, const Word &fieldName) {
75+void MatcherStatistics::addedWordToIndex(const WordID /*word*/, const Word &/*fieldName*/) {
76 // Doesn't do anything yet.
77 }
78
79
80=== modified file 'test/CAPITest.c'
81--- test/CAPITest.c 2013-02-18 10:34:40 +0000
82+++ test/CAPITest.c 2013-04-03 13:54:35 +0000
83@@ -118,7 +118,7 @@
84 col_matcher_delete(m);
85 }
86
87-int main(int argc, char **argv) {
88+int main(int argc UNUSED_VAR, char **argv UNUSED_VAR) {
89 testWord();
90 testDocument();
91 testMatcher();
92
93=== modified file 'test/CorpusTest.cc'
94--- test/CorpusTest.cc 2013-01-17 08:58:37 +0000
95+++ test/CorpusTest.cc 2013-04-03 13:54:35 +0000
96@@ -66,7 +66,7 @@
97 assert(lNew[1] == w4);
98 }
99
100-int main(int argc, char **argv) {
101+int main(int /*argc*/, char **/*argv*/) {
102 try {
103 testCorpus();
104 } catch(const std::exception &e) {
105
106=== modified file 'test/CustomErrorTest.cc'
107--- test/CustomErrorTest.cc 2013-01-17 08:58:37 +0000
108+++ test/CustomErrorTest.cc 2013-04-03 13:54:35 +0000
109@@ -67,7 +67,7 @@
110
111
112
113-int main(int argc, char **argv) {
114+int main(int /*argc*/, char **/*argv*/) {
115 try {
116 testCustomError();
117 } catch(const std::exception &e) {
118
119=== modified file 'test/DocumentTest.cc'
120--- test/DocumentTest.cc 2013-01-17 08:58:37 +0000
121+++ test/DocumentTest.cc 2013-04-03 13:54:35 +0000
122@@ -144,7 +144,7 @@
123 assert(d.totalWordCount(w4) == 2);
124 }
125
126-int main(int argc, char **argv) {
127+int main(int /*argc*/, char **/*argv*/) {
128 try {
129 testDoc();
130 testIndexNames();
131
132=== modified file 'test/ErrorValuesTest.cc'
133--- test/ErrorValuesTest.cc 2013-01-17 08:58:37 +0000
134+++ test/ErrorValuesTest.cc 2013-04-03 13:54:35 +0000
135@@ -106,7 +106,7 @@
136 assert(ev.getSubstituteError('j', '6') < ErrorValues::getDefaultError());
137 }
138
139-int main(int argc, char **argv) {
140+int main(int /*argc*/, char **/*argv*/) {
141 try {
142 testError();
143 testGroupError();
144
145=== modified file 'test/HelpersTest.cc'
146--- test/HelpersTest.cc 2013-01-17 08:58:37 +0000
147+++ test/HelpersTest.cc 2013-04-03 13:54:35 +0000
148@@ -62,7 +62,7 @@
149 assert(l.size() == 3);
150 }
151
152-int main(int argc, char **argv) {
153+int main(int /*argc*/, char **/*argv*/) {
154 try {
155 testSplitter();
156 testWeirdWord();
157
158=== modified file 'test/IndexWeightsTest.cc'
159--- test/IndexWeightsTest.cc 2013-01-17 08:58:37 +0000
160+++ test/IndexWeightsTest.cc 2013-04-03 13:54:35 +0000
161@@ -32,7 +32,7 @@
162 assert(w.getWeight(w1) == 2.0);
163 }
164
165-int main(int argc, char **argv) {
166+int main(int /*argc*/, char **/*argv*/) {
167 try {
168 testWeights();
169 } catch(const std::exception &e) {
170
171=== modified file 'test/LevIndexTest.cc'
172--- test/LevIndexTest.cc 2013-01-17 08:58:37 +0000
173+++ test/LevIndexTest.cc 2013-04-03 13:54:35 +0000
174@@ -305,7 +305,7 @@
175 assert(matches.getMatch(0) == w1ID);
176 }
177
178-int main(int argc, char **argv) {
179+int main(int /*argc*/, char **/*argv*/) {
180 try {
181 testTrivial();
182 testSimple();
183
184=== modified file 'test/LevTrieTest.cc'
185--- test/LevTrieTest.cc 2013-01-17 08:58:37 +0000
186+++ test/LevTrieTest.cc 2013-04-03 13:54:35 +0000
187@@ -155,7 +155,7 @@
188 assert(ind.numWords() == 2);
189 }
190
191-int main(int argc, char **argv) {
192+int main(int /*argc*/, char **/*argv*/) {
193 #ifdef NDEBUG
194 fprintf(stderr, "NDEBUG is defined, tests will not work!\n");
195 return 1;
196
197=== modified file 'test/MatchResultsTest.cc'
198--- test/MatchResultsTest.cc 2013-01-17 08:58:37 +0000
199+++ test/MatchResultsTest.cc 2013-04-03 13:54:35 +0000
200@@ -46,7 +46,7 @@
201 assert(r.getRelevancy(0) == r2);
202 }
203
204-int main(int argc, char **argv) {
205+int main(int /*argc*/, char **/*argv*/) {
206 try {
207 testMatchResult();
208 } catch(const std::exception &e) {
209
210=== modified file 'test/MatcherTest.cc'
211--- test/MatcherTest.cc 2013-01-17 08:58:37 +0000
212+++ test/MatcherTest.cc 2013-04-03 13:54:35 +0000
213@@ -127,7 +127,7 @@
214 assert(matches.getDocumentID(0) == correct);
215 }
216
217-int main(int argc, char **argv) {
218+int main(int /*argc*/, char **/*argv*/) {
219 try {
220 testMatcher();
221 testRelevancy();
222
223=== modified file 'test/ResultFilterTest.cc'
224--- test/ResultFilterTest.cc 2013-01-17 08:58:37 +0000
225+++ test/ResultFilterTest.cc 2013-04-03 13:54:35 +0000
226@@ -87,7 +87,7 @@
227 assert(andResults.size() == 0);
228 }
229
230-int main(int argc, char **argv) {
231+int main(int /*argc*/, char **/*argv*/) {
232 try {
233 testFiltering();
234 } catch(const std::exception &e) {
235
236=== modified file 'test/TrieTest.cc'
237--- test/TrieTest.cc 2013-01-31 10:01:17 +0000
238+++ test/TrieTest.cc 2013-04-03 13:54:35 +0000
239@@ -47,7 +47,7 @@
240 }
241
242
243-int main(int argc, char **argv) {
244+int main(int /*argc*/, char **/*argv*/) {
245 // Move basic tests from levtrietest here.
246 testWordBuilding();
247 return 0;
248
249=== modified file 'test/WordListTest.cc'
250--- test/WordListTest.cc 2013-01-17 08:58:37 +0000
251+++ test/WordListTest.cc 2013-04-03 13:54:35 +0000
252@@ -92,7 +92,7 @@
253 assert(l1 != l2);
254 }
255
256-int main(int argc, char **argv) {
257+int main(int /*argc*/, char **/*argv*/) {
258 try {
259 testList();
260 testAssignment();
261
262=== modified file 'test/WordStoreTest.cc'
263--- test/WordStoreTest.cc 2013-01-17 08:58:37 +0000
264+++ test/WordStoreTest.cc 2013-04-03 13:54:35 +0000
265@@ -54,7 +54,7 @@
266 assert(gotException);
267 }
268
269-int main(int argc, char **argv) {
270+int main(int /*argc*/, char **/*argv*/) {
271 try {
272 testStore();
273 } catch(const std::exception &e) {
274
275=== modified file 'test/WordTest.cc'
276--- test/WordTest.cc 2013-01-17 08:58:37 +0000
277+++ test/WordTest.cc 2013-04-03 13:54:35 +0000
278@@ -270,7 +270,7 @@
279 assert(gotAssertion);
280 }
281
282-int main(int argc, char **argv) {
283+int main(int /*argc*/, char **/* argv*/) {
284 try {
285 testEmpty();
286 testIndexing();
287
288=== modified file 'tools/hudtest.cc'
289--- tools/hudtest.cc 2013-01-17 09:17:28 +0000
290+++ tools/hudtest.cc 2013-04-03 13:54:35 +0000
291@@ -48,16 +48,16 @@
292 vector<string> pathSource, commandSource;
293 };
294
295-static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
296+static gboolean delete_event(GtkWidget */*widget*/, GdkEvent */*event*/, gpointer /*data*/) {
297 gtk_main_quit();
298 return TRUE;
299 }
300
301-static void destroy(GtkWidget *widget, gpointer data) {
302+static void destroy(GtkWidget */*widget*/, gpointer /*data*/) {
303 gtk_main_quit ();
304 }
305
306-static void doSearch(GtkWidget *widget, gpointer data) {
307+static void doSearch(GtkWidget */*widget*/, gpointer data) {
308 app_data *app = (app_data*) data;
309 MatchResults matches;
310 GtkTreeIter iter;
311
312=== modified file 'tools/numberpad.cc'
313--- tools/numberpad.cc 2013-01-17 09:09:14 +0000
314+++ tools/numberpad.cc 2013-04-03 13:54:35 +0000
315@@ -46,12 +46,12 @@
316 const char *filename;
317 };
318
319-static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
320+static gboolean delete_event(GtkWidget */*widget*/, GdkEvent */*event*/, gpointer /*data*/) {
321 gtk_main_quit();
322 return TRUE;
323 }
324
325-static void destroy(GtkWidget *widget, gpointer data) {
326+static void destroy(GtkWidget */*widget*/, gpointer /*data*/) {
327 gtk_main_quit ();
328 }
329
330@@ -82,7 +82,7 @@
331 printf("\n\n");
332 }
333
334-static void doSearch(GtkWidget *widget, gpointer data) {
335+static void doSearch(GtkWidget */*widget*/, gpointer data) {
336 app_data *app = (app_data*) data;
337 MatchResults matches;
338 GtkTreeIter iter;
339
340=== modified file 'tools/queryapp.cc'
341--- tools/queryapp.cc 2013-01-17 09:09:14 +0000
342+++ tools/queryapp.cc 2013-04-03 13:54:35 +0000
343@@ -45,16 +45,16 @@
344 vector<string> source;
345 };
346
347-static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
348+static gboolean delete_event(GtkWidget */*widget*/, GdkEvent */*event*/, gpointer /*data*/) {
349 gtk_main_quit();
350 return TRUE;
351 }
352
353-static void destroy(GtkWidget *widget, gpointer data) {
354+static void destroy(GtkWidget */*widget*/, gpointer /*data*/) {
355 gtk_main_quit ();
356 }
357
358-static void doSearch(GtkWidget *widget, gpointer data) {
359+static void doSearch(GtkWidget */*widget*/, gpointer data) {
360 app_data *app = (app_data*) data;
361 MatchResults matches;
362 GtkTreeIter iter;
363
364=== modified file 'tools/sctest.cc'
365--- tools/sctest.cc 2013-01-17 09:09:14 +0000
366+++ tools/sctest.cc 2013-04-03 13:54:35 +0000
367@@ -54,12 +54,12 @@
368 vector<string> names;
369 };
370
371-static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
372+static gboolean delete_event(GtkWidget */*widget*/, GdkEvent */*event*/, gpointer /*data*/) {
373 gtk_main_quit();
374 return TRUE;
375 }
376
377-static void destroy(GtkWidget *widget, gpointer data) {
378+static void destroy(GtkWidget */*widget*/, gpointer /*data*/) {
379 gtk_main_quit ();
380 }
381
382@@ -81,7 +81,7 @@
383 }
384
385
386-static void doSearch(GtkWidget *widget, gpointer data) {
387+static void doSearch(GtkWidget */*widget*/, gpointer data) {
388 app_data *app = (app_data*) data;
389 MatchResults matches;
390 double updateStart, updateEnd;
391
392=== modified file 'tools/singleword.cc'
393--- tools/singleword.cc 2013-01-17 09:09:14 +0000
394+++ tools/singleword.cc 2013-04-03 13:54:35 +0000
395@@ -52,16 +52,16 @@
396 GtkWidget *errorSpinner;
397 };
398
399-static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
400+static gboolean delete_event(GtkWidget */*widget*/, GdkEvent */*event*/, gpointer /*data*/) {
401 gtk_main_quit();
402 return TRUE;
403 }
404
405-static void destroy(GtkWidget *widget, gpointer data) {
406+static void destroy(GtkWidget */*widget*/, gpointer /*data*/) {
407 gtk_main_quit ();
408 }
409
410-static void doSearch(GtkWidget *widget, gpointer data) {
411+static void doSearch(GtkWidget */*widget*/, gpointer data) {
412 app_data *app = (app_data*) data;
413 IndexMatches matches;
414 GtkTreeIter iter;

Subscribers

People subscribed via source and target branches

to all changes: