Skip to content

Commit

Permalink
Allow for variables in pack to be unused
Browse files Browse the repository at this point in the history
This fixes a whole bunch of warnings on the clang analyzer, so actual
issues aren't swamped in the dead store warnings it throws. This also
means all code in the vm/ directory (except for util) now is clean with
the analyzer.
  • Loading branch information
dbussink committed May 1, 2013
1 parent 7c211c8 commit 53f3241
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions vm/builtin/pack18.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,11 +632,11 @@ namespace rubinius {

native_int array_size = self->size();
native_int index = 0;
native_int count = 0;
native_int count UNUSED = 0;
native_int stop = 0;
bool rest = false;
bool platform = false;
bool tainted = false;
bool rest UNUSED = false;
bool platform UNUSED = false;
bool tainted UNUSED = false;

String* string_value = 0;
std::string str("");
Expand Down
8 changes: 4 additions & 4 deletions vm/builtin/pack19.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,12 @@ namespace rubinius {

native_int array_size = self->size();
native_int index = 0;
native_int count = 0;
native_int count UNUSED = 0;
native_int count_flag = -1;
native_int stop = 0;
bool rest = false;
bool tainted = false;
bool untrusted = false;
bool rest UNUSED = false;
bool tainted UNUSED = false;
bool untrusted UNUSED = false;
bool ascii_encoding = false;
bool utf8_encoding = false;
bool string_encoding = false;
Expand Down
12 changes: 6 additions & 6 deletions vm/builtin/unpack18.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ namespace rubinius {

int a = -1, b = -1, c = 0, d = 0;
while(bytes < bytes_end) {
a = b = c = d = -1;
b = c = d = -1;

while((a = b64_xtable[(int)(*bytes)]) == -1 && bytes < bytes_end)
while((a = (int)b64_xtable[(int)(*bytes)]) == -1 && bytes < bytes_end)
bytes++;
if(bytes >= bytes_end)
break;
Expand Down Expand Up @@ -627,13 +627,13 @@ namespace rubinius {
const char* bytes_end = 0;

native_int bytes_size = self->byte_size();
native_int index = 0;
native_int index UNUSED = 0;
native_int stop = 0;
native_int width = 0;
native_int count = 0;
native_int count UNUSED = 0;
native_int remainder = 0;
bool rest = false;
bool platform = false;
bool rest UNUSED = false;
bool platform UNUSED = false;


static const char _trans_keys[] = {
Expand Down
10 changes: 5 additions & 5 deletions vm/builtin/unpack19.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ namespace rubinius {

int a = -1, b = -1, c = 0, d = 0;
while(bytes < bytes_end) {
a = b = c = d = -1;
b = c = d = -1;

while((a = b64_xtable[(int)(*bytes)]) == -1 && bytes < bytes_end)
while((a = (int)b64_xtable[(int)(*bytes)]) == -1 && bytes < bytes_end)
bytes++;
if(bytes >= bytes_end)
break;
Expand Down Expand Up @@ -632,12 +632,12 @@ namespace rubinius {
const char* bytes_end = 0;

native_int bytes_size = self->byte_size();
native_int index = 0;
native_int index UNUSED = 0;
native_int stop = 0;
native_int width = 0;
native_int count = 0;
native_int count UNUSED = 0;
native_int remainder = 0;
bool rest = false;
bool rest UNUSED = false;


static const char _trans_keys[] = {
Expand Down
2 changes: 2 additions & 0 deletions vm/prelude.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ namespace rubinius {

#if __GNUC__ >= 4
#define WARN_UNUSED __attribute__ ((warn_unused_result))
#define UNUSED __attribute__((unused))
#else
#define WARN_UNUSED
#define UNUSED
#endif

#endif
Expand Down

0 comments on commit 53f3241

Please sign in to comment.