summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntti-Juhani Kaijanaho <ajk@debian.org>2012-06-08 19:44:11 +0300
committerAntti-Juhani Kaijanaho <ajk@debian.org>2012-06-08 19:44:11 +0300
commita132bb1dec969d2852d98e32eaaa7b2da8c309c8 (patch)
treed7889dabeb6640c57d158568df7ae639c0229617
parentf690c98a923c59f2a654127077c19710ff187f49 (diff)
downloaddctrl-tools-a132bb1dec969d2852d98e32eaaa7b2da8c309c8.tar.gz
Add -Wextra to non-package builds (and clean up the resulting warnings).
Signed-off-by: Antti-Juhani Kaijanaho <ajk@debian.org>
-rw-r--r--GNUmakefile2
-rw-r--r--debian/changelog3
-rw-r--r--grep-dctrl/grep-dctrl.c68
-rw-r--r--join-dctrl/join-dctrl.c38
-rw-r--r--lib/atom.c4
-rw-r--r--lib/para_pool.h4
-rw-r--r--lib/predicate.c12
-rw-r--r--sort-dctrl/sort-dctrl.c14
-rw-r--r--tbl-dctrl/tbl-dctrl.c20
9 files changed, 83 insertions, 82 deletions
diff --git a/GNUmakefile b/GNUmakefile
index ea3fd1d..0de0533 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -14,7 +14,7 @@ man8dir = $(mandir)/man8
localedir = $(datarootdir)/locale
CC = gcc
-CFLAGS ?= -g -O2 -Wall -Werror
+CFLAGS ?= -g -O2 -Wall -Wextra -Werror
ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) -std=gnu99 -Ilib \
-DENABLE_L_DEBUG -D_GNU_SOURCE -DSYSCONF=\"$(sysconfdir)\" \
-DHAVE_GETTEXT -DPACKAGE=\"dctrl-tools\" -DLOCALEDIR=\"$(localedir)\"
diff --git a/debian/changelog b/debian/changelog
index fb47ced..f4f56df 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,8 +8,9 @@ dctrl-tools (2.23) UNRELEASED; urgency=low
_FORTIFY_SOURCE, (see bug #674917), causing spurious warnings upon
mblen initialization calls, switch to using mbrlen in tbl-dctrl.c (a
good idea in any case).
+ * Add -Wextra to non-package builds (and clean up the resulting warnings).
- -- Antti-Juhani Kaijanaho <ajk@debian.org> Thu, 07 Jun 2012 12:08:47 +0300
+ -- Antti-Juhani Kaijanaho <ajk@debian.org> Fri, 08 Jun 2012 19:42:51 +0300
dctrl-tools (2.22.2) unstable; urgency=low
diff --git a/grep-dctrl/grep-dctrl.c b/grep-dctrl/grep-dctrl.c
index 020681c..718c798 100644
--- a/grep-dctrl/grep-dctrl.c
+++ b/grep-dctrl/grep-dctrl.c
@@ -67,39 +67,39 @@ enum {
};
static struct argp_option options[] = {
- { "errorlevel", 'l', N_("LEVEL"), 0, N_("Set log level to LEVEL.") },
- { "field", 'F', N_("FIELD,FIELD,..."), 0, N_("Restrict pattern matching to the FIELDs given.") },
- { 0, 'P', 0, 0, N_("This is a shorthand for -FPackage.") },
- { 0, 'S', 0, 0, N_("This is a shorthand for -FSource:Package.") },
- { "show-field", 's', N_("FIELD,FIELD,..."), 0, N_("Show only the body of these fields from the matching paragraphs.") },
- { 0, 'd', 0, 0, N_("Show only the first line of the \"Description\" field from the matching paragraphs.") },
- { "no-field-names", 'n', 0, 0, N_("Suppress field names when showing specified fields.") },
- { "eregex", 'e', 0, 0, N_("Regard the pattern as an extended POSIX regular expression.") },
- { "regex", 'r', 0, 0, N_("Regard the pattern as a standard POSIX regular expression.") },
- { "ignore-case", 'i', 0, 0, N_("Ignore case when looking for a match.") },
- { "invert-match", 'v', 0, 0, N_("Show only paragraphs that do not match.") },
- { "invert-show", 'I', 0, 0, N_("Show those fields that have NOT been selected with -s") },
- { "count", 'c', 0, 0, N_("Show only the count of matching paragraphs.") },
- { "exact-match", 'X', 0, 0, N_("Do an exact match.") },
- { "copying", 'C', 0, 0, N_("Print out the copyright license.") },
- { "and", 'a', 0, 0, N_("Conjunct filters.") },
- { "or", 'o', 0, 0, N_("Disjunct filters.") },
- { "not", '!', 0, 0, N_("Negate the following filters.") },
- { "eq", OPT_EQ, 0, 0, N_("Test for version number equality.") },
- { "lt", OPT_LT, 0, 0, N_("Version number comparison: <<.") },
- { "le", OPT_LE, 0, 0, N_("Version number comparison: <=.") },
- { "gt", OPT_GT, 0, 0, N_("Version number comparison: >>.") },
- { "ge", OPT_GE, 0, 0, N_("Version number comparison: >=.") },
- { "debug-optparse", OPT_OPTPARSE, 0, 0, N_("Debug option parsing.") },
- { "quiet", 'q', 0, 0, N_("Do not output to stdout.") },
- { "silent", OPT_SILENT, 0, 0, N_("Do not output to stdout.") },
- { "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files") },
- { "ignore-parse-errors", OPT_IGN_ERRS, 0, 0, N_("Ignore parse errors") },
- { "pattern", OPT_PATTERN, N_("PATTERN"), 0, N_("Specify the pattern to search for") },
- { "whole-pkg", 'w', 0, 0, N_("Match only whole package names (this implies -e)") },
- { "ensure-dctrl", OPT_ENSURE, 0, 0, N_("Ensure that the output is in dctrl format (overridden by -n)") },
- { "compat", OPT_COMPAT, 0, 0, N_("Override the effect of an earlier --ensure-dctrl") },
- { 0 }
+ { "errorlevel", 'l', N_("LEVEL"), 0, N_("Set log level to LEVEL."), 0 },
+ { "field", 'F', N_("FIELD,FIELD,..."), 0, N_("Restrict pattern matching to the FIELDs given."), 0 },
+ { 0, 'P', 0, 0, N_("This is a shorthand for -FPackage."), 0 },
+ { 0, 'S', 0, 0, N_("This is a shorthand for -FSource:Package."), 0 },
+ { "show-field", 's', N_("FIELD,FIELD,..."), 0, N_("Show only the body of these fields from the matching paragraphs."), 0 },
+ { 0, 'd', 0, 0, N_("Show only the first line of the \"Description\" field from the matching paragraphs."), 0 },
+ { "no-field-names", 'n', 0, 0, N_("Suppress field names when showing specified fields."), 0 },
+ { "eregex", 'e', 0, 0, N_("Regard the pattern as an extended POSIX regular expression."), 0 },
+ { "regex", 'r', 0, 0, N_("Regard the pattern as a standard POSIX regular expression."), 0 },
+ { "ignore-case", 'i', 0, 0, N_("Ignore case when looking for a match."), 0 },
+ { "invert-match", 'v', 0, 0, N_("Show only paragraphs that do not match."), 0 },
+ { "invert-show", 'I', 0, 0, N_("Show those fields that have NOT been selected with -s"), 0 },
+ { "count", 'c', 0, 0, N_("Show only the count of matching paragraphs."), 0 },
+ { "exact-match", 'X', 0, 0, N_("Do an exact match."), 0 },
+ { "copying", 'C', 0, 0, N_("Print out the copyright license."), 0 },
+ { "and", 'a', 0, 0, N_("Conjunct filters."), 0 },
+ { "or", 'o', 0, 0, N_("Disjunct filters."), 0 },
+ { "not", '!', 0, 0, N_("Negate the following filters."), 0 },
+ { "eq", OPT_EQ, 0, 0, N_("Test for version number equality."), 0 },
+ { "lt", OPT_LT, 0, 0, N_("Version number comparison: <<."), 0 },
+ { "le", OPT_LE, 0, 0, N_("Version number comparison: <=."), 0 },
+ { "gt", OPT_GT, 0, 0, N_("Version number comparison: >>."), 0 },
+ { "ge", OPT_GE, 0, 0, N_("Version number comparison: >=."), 0 },
+ { "debug-optparse", OPT_OPTPARSE, 0, 0, N_("Debug option parsing."), 0 },
+ { "quiet", 'q', 0, 0, N_("Do not output to stdout."), 0 },
+ { "silent", OPT_SILENT, 0, 0, N_("Do not output to stdout."), 0 },
+ { "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files"), 0 },
+ { "ignore-parse-errors", OPT_IGN_ERRS, 0, 0, N_("Ignore parse errors"), 0 },
+ { "pattern", OPT_PATTERN, N_("PATTERN"), 0, N_("Specify the pattern to search for"), 0 },
+ { "whole-pkg", 'w', 0, 0, N_("Match only whole package names (this implies -e)"), 0 },
+ { "ensure-dctrl", OPT_ENSURE, 0, 0, N_("Ensure that the output is in dctrl format (overridden by -n)"), 0 },
+ { "compat", OPT_COMPAT, 0, 0, N_("Override the effect of an earlier --ensure-dctrl"), 0 },
+ { 0, 0, 0, 0, 0, 0 }
};
@@ -801,7 +801,7 @@ int main (int argc, char * argv[])
if (debug_optparse) {
fflush(stderr);
fputs("tokens:", stdout);
- for (int i = 0; i < args.toks_np; i++) {
+ for (size_t i = 0; i < args.toks_np; i++) {
putchar(' ');
fputs(tokdescr(args.toks[i]), stdout);
if (args.strings[i] != 0) {
diff --git a/join-dctrl/join-dctrl.c b/join-dctrl/join-dctrl.c
index 1830b41..36d34b3 100644
--- a/join-dctrl/join-dctrl.c
+++ b/join-dctrl/join-dctrl.c
@@ -1,5 +1,5 @@
/* dctrl-tools - Debian control file inspection tools
- Copyright © 2007, 2008 Antti-Juhani Kaijanaho
+ Copyright © 2007, 2008, 2012 Antti-Juhani Kaijanaho
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -36,32 +36,32 @@ const char * argp_program_version = "join-dctrl (dctrl-tools) " VERSION;
const char * argp_program_bug_address = MAINTAINER;
static struct argp_option options[] = {
- { "1st-join-field", '1', N_("FIELD"), 0, N_("Specify the join field to use for the first file") },
- { "2nd-join-field", '2', N_("FIELD"), 0, N_("Specify the join field to use for the second file") },
- { "join-field", 'j', N_("FIELD"), 0, N_("Specify the common join field") },
- { "unpairable-from", 'a', N_("FIELDNO"), 0, N_("Print unpairable records from the indicated file (either 1 or 2)") },
- { "output-fields", 'o', N_("FIELDSPEC"),0, N_("Specify the format of the output file") },
- { "copying", 'C', 0, 0, N_("Print out the copyright license.") },
- { "errorlevel", 'l', N_("LEVEL"), 0, N_("Set debugging level to LEVEL.") },
- { "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files") },
- { 0 }
+ { "1st-join-field", '1', N_("FIELD"), 0, N_("Specify the join field to use for the first file"), 0 },
+ { "2nd-join-field", '2', N_("FIELD"), 0, N_("Specify the join field to use for the second file"), 0 },
+ { "join-field", 'j', N_("FIELD"), 0, N_("Specify the common join field"), 0 },
+ { "unpairable-from", 'a', N_("FIELDNO"), 0, N_("Print unpairable records from the indicated file (either 1 or 2)"), 0 },
+ { "output-fields", 'o', N_("FIELDSPEC"),0, N_("Specify the format of the output file"), 0 },
+ { "copying", 'C', 0, 0, N_("Print out the copyright license."), 0 },
+ { "errorlevel", 'l', N_("LEVEL"), 0, N_("Set debugging level to LEVEL."), 0 },
+ { "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files"), 0 },
+ { 0, 0, 0, 0, 0, 0 }
};
#define MAX_FNAMES 2
struct arguments {
- int unpairables; /* Print unpairable paragraphs from ...
- 0 nowhere,
- 1 the first file
- 2 the second file
- */
+ size_t unpairables; /* Print unpairable paragraphs from ...
+ 0 nowhere,
+ 1 the first file
+ 2 the second file
+ */
struct field_attr *join_field[MAX_FNAMES];
size_t num_fnames;
struct ifile fname[MAX_FNAMES];
size_t num_show_fields;
struct show_field {
- int file_inx; /* indexes join_field, can be -1 to indicate
- common (ignoring nulls) join field
+ size_t file_inx; /* indexes join_field, can be -1 to indicate
+ common (ignoring nulls) join field
*/
struct field_attr *field; // null if file_inx is -1
char *showname;
@@ -213,7 +213,7 @@ void print_para_config(struct arguments *args, para_t para[], size_t just_this)
struct show_field *sf = &args->show_fields[i];
struct fsaf_read_rv body = { .b = "", .len = 0 };
const char *showname = NULL;
- if (sf->file_inx == -1) {
+ if (sf->file_inx == (size_t)-1) {
for (size_t j = 0;
body.len == 0 && j < args->num_fnames;
j++) {
@@ -250,7 +250,7 @@ void print_para_config(struct arguments *args, para_t para[], size_t just_this)
static char progdoc [] = N_("join-dctrl -- join two Debian control files");
-static struct argp argp = { options, parse_opt, 0, progdoc };
+static struct argp argp = { options, parse_opt, 0, progdoc, 0, 0, 0 };
int main(int argc, char * argv[])
{
diff --git a/lib/atom.c b/lib/atom.c
index 26d223a..f524187 100644
--- a/lib/atom.c
+++ b/lib/atom.c
@@ -1,5 +1,5 @@
/* dctrl-tools - Debian control file inspection tools
- Copyright © 2011 Antti-Juhani Kaijanaho
+ Copyright © 2011, 2012 Antti-Juhani Kaijanaho
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -158,7 +158,7 @@ static bool atom_field_verify(struct atom * atom, FSAF * fp,
bool atom_verify(struct atom * at, para_t * par)
{
FSAF * fp = par->common->fp;
- if (at->field_inx == -1) {
+ if (at->field_inx == (size_t)-1) {
/* Take the full paragraph */
return atom_field_verify(at, fp, par->start, par->end);
}
diff --git a/lib/para_pool.h b/lib/para_pool.h
index 5867f25..138a532 100644
--- a/lib/para_pool.h
+++ b/lib/para_pool.h
@@ -1,5 +1,5 @@
/* dctrl-tools - Debian control file inspection tools
- Copyright © 2004 Antti-Juhani Kaijanaho
+ Copyright © 2004, 2012 Antti-Juhani Kaijanaho
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -65,7 +65,7 @@ bool para_pool_more(para_pool_t * pp)
// calls para_init
static inline
-para_t * new_para(para_pool_t * ppo, para_parser_t * ppa)
+para_t * new_para(para_pool_t * ppo __attribute__((unused)), para_parser_t * ppa)
{
para_t * rv = 0;
/*
diff --git a/lib/predicate.c b/lib/predicate.c
index 5d10b5d..9b5f32d 100644
--- a/lib/predicate.c
+++ b/lib/predicate.c
@@ -1,5 +1,5 @@
/* dctrl-tools - Debian control file inspection tools
- Copyright © 2003, 2004, 2008, 2010, 2011 Antti-Juhani Kaijanaho
+ Copyright © 2003, 2004, 2008, 2010, 2011, 2012 Antti-Juhani Kaijanaho
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -70,7 +70,7 @@ static bool eval_AND(struct predicate *base_p, para_t * para)
static void print_AND(struct predicate *base_p, size_t indent)
{
struct binary_predicate *p = (struct binary_predicate *)base_p;
- for (int i = 0; i < indent; i++) putchar(' ');
+ for (size_t i = 0; i < indent; i++) putchar(' ');
puts("AND");
print(p->lrand, indent+1);
print(p->rrand, indent+1);
@@ -86,7 +86,7 @@ static bool eval_OR(struct predicate *base_p, para_t * para)
static void print_OR(struct predicate *base_p, size_t indent)
{
struct binary_predicate *p = (struct binary_predicate *)base_p;
- for (int i = 0; i < indent; i++) putchar(' ');
+ for (size_t i = 0; i < indent; i++) putchar(' ');
puts("OR");
print(p->lrand, indent+1);
print(p->rrand, indent+1);
@@ -101,7 +101,7 @@ static bool eval_NOT(struct predicate *base_p, para_t * para)
static void print_NOT(struct predicate *base_p, size_t indent)
{
struct unary_predicate *p = (struct unary_predicate *)base_p;
- for (int i = 0; i < indent; i++) putchar(' ');
+ for (size_t i = 0; i < indent; i++) putchar(' ');
puts("NOT");
print(p->rand, indent+1);
}
@@ -117,7 +117,7 @@ static void print_ATOM(struct predicate *base_p, size_t indent)
{
struct atomary_predicate *p = (struct atomary_predicate *)base_p;
char ind[indent+1];
- for (int i = 0; i < indent; i++) ind[i] = ' ';
+ for (size_t i = 0; i < indent; i++) ind[i] = ' ';
ind[indent] = '\0';
printf("%sATOM", ind);
printf("%s field_name = %s\n", ind, p->atom->field_name);
@@ -170,7 +170,7 @@ struct predicate *predicate_ATOM(struct atom *at)
}
-bool check_predicate(struct predicate * p)
+bool check_predicate(struct predicate * p __attribute__((unused)))
{
// static checking of predicate
// currently no operation
diff --git a/sort-dctrl/sort-dctrl.c b/sort-dctrl/sort-dctrl.c
index 5e20cc8..ebea165 100644
--- a/sort-dctrl/sort-dctrl.c
+++ b/sort-dctrl/sort-dctrl.c
@@ -1,5 +1,5 @@
/* dctrl-tools - Debian control file inspection tools
- Copyright © 2004, 2005, 2006, 2007, 2008, 2009, 2010 Antti-Juhani Kaijanaho
+ Copyright © 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Antti-Juhani Kaijanaho
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,11 +35,11 @@ const char * argp_program_version = "sort-dctrl (dctrl-tools) " VERSION;
const char * argp_program_bug_address = MAINTAINER;
static struct argp_option options[] = {
- { "copying", 'C', 0, 0, N_("Print out the copyright license.") },
- { "errorlevel", 'l', N_("LEVEL"), 0, N_("Set debugging level to LEVEL.") },
- { "key-spec", 'k', N_("KEYSPEC"), 0, N_("Specify sort keys.") },
- { "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files") },
- { 0 }
+ { "copying", 'C', 0, 0, N_("Print out the copyright license."), 0 },
+ { "errorlevel", 'l', N_("LEVEL"), 0, N_("Set debugging level to LEVEL."), 0 },
+ { "key-spec", 'k', N_("KEYSPEC"), 0, N_("Specify sort keys."), 0 },
+ { "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files"), 0 },
+ { 0, 0, 0, 0, 0, 0 }
};
#define MAX_FNAMES 4096
@@ -139,7 +139,7 @@ static error_t parse_opt (int key, char * arg, struct argp_state * state)
static char progdoc [] = N_("sort-dctrl -- sort Debian control files");
-static struct argp argp = { options, parse_opt, 0, progdoc };
+static struct argp argp = { options, parse_opt, 0, progdoc, 0, 0, 0 };
int main(int argc, char * argv[])
{
diff --git a/tbl-dctrl/tbl-dctrl.c b/tbl-dctrl/tbl-dctrl.c
index b295589..12efcd6 100644
--- a/tbl-dctrl/tbl-dctrl.c
+++ b/tbl-dctrl/tbl-dctrl.c
@@ -36,13 +36,13 @@ const char * argp_program_version = "tbl-dctrl (dctrl-tools) " VERSION;
const char * argp_program_bug_address = MAINTAINER;
static struct argp_option options[] = {
- { "delimiter", 'd', N_("DELIM"), 0, N_("Specify a delimiter.") },
- { "no-heading", 'H', 0, 0, N_("Do not print a table heading") },
- { "column", 'c', N_("SPEC"), 0, N_("Append the specified column.") },
- { "copying", 'C', 0, 0, N_("Print out the copyright license.") },
- { "errorlevel", 'l', N_("LEVEL"), 0, N_("Set debugging level to LEVEL.") },
- { "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files") },
- { 0 }
+ { "delimiter", 'd', N_("DELIM"), 0, N_("Specify a delimiter."), 0 },
+ { "no-heading", 'H', 0, 0, N_("Do not print a table heading"), 0 },
+ { "column", 'c', N_("SPEC"), 0, N_("Append the specified column."), 0 },
+ { "copying", 'C', 0, 0, N_("Print out the copyright license."), 0 },
+ { "errorlevel", 'l', N_("LEVEL"), 0, N_("Set debugging level to LEVEL."), 0 },
+ { "mmap", OPT_MMAP, 0, 0, N_("Attempt mmapping input files"), 0 },
+ { 0, 0, 0, 0, 0, 0 }
};
#define MAX_FNAMES 4096
@@ -129,7 +129,7 @@ size_t linewrap(char **res, char const *orig, size_t orig_len,
}
int n = mbrlen(orig + i, orig_len - i, &mbs);
if (n <= 0) break;
- for (size_t j = 0; j < n; j++) INSERT(orig[i+j]);
+ for (int j = 0; j < n; j++) INSERT(orig[i+j]);
i += n;
ll++;
}
@@ -286,7 +286,7 @@ static error_t parse_opt (int key, char * arg, struct argp_state * state)
n = n * 10 + (*p - '0');
}
if (err) message(L_IMPORTANT, 0, _("invalid column length"));
- col->column_width = n > 0 ? n : -1;
+ col->column_width = n > 0 ? n : (size_t)-1;
if (n == 0) args->need_preprocessing = 1;
args->num_columns++;
}
@@ -341,7 +341,7 @@ static error_t parse_opt (int key, char * arg, struct argp_state * state)
static char progdoc [] =
N_("tbl-dctrl -- tabularize Debian control files");
-static struct argp argp = { options, parse_opt, 0, progdoc };
+static struct argp argp = { options, parse_opt, 0, progdoc, 0, 0, 0 };
static size_t mbs_len(char const *mbs, size_t n, char const *fname)
{