commit | 132e96ff1c3dade1b08cdae82b0f4ed27a9a45d0 | [log] [tgz] |
---|---|---|
author | mukesh agrawal <quiche@chromium.org> | Thu Apr 24 11:49:42 2014 -0700 |
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | Sat Apr 26 00:56:53 2014 +0000 |
tree | ec0b21113ed7cfa56f107330920f89a5d7a1725e | |
parent | 88fb16f17cafa2e2f25cdf12852983d705b31f38 [diff] |
shill: metrics: better encapsulate metric naming Prior to this CL, Metrics exposed metric names as a bunch of format strings. Other classes (e.g. Device, WiFiService) would pass these format strings in to Metrics::GetFullMetricName, to get the metric name including the technology type. Exposing the format strings to other modules is unnecessary, and makes it difficult for the compiler to check that the format string matches the parameters used in the body of GetFullMetricName. This leads g++ to generate warnings if -Wformat-nonliteral is enabled. Re-factor the code so that the format string lives inside of Metrics::GetFullMetricName. This way, g++ can check the format strings against the remaining arguments to base::StringPrintf. Then -Wformat-nonliteral doesn't generate warnings for Metrics. We'll enable (or, more precisely, stop disabling) -Wformat-nonliteral in a later CL, after fixing some other code that triggers the warning. BUG=chromium:293668 TEST=unit tests Change-Id: Ic6f533e02a5e882d8454548602dfdbd5630ab887 Reviewed-on: https://chromium-review.googlesource.com/197039 Tested-by: mukesh agrawal <quiche@chromium.org> Reviewed-by: Thieu Le <thieule@chromium.org> Commit-Queue: mukesh agrawal <quiche@chromium.org>