locale: add _unused_ attribute for dummy variable
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 6 Jun 2018 08:13:12 +0000 (17:13 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 6 Jun 2018 10:27:52 +0000 (12:27 +0200)
This suppresses the following warning by clang:
```
[588/1179] Compiling C object 'systemd-localed@exe/src_locale_localed.c.o'.
../src/locale/localed.c:271:39: warning: unused variable 'dummy' [-Wunused-variable]
        _cleanup_(locale_free) char **dummy = new_locale;
                                      ^
```

src/locale/localed.c

index d4835eb..0b4da63 100644 (file)
@@ -267,11 +267,10 @@ static void locale_free(char ***l) {
 static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *error) {
         Context *c = userdata;
         _cleanup_strv_free_ char **settings = NULL, **l = NULL;
-        char *new_locale[_VARIABLE_LC_MAX] = {};
-        _cleanup_(locale_free) char **dummy = new_locale;
+        char *new_locale[_VARIABLE_LC_MAX] = {}, **i;
+        _cleanup_(locale_free) _unused_ char **dummy = new_locale;
         bool modified = false;
         int interactive, p, r;
-        char **i;
 
         assert(m);
         assert(c);