Updated Branches: refs/heads/compiler-warnings-20130314 [created] 7d07c8c0a
Fix unused vars. Address some compiler warnings by either removing or tagging unused variables. Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/4f2e21b8 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/4f2e21b8 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/4f2e21b8 Branch: refs/heads/compiler-warnings-20130314 Commit: 4f2e21b8122067cccf81820a5eb378bee6da8152 Parents: 430d20c Author: Marvin Humphrey <[email protected]> Authored: Fri Feb 22 18:24:23 2013 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Thu Mar 14 13:51:10 2013 -0700 ---------------------------------------------------------------------- clownfish/compiler/perl/lib/Clownfish/CFC.xs | 28 ++++++++++++++++++-- clownfish/compiler/src/CFCCClass.c | 5 +-- clownfish/compiler/src/CFCParcel.c | 1 - core/Clownfish/Num.c | 1 + core/Lucy/Analysis/StandardTokenizer.c | 1 + core/Lucy/Search/QueryParser.c | 3 ++ 6 files changed, 32 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/4f2e21b8/clownfish/compiler/perl/lib/Clownfish/CFC.xs ---------------------------------------------------------------------- diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC.xs b/clownfish/compiler/perl/lib/Clownfish/CFC.xs index 13ee4d4..dbcc709 100644 --- a/clownfish/compiler/perl/lib/Clownfish/CFC.xs +++ b/clownfish/compiler/perl/lib/Clownfish/CFC.xs @@ -176,6 +176,7 @@ OUTPUT: RETVAL void _clear_registry(...) PPCODE: + CHY_UNUSED_VAR(items); CFCClass_clear_registry(); void @@ -1068,7 +1069,7 @@ fetch(unused, name_sv) SV *unused; SV *name_sv; CODE: - (void)unused; + CHY_UNUSED_VAR(unused); const char *name = SvOK(name_sv) ? SvPV_nolen(name_sv) : NULL; CFCParcel *self = CFCParcel_fetch(name); RETVAL = S_cfcbase_to_perlref(self); @@ -1092,6 +1093,7 @@ OUTPUT: RETVAL SV* default_parcel(...) CODE: + CHY_UNUSED_VAR(items); CFCParcel *default_parcel = CFCParcel_default_parcel(); RETVAL = S_cfcbase_to_perlref(default_parcel); OUTPUT: RETVAL @@ -1099,6 +1101,7 @@ OUTPUT: RETVAL void reap_singletons(...) PPCODE: + CHY_UNUSED_VAR(items); CFCParcel_reap_singletons(); void @@ -1386,78 +1389,91 @@ OUTPUT: RETVAL unsigned CONST(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_CONST; OUTPUT: RETVAL unsigned NULLABLE(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_NULLABLE; OUTPUT: RETVAL unsigned INCREMENTED(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_INCREMENTED; OUTPUT: RETVAL unsigned DECREMENTED(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_DECREMENTED; OUTPUT: RETVAL unsigned VOID(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_VOID; OUTPUT: RETVAL unsigned OBJECT(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_OBJECT; OUTPUT: RETVAL unsigned PRIMITIVE(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_PRIMITIVE; OUTPUT: RETVAL unsigned INTEGER(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_INTEGER; OUTPUT: RETVAL unsigned FLOATING(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_FLOATING; OUTPUT: RETVAL unsigned STRING_TYPE(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_STRING_TYPE; OUTPUT: RETVAL unsigned VA_LIST(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_VA_LIST; OUTPUT: RETVAL unsigned ARBITRARY(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_ARBITRARY; OUTPUT: RETVAL unsigned COMPOSITE(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = CFCTYPE_COMPOSITE; OUTPUT: RETVAL @@ -1782,6 +1798,7 @@ func_declaration(unused, func) SV *unused; CFCFunction *func; CODE: + CHY_UNUSED_VAR(unused); RETVAL = S_sv_eat_c_string(CFCBindFunc_func_declaration(func)); OUTPUT: RETVAL @@ -1792,6 +1809,7 @@ abstract_method_def(unused, meth) SV *unused; CFCMethod *meth; CODE: + CHY_UNUSED_VAR(unused); RETVAL = S_sv_eat_c_string(CFCBindMeth_abstract_method_def(meth)); OUTPUT: RETVAL @@ -1815,6 +1833,7 @@ MODULE = Clownfish::CFC PACKAGE = Clownfish::CFC::Binding::Core::Aliases SV* c_aliases(...) CODE: + CHY_UNUSED_VAR(items); RETVAL = S_sv_eat_c_string(CFCBindAliases_c_aliases()); OUTPUT: RETVAL @@ -2029,7 +2048,7 @@ register(unused, binding) SV *unused; CFCPerlClass *binding; PPCODE: - (void)unused; + CHY_UNUSED_VAR(unused); CFCPerlClass_add_to_registry(binding); SV* @@ -2037,6 +2056,7 @@ singleton(unused_sv, class_name) SV *unused_sv; const char *class_name; CODE: + CHY_UNUSED_VAR(unused_sv); CFCPerlClass *binding = CFCPerlClass_singleton(class_name); RETVAL = S_cfcbase_to_perlref(binding); OUTPUT: RETVAL @@ -2044,6 +2064,7 @@ OUTPUT: RETVAL SV* registered(...) CODE: + CHY_UNUSED_VAR(items); CFCPerlClass **registry = CFCPerlClass_registry(); RETVAL = S_array_of_cfcbase_to_av((CFCBase**)registry); OUTPUT: RETVAL @@ -2051,6 +2072,7 @@ OUTPUT: RETVAL void _clear_registry(...) PPCODE: + CHY_UNUSED_VAR(items); CFCPerlClass_clear_registry(); void @@ -2189,7 +2211,7 @@ SV* new(unused) SV *unused; CODE: - (void)unused; + CHY_UNUSED_VAR(unused); CFCPerlPod *self = CFCPerlPod_new(); RETVAL = S_cfcbase_to_perlref(self); CFCBase_decref((CFCBase*)self); http://git-wip-us.apache.org/repos/asf/lucy/blob/4f2e21b8/clownfish/compiler/src/CFCCClass.c ---------------------------------------------------------------------- diff --git a/clownfish/compiler/src/CFCCClass.c b/clownfish/compiler/src/CFCCClass.c index 7b65530..3fa13da 100644 --- a/clownfish/compiler/src/CFCCClass.c +++ b/clownfish/compiler/src/CFCCClass.c @@ -16,6 +16,7 @@ #include <string.h> +#include "charmony.h" #include "CFCCClass.h" #include "CFCClass.h" #include "CFCDocuComment.h" @@ -135,13 +136,13 @@ CFCCClass_create_man_page(CFCClass *klass) { static char* S_man_create_synopsis(CFCClass *klass) { + CHY_UNUSED_VAR(klass); return CFCUtil_strdup(""); } static char* S_man_create_functions(CFCClass *klass) { CFCFunction **functions = CFCClass_functions(klass); - const char *class_name = CFCClass_get_class_name(klass); char *result = CFCUtil_strdup(".SH FUNCTIONS\n"); for (int func_num = 0; functions[func_num] != NULL; func_num++) { @@ -163,7 +164,6 @@ S_man_create_functions(CFCClass *klass) { static char* S_man_create_methods(CFCClass *klass) { CFCMethod **fresh_methods = CFCClass_fresh_methods(klass); - const char *class_name = CFCClass_get_class_name(klass); char *result = CFCUtil_strdup(".SH METHODS\n"); for (int meth_num = 0; fresh_methods[meth_num] != NULL; meth_num++) { @@ -282,7 +282,6 @@ S_man_escape_content(const char *content) { size_t result_len = 0; size_t result_cap = strlen(content) + 20; char *result = (char*)MALLOCATE(result_cap + 1); - int fill = 1; for (size_t i = 0; content[i]; i++) { char c[8]; http://git-wip-us.apache.org/repos/asf/lucy/blob/4f2e21b8/clownfish/compiler/src/CFCParcel.c ---------------------------------------------------------------------- diff --git a/clownfish/compiler/src/CFCParcel.c b/clownfish/compiler/src/CFCParcel.c index cea7c22..918be42 100644 --- a/clownfish/compiler/src/CFCParcel.c +++ b/clownfish/compiler/src/CFCParcel.c @@ -240,7 +240,6 @@ S_new_from_json(const char *json, const char *path) { for (size_t i = 0, max = parsed->num_kids; i < max; i += 2) { JSONNode *key = parsed->kids[i]; - JSONNode *value = parsed->kids[i + 1]; if (strcmp(key->string, "name") == 0 || strcmp(key->string, "nickname") == 0 || strcmp(key->string, "version") == 0 http://git-wip-us.apache.org/repos/asf/lucy/blob/4f2e21b8/core/Clownfish/Num.c ---------------------------------------------------------------------- diff --git a/core/Clownfish/Num.c b/core/Clownfish/Num.c index 2dc6040..8d49ab1 100644 --- a/core/Clownfish/Num.c +++ b/core/Clownfish/Num.c @@ -451,6 +451,7 @@ Bool_inc_refcount(BoolNum *self) { uint32_t Bool_dec_refcount(BoolNum *self) { + UNUSED_VAR(self); return 1; } http://git-wip-us.apache.org/repos/asf/lucy/blob/4f2e21b8/core/Lucy/Analysis/StandardTokenizer.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Analysis/StandardTokenizer.c b/core/Lucy/Analysis/StandardTokenizer.c index a24c2b8..78fee45 100644 --- a/core/Lucy/Analysis/StandardTokenizer.c +++ b/core/Lucy/Analysis/StandardTokenizer.c @@ -104,6 +104,7 @@ StandardTokenizer_transform_text(StandardTokenizer *self, CharBuf *text) { void StandardTokenizer_tokenize_str(StandardTokenizer *self, const char *text, size_t len, Inversion *inversion) { + UNUSED_VAR(self); if ((len >= 1 && (uint8_t)text[len - 1] >= 0xC0) || (len >= 2 && (uint8_t)text[len - 2] >= 0xE0) || (len >= 3 && (uint8_t)text[len - 3] >= 0xF0)) { http://git-wip-us.apache.org/repos/asf/lucy/blob/4f2e21b8/core/Lucy/Search/QueryParser.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c index 1e32839..d6e1110 100644 --- a/core/Lucy/Search/QueryParser.c +++ b/core/Lucy/Search/QueryParser.c @@ -321,6 +321,7 @@ S_parse_subquery(QueryParser *self, VArray *elems, CharBuf *default_field, static void S_balance_parens(QueryParser *self, VArray *elems) { + UNUSED_VAR(self); // Count paren balance, eliminate unbalanced right parens. int64_t paren_depth = 0; size_t i = 0; @@ -381,6 +382,7 @@ S_compose_inner_queries(QueryParser *self, VArray *elems, static void S_apply_plusses_and_negations(QueryParser *self, VArray *elems) { + UNUSED_VAR(self); for (uint32_t i = VA_Get_Size(elems); i--;) { ParserElem *elem = (ParserElem*)VA_Fetch(elems, i); if (ParserElem_Get_Type(elem) == TOKEN_QUERY) { @@ -418,6 +420,7 @@ S_compose_not_queries(QueryParser *self, VArray *elems) { static void S_winnow_boolops(QueryParser *self, VArray *elems) { + UNUSED_VAR(self); for (uint32_t i = 0; i < VA_Get_Size(elems); i++) { ParserElem *elem = (ParserElem*)VA_Fetch(elems, i); if (ParserElem_Get_Type(elem) != TOKEN_QUERY) {
