2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

configure: Stop avoiding -Wformat-zero-length.

Debian likes to enable -Wformat-zero-length, even over our code trying to
disable it.  It isn't too hard to make our code warning-free against this
option, so this commit both stops disabling it and fixes the warnings.

The first fix is to change set_subprogram_name() to take a plain string
instead of a format string, and to adjust its few callers.  This fixes one
warning since one of those callers passed in an empty string.

The second fix is to remove a test for ovs_scan() against an empty string.
I couldn't find a way to avoid a warning for this test, and it isn't too
valuable in any case.

This allows us to drop filtering for -Wformat from the Debian rules file,
so this commit removes it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2015-06-07 09:48:14 -07:00
parent bdd7ecf5bf
commit 40e7cf5607
6 changed files with 13 additions and 31 deletions

View File

@@ -500,24 +500,13 @@ get_subprogram_name(void)
return name ? name : "";
}
/* Sets the formatted value of 'format' as the name of the currently running
* thread or process. (This appears in log messages and may also be visible in
* system process listings and debuggers.) */
/* Sets 'subprogram_name' as the name of the currently running thread or
* process. (This appears in log messages and may also be visible in system
* process listings and debuggers.) */
void
set_subprogram_name(const char *format, ...)
set_subprogram_name(const char *subprogram_name)
{
char *pname;
if (format) {
va_list args;
va_start(args, format);
pname = xvasprintf(format, args);
va_end(args);
} else {
pname = xstrdup(program_name);
}
char *pname = xstrdup(subprogram_name ? subprogram_name : program_name);
free(subprogram_name_set(pname));
#if HAVE_GLIBC_PTHREAD_SETNAME_NP