Merge lp:~brianaker/drizzle/clang-support into lp:drizzle
- clang-support
- Merge into 7.2
Status: | Merged |
---|---|
Approved by: | Brian Aker |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2581 |
Proposed branch: | lp:~brianaker/drizzle/clang-support |
Merge into: | lp:drizzle |
Diff against target: |
243 lines (+69/-2) 12 files modified
bootstrap.sh (+44/-0) client/drizzletest.cc (+4/-0) drizzled/field/datetime.cc (+1/-0) drizzled/filesort.cc (+1/-0) drizzled/function/time/unix_timestamp.cc (+1/-0) drizzled/sql_insert.cc (+3/-0) drizzled/sql_load.cc (+1/-0) drizzled/sql_union.cc (+3/-0) drizzled/table/cache.cc (+1/-0) drizzled/table_function_container.cc (+1/-0) plugin/logging_query/logging_query.cc (+1/-0) plugin/schema_engine/schema.cc (+8/-2) |
To merge this branch: | bzr merge lp:~brianaker/drizzle/clang-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Trunk | Pending | ||
Review via email:
|
Commit message
Description of the change
- 2579. By Drizzle Continuous Integration
-
added:
bootstrap.sh
modified:
client/drizzletest. cc
drizzled/field/datetime. cc
drizzled/filesort. cc
drizzled/function/ time/unix_ timestamp. cc
drizzled/sql_insert. cc
drizzled/sql_load. cc
drizzled/sql_union. cc
drizzled/table/cache. cc
drizzled/table_function_ container. cc
plugin/logging_ query/logging_ query.cc
plugin/schema_ engine/ schema. cc
pending merge tips: (use -v to see all merge revisions)
Brian Aker 2012-08-02 Add bootstrap script, and fixes for clang. - 2580. By Brian Aker
-
Fixing license on bootsrap.sh file
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olaf van der Spek (olafvdspek) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mark Atwood (fallenpegasus) wrote : | # |
On Sat, Aug 4, 2012 at 6:31 AM, Olaf van der Spek <email address hidden> wrote:
>> (void)(ret);
>
> Is stuff like this really necessary?
Do have clang compile without warnings, yes it is.
Otherwise the dataflow analyzer in clang determines that the data
result is unused, and issues a warning.
..m
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olaf van der Spek (olafvdspek) wrote : | # |
Isn't it used in the assert expression?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mark Atwood (fallenpegasus) wrote : | # |
On Sat, Aug 4, 2012 at 9:39 AM, Olaf van der Spek <email address hidden> wrote:
> Isn't it used in the assert expression?
Expressions in assert() are not expanded or evaluated when NDEBUG is defined.
It is a bug to assume that assert() will evaluate, and it's most
certainly a bug to have an assert() expression that has a side
effect.
A good dataflow analyzer knows that assert() should not count as "data
used". Given that clang's DFA is pretty close to state of the
research art, I would guess that it also knows that.
Back when I was programming in Ada, the compiler I was using could
optimize assertation statements, making them test only occasionally,
only on entrance and exit of the loop they where in, only when
something "interesting" happened in the data flow, and so forth.
..m
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Olaf van der Spek (olafvdspek) wrote : | # |
I'm aware of assert semantics. But (void)(ret); doesn't generate any code either. Having to use (void) for all data that's only used in assert expressions doesn't seem (entirely) right.
- 2581. By Brian Aker
-
Fix type in shell.
Preview Diff
1 | === added file 'bootstrap.sh' | |||
2 | --- bootstrap.sh 1970-01-01 00:00:00 +0000 | |||
3 | +++ bootstrap.sh 2012-08-11 15:59:19 +0000 | |||
4 | @@ -0,0 +1,44 @@ | |||
5 | 1 | #!/bin/bash | ||
6 | 2 | # | ||
7 | 3 | # Copyright (C) 2012 Brian Aker | ||
8 | 4 | # All rights reserved. | ||
9 | 5 | # | ||
10 | 6 | # Redistribution and use in source and binary forms, with or without | ||
11 | 7 | # modification, are permitted provided that the following conditions are | ||
12 | 8 | # met: | ||
13 | 9 | # | ||
14 | 10 | # * Redistributions of source code must retain the above copyright | ||
15 | 11 | # notice, this list of conditions and the following disclaimer. | ||
16 | 12 | # | ||
17 | 13 | # * Redistributions in binary form must reproduce the above | ||
18 | 14 | # copyright notice, this list of conditions and the following disclaimer | ||
19 | 15 | # in the documentation and/or other materials provided with the | ||
20 | 16 | # distribution. | ||
21 | 17 | # | ||
22 | 18 | # * The names of its contributors may not be used to endorse or | ||
23 | 19 | # promote products derived from this software without specific prior | ||
24 | 20 | # written permission. | ||
25 | 21 | # | ||
26 | 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
27 | 23 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
28 | 24 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
29 | 25 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
30 | 26 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
31 | 27 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
32 | 28 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
33 | 29 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
34 | 30 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
35 | 31 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
36 | 32 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
37 | 33 | |||
38 | 34 | if test -f configure; then make clean; make merge-clean; make distclean; fi; | ||
39 | 35 | |||
40 | 36 | rm -r -f autom4te.cache/ config.h config.log config.status | ||
41 | 37 | ./config/autorun.sh | ||
42 | 38 | if [ $(uname) = "Darwin" ]; | ||
43 | 39 | then | ||
44 | 40 | ./configure CC=clang CXX=clang++ --enable-assert | ||
45 | 41 | else | ||
46 | 42 | ./configure --enable-assert | ||
47 | 43 | fi | ||
48 | 44 | make | ||
49 | 0 | 45 | ||
50 | === modified file 'client/drizzletest.cc' | |||
51 | --- client/drizzletest.cc 2012-02-12 06:10:39 +0000 | |||
52 | +++ client/drizzletest.cc 2012-08-11 15:59:19 +0000 | |||
53 | @@ -734,6 +734,10 @@ | |||
54 | 734 | break; | 734 | break; |
55 | 735 | } | 735 | } |
56 | 736 | assert(known_arg_type); | 736 | assert(known_arg_type); |
57 | 737 | if (known_arg_type == false) | ||
58 | 738 | { | ||
59 | 739 | die("Bad argument"); | ||
60 | 740 | } | ||
61 | 737 | 741 | ||
62 | 738 | /* Check required arg */ | 742 | /* Check required arg */ |
63 | 739 | if (arg->ds->length() == 0 && arg->required) | 743 | if (arg->ds->length() == 0 && arg->required) |
64 | 740 | 744 | ||
65 | === modified file 'drizzled/field/datetime.cc' | |||
66 | --- drizzled/field/datetime.cc 2011-06-20 15:04:56 +0000 | |||
67 | +++ drizzled/field/datetime.cc 2012-08-11 15:59:19 +0000 | |||
68 | @@ -138,6 +138,7 @@ | |||
69 | 138 | size_t tmp_string_len; | 138 | size_t tmp_string_len; |
70 | 139 | 139 | ||
71 | 140 | tmp_string_len= temporal.to_string(tmp_string, type::Time::MAX_STRING_LENGTH); | 140 | tmp_string_len= temporal.to_string(tmp_string, type::Time::MAX_STRING_LENGTH); |
72 | 141 | (void)(tmp_string_len); | ||
73 | 141 | assert(tmp_string_len < type::Time::MAX_STRING_LENGTH); | 142 | assert(tmp_string_len < type::Time::MAX_STRING_LENGTH); |
74 | 142 | my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), tmp_string); | 143 | my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), tmp_string); |
75 | 143 | return 1; | 144 | return 1; |
76 | 144 | 145 | ||
77 | === modified file 'drizzled/filesort.cc' | |||
78 | --- drizzled/filesort.cc 2011-10-24 11:55:49 +0000 | |||
79 | +++ drizzled/filesort.cc 2012-08-11 15:59:19 +0000 | |||
80 | @@ -859,6 +859,7 @@ | |||
81 | 859 | from= tmp_buffer; | 859 | from= tmp_buffer; |
82 | 860 | } | 860 | } |
83 | 861 | tmp_length= cs->strnxfrm(to,sort_field->length, (unsigned char*) from, length); | 861 | tmp_length= cs->strnxfrm(to,sort_field->length, (unsigned char*) from, length); |
84 | 862 | (void)(tmp_length); | ||
85 | 862 | assert(tmp_length == sort_field->length); | 863 | assert(tmp_length == sort_field->length); |
86 | 863 | } | 864 | } |
87 | 864 | else | 865 | else |
88 | 865 | 866 | ||
89 | === modified file 'drizzled/function/time/unix_timestamp.cc' | |||
90 | --- drizzled/function/time/unix_timestamp.cc 2011-04-08 13:16:30 +0000 | |||
91 | +++ drizzled/function/time/unix_timestamp.cc 2012-08-11 15:59:19 +0000 | |||
92 | @@ -70,6 +70,7 @@ | |||
93 | 70 | char buff[DateTime::MAX_STRING_LENGTH]; | 70 | char buff[DateTime::MAX_STRING_LENGTH]; |
94 | 71 | int buff_len; | 71 | int buff_len; |
95 | 72 | buff_len= temporal.to_string(buff, DateTime::MAX_STRING_LENGTH); | 72 | buff_len= temporal.to_string(buff, DateTime::MAX_STRING_LENGTH); |
96 | 73 | (void)(buff_len); | ||
97 | 73 | assert((buff_len+1) < DateTime::MAX_STRING_LENGTH); | 74 | assert((buff_len+1) < DateTime::MAX_STRING_LENGTH); |
98 | 74 | my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(0), buff); | 75 | my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(0), buff); |
99 | 75 | return 0; | 76 | return 0; |
100 | 76 | 77 | ||
101 | === modified file 'drizzled/sql_insert.cc' | |||
102 | --- drizzled/sql_insert.cc 2012-02-12 08:49:06 +0000 | |||
103 | +++ drizzled/sql_insert.cc 2012-08-11 15:59:19 +0000 | |||
104 | @@ -456,6 +456,7 @@ | |||
105 | 456 | if (session->transaction.stmt.hasModifiedNonTransData()) | 456 | if (session->transaction.stmt.hasModifiedNonTransData()) |
106 | 457 | session->transaction.all.markModifiedNonTransData(); | 457 | session->transaction.all.markModifiedNonTransData(); |
107 | 458 | } | 458 | } |
108 | 459 | (void)(transactional_table); | ||
109 | 459 | assert(transactional_table || !changed || session->transaction.stmt.hasModifiedNonTransData()); | 460 | assert(transactional_table || !changed || session->transaction.stmt.hasModifiedNonTransData()); |
110 | 460 | 461 | ||
111 | 461 | } | 462 | } |
112 | @@ -1394,6 +1395,8 @@ | |||
113 | 1394 | 1395 | ||
114 | 1395 | changed= (info.copied || info.deleted || info.updated); | 1396 | changed= (info.copied || info.deleted || info.updated); |
115 | 1396 | transactional_table= table->cursor->has_transactions(); | 1397 | transactional_table= table->cursor->has_transactions(); |
116 | 1398 | (void)(transactional_table); | ||
117 | 1399 | (void)(changed); | ||
118 | 1397 | assert(transactional_table || !changed || | 1400 | assert(transactional_table || !changed || |
119 | 1398 | session->transaction.stmt.hasModifiedNonTransData()); | 1401 | session->transaction.stmt.hasModifiedNonTransData()); |
120 | 1399 | table->cursor->ha_release_auto_increment(); | 1402 | table->cursor->ha_release_auto_increment(); |
121 | 1400 | 1403 | ||
122 | === modified file 'drizzled/sql_load.cc' | |||
123 | --- drizzled/sql_load.cc 2012-07-11 14:06:00 +0000 | |||
124 | +++ drizzled/sql_load.cc 2012-08-11 15:59:19 +0000 | |||
125 | @@ -412,6 +412,7 @@ | |||
126 | 412 | 412 | ||
127 | 413 | session->my_ok(info.copied + info.deleted, 0, 0L, msg); | 413 | session->my_ok(info.copied + info.deleted, 0, 0L, msg); |
128 | 414 | err: | 414 | err: |
129 | 415 | (void)(transactional_table); | ||
130 | 415 | assert(transactional_table || !(info.copied || info.deleted) || | 416 | assert(transactional_table || !(info.copied || info.deleted) || |
131 | 416 | session->transaction.stmt.hasModifiedNonTransData()); | 417 | session->transaction.stmt.hasModifiedNonTransData()); |
132 | 417 | table->cursor->ha_release_auto_increment(); | 418 | table->cursor->ha_release_auto_increment(); |
133 | 418 | 419 | ||
134 | === modified file 'drizzled/sql_union.cc' | |||
135 | --- drizzled/sql_union.cc 2011-08-05 13:28:48 +0000 | |||
136 | +++ drizzled/sql_union.cc 2012-08-11 15:59:19 +0000 | |||
137 | @@ -294,7 +294,9 @@ | |||
138 | 294 | information about fields lengths and exact types | 294 | information about fields lengths and exact types |
139 | 295 | */ | 295 | */ |
140 | 296 | if (!is_union_select) | 296 | if (!is_union_select) |
141 | 297 | { | ||
142 | 297 | types= first_sl->item_list; | 298 | types= first_sl->item_list; |
143 | 299 | } | ||
144 | 298 | else if (sl == first_sl) | 300 | else if (sl == first_sl) |
145 | 299 | { | 301 | { |
146 | 300 | /* | 302 | /* |
147 | @@ -303,6 +305,7 @@ | |||
148 | 303 | The main reason of this is that we can't create | 305 | The main reason of this is that we can't create |
149 | 304 | field object without table. | 306 | field object without table. |
150 | 305 | */ | 307 | */ |
151 | 308 | (void)(empty_table); | ||
152 | 306 | assert(!empty_table); | 309 | assert(!empty_table); |
153 | 307 | empty_table= (Table*) session->mem.calloc(sizeof(Table)); | 310 | empty_table= (Table*) session->mem.calloc(sizeof(Table)); |
154 | 308 | types.clear(); | 311 | types.clear(); |
155 | 309 | 312 | ||
156 | === modified file 'drizzled/table/cache.cc' | |||
157 | --- drizzled/table/cache.cc 2011-07-06 22:48:32 +0000 | |||
158 | +++ drizzled/table/cache.cc 2012-08-11 15:59:19 +0000 | |||
159 | @@ -283,6 +283,7 @@ | |||
160 | 283 | void Cache::insert(table::Concurrent* arg) | 283 | void Cache::insert(table::Concurrent* arg) |
161 | 284 | { | 284 | { |
162 | 285 | CacheMap::iterator returnable= cache.insert(std::make_pair(arg->getShare()->getCacheKey(), arg)); | 285 | CacheMap::iterator returnable= cache.insert(std::make_pair(arg->getShare()->getCacheKey(), arg)); |
163 | 286 | (void)(returnable); | ||
164 | 286 | assert(returnable != cache.end()); | 287 | assert(returnable != cache.end()); |
165 | 287 | } | 288 | } |
166 | 288 | 289 | ||
167 | 289 | 290 | ||
168 | === modified file 'drizzled/table_function_container.cc' | |||
169 | --- drizzled/table_function_container.cc 2011-07-05 15:59:49 +0000 | |||
170 | +++ drizzled/table_function_container.cc 2012-08-11 15:59:19 +0000 | |||
171 | @@ -45,6 +45,7 @@ | |||
172 | 45 | void TableFunctionContainer::addFunction(plugin::TableFunction *tool) | 45 | void TableFunctionContainer::addFunction(plugin::TableFunction *tool) |
173 | 46 | { | 46 | { |
174 | 47 | std::pair<ToolMap::iterator, bool> ret= table_map.insert(std::make_pair(tool->getPath(), tool)); | 47 | std::pair<ToolMap::iterator, bool> ret= table_map.insert(std::make_pair(tool->getPath(), tool)); |
175 | 48 | (void)(ret); | ||
176 | 48 | assert(ret.second); | 49 | assert(ret.second); |
177 | 49 | } | 50 | } |
178 | 50 | 51 | ||
179 | 51 | 52 | ||
180 | === modified file 'plugin/logging_query/logging_query.cc' | |||
181 | --- plugin/logging_query/logging_query.cc 2012-06-20 14:17:30 +0000 | |||
182 | +++ plugin/logging_query/logging_query.cc 2012-08-11 15:59:19 +0000 | |||
183 | @@ -374,6 +374,7 @@ | |||
184 | 374 | 374 | ||
185 | 375 | // a single write has a kernel thread lock, thus no need mutex guard this | 375 | // a single write has a kernel thread lock, thus no need mutex guard this |
186 | 376 | wrv= write(fd, msgbuf.c_str(), msgbuf.length()); | 376 | wrv= write(fd, msgbuf.c_str(), msgbuf.length()); |
187 | 377 | (void)(wrv); | ||
188 | 377 | assert(wrv == msgbuf.length()); | 378 | assert(wrv == msgbuf.length()); |
189 | 378 | 379 | ||
190 | 379 | return false; | 380 | return false; |
191 | 380 | 381 | ||
192 | === modified file 'plugin/schema_engine/schema.cc' | |||
193 | --- plugin/schema_engine/schema.cc 2012-07-11 14:06:00 +0000 | |||
194 | +++ plugin/schema_engine/schema.cc 2012-08-11 15:59:19 +0000 | |||
195 | @@ -102,6 +102,7 @@ | |||
196 | 102 | pair<SchemaCache::iterator, bool> ret= | 102 | pair<SchemaCache::iterator, bool> ret= |
197 | 103 | schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message))); | 103 | schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message))); |
198 | 104 | 104 | ||
199 | 105 | (void)(ret); | ||
200 | 105 | assert(ret.second); // If this has happened, something really bad is going down. | 106 | assert(ret.second); // If this has happened, something really bad is going down. |
201 | 106 | } | 107 | } |
202 | 107 | } | 108 | } |
203 | @@ -121,7 +122,9 @@ | |||
204 | 121 | drizzled::message::catalog::shared_ptr message; | 122 | drizzled::message::catalog::shared_ptr message; |
205 | 122 | 123 | ||
206 | 123 | if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT)) | 124 | if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT)) |
207 | 125 | { | ||
208 | 124 | continue; | 126 | continue; |
209 | 127 | } | ||
210 | 125 | 128 | ||
211 | 126 | drizzled::identifier::Catalog identifier(entry->filename); | 129 | drizzled::identifier::Catalog identifier(entry->filename); |
212 | 127 | 130 | ||
213 | @@ -176,7 +179,7 @@ | |||
214 | 176 | schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message))); | 179 | schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message))); |
215 | 177 | 180 | ||
216 | 178 | assert(ret.second); // If this has happened, something really bad is going down. | 181 | assert(ret.second); // If this has happened, something really bad is going down. |
218 | 179 | return true; | 182 | return ret.second; |
219 | 180 | } | 183 | } |
220 | 181 | 184 | ||
221 | 182 | bool Schema::doDropSchema(const identifier::Schema &schema_identifier) | 185 | bool Schema::doDropSchema(const identifier::Schema &schema_identifier) |
222 | @@ -222,7 +225,9 @@ | |||
223 | 222 | schema_message.name()); | 225 | schema_message.name()); |
224 | 223 | 226 | ||
225 | 224 | if (access(schema_identifier.getPath().c_str(), F_OK)) | 227 | if (access(schema_identifier.getPath().c_str(), F_OK)) |
226 | 228 | { | ||
227 | 225 | return false; | 229 | return false; |
228 | 230 | } | ||
229 | 226 | 231 | ||
230 | 227 | if (writeSchemaFile(schema_identifier, schema_message)) | 232 | if (writeSchemaFile(schema_identifier, schema_message)) |
231 | 228 | { | 233 | { |
232 | @@ -233,9 +238,10 @@ | |||
233 | 233 | schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message))); | 238 | schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message))); |
234 | 234 | 239 | ||
235 | 235 | assert(ret.second); // If this has happened, something really bad is going down. | 240 | assert(ret.second); // If this has happened, something really bad is going down. |
236 | 241 | return ret.second; | ||
237 | 236 | } | 242 | } |
238 | 237 | 243 | ||
240 | 238 | return true; | 244 | return false; |
241 | 239 | } | 245 | } |
242 | 240 | 246 | ||
243 | 241 | /** | 247 | /** |
> (void)(ret);
Is stuff like this really necessary?