diff options
author | Ben Pfaff <blp@nicira.com> | 2011-05-06 11:38:19 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-05-16 13:40:48 -0700 |
commit | f4070db7e5ae7727876d6cc318fba10033dc2c85 (patch) | |
tree | 79f11ffa1f4f5987b557ac23b858a77a195a3b60 /lib/coverage.h | |
parent | 2932bd0512422ca9540a9a99c57c3a7f60d22df0 (diff) |
Suppress sparse warnings for global variables initialized in headers.
sparse warns if a non-static variable with external linkage has an
initializer at first declaration, because it suspects that it should be
static instead. Generally it's correct, but not in these cases, so add
a redundant declaration to suppress the warning.
The suppress warnings look like:
../ofproto/connmgr.c:40:1: warning: symbol 'VLM_connmgr' was not declared. Should it be static?
../ofproto/collectors.c:31:1: warning: symbol 'vlog_module_ptr_collectors' was not declared. Should it be static?
../ofproto/connmgr.c:43:1: warning: symbol 'counter_ofconn_stuck' was not declared. Should it be static?
Diffstat (limited to 'lib/coverage.h')
-rw-r--r-- | lib/coverage.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/coverage.h b/lib/coverage.h index d816fb61..b7db6c47 100644 --- a/lib/coverage.h +++ b/lib/coverage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010 Nicira Networks. + * Copyright (c) 2009, 2010, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ struct coverage_counter { #if USE_LINKER_SECTIONS #define COVERAGE_DEFINE(COUNTER) \ COVERAGE_DEFINE__(COUNTER); \ + extern struct coverage_counter *counter_ptr_##COUNTER; \ struct coverage_counter *counter_ptr_##COUNTER \ __attribute__((section("coverage"))) = &counter_##COUNTER #else @@ -60,6 +61,7 @@ void coverage_clear(void); /* Implementation detail. */ #define COVERAGE_DEFINE__(COUNTER) \ + extern struct coverage_counter counter_##COUNTER; \ struct coverage_counter counter_##COUNTER = { #COUNTER, 0, 0 } #endif /* coverage.h */ |