]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man/example: also build example code with C90
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Apr 2024 17:25:57 +0000 (02:25 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Apr 2024 18:23:20 +0000 (03:23 +0900)
Unfortunately, sd-bus-vtable.h, sd-journal.h, and sd-id128.h
have variadic macro and inline initialization of sub-object, these are
not supported in C90. So, we need to silence some errors.

man/logcontrol-example.c
man/meson.build
man/sd-bus-container-append.c

index 8c45369fc3b39b77add379244675b64da8fc4957..23e73846cdb2fd2f0a67e0d74b217e91314fc70d 100644 (file)
@@ -124,7 +124,8 @@ static int property_set(
     return r;
 
   if (strcmp(property, "LogLevel") == 0) {
-    for (int i = 0; i < LOG_DEBUG + 1; i++)
+    int i;
+    for (i = 0; i < LOG_DEBUG + 1; i++)
       if (strcmp(value, log_level_table[i]) == 0) {
         o->log_level = i;
         setlogmask(LOG_UPTO(i));
@@ -138,7 +139,8 @@ static int property_set(
   }
 
   if (strcmp(property, "LogTarget") == 0) {
-    for (LogTarget i = 0; i < _LOG_TARGET_MAX; i++)
+    LogTarget i;
+    for (i = 0; i < _LOG_TARGET_MAX; i++)
       if (strcmp(value, log_target_table[i]) == 0) {
         o->log_target = i;
         return 0;
index a728fa33842a9d1272b6aa5aae5f0ef3b411fd5b..69ea5c403ecb48328158ff56e08072cc7bb32a46 100644 (file)
@@ -306,10 +306,12 @@ default_args = [
 ]
 
 std_args_in = [
+        [ '-std=c90', '-Wno-pedantic', '-Wno-variadic-macros', ],
         [ '-std=c99', ],
         [ '-std=c11', ],
         [ '-std=c17', ],
         [ '-std=c23', ],
+        [ '-std=gnu90', '-Wno-pedantic', '-Wno-variadic-macros', ],
         [ '-std=gnu99', ],
         [ '-std=gnu11', ],
         [ '-std=gnu17', ],
index 8bb4f33e867ab4e71dbf924fdb2267fa0e8be2ce..07a24f24cc6ced7f4983f0ef0dcf29feafad6cd7 100644 (file)
@@ -3,13 +3,14 @@
 #include <systemd/sd-bus.h>
 
 int append_strings_to_message(sd_bus_message *m, const char *const *arr) {
+  const char *s;
   int r;
 
   r = sd_bus_message_open_container(m, 'a', "s");
   if (r < 0)
     return r;
 
-  for (const char *s = *arr; *s; s++) {
+  for (s = *arr; *s; s++) {
     r = sd_bus_message_append(m, "s", s);
     if (r < 0)
       return r;