chiark / gitweb /
tree-wide: adjust fall through comments so that gcc is happy
authorShawn Landden <slandden@gmail.com>
Sun, 19 Nov 2017 18:06:10 +0000 (10:06 -0800)
committerSven Eden <yamakuzure@gmx.net>
Sun, 19 Nov 2017 18:06:10 +0000 (10:06 -0800)
Distcc removes comments, making the comment silencing
not work.

I know there was a decision against a macro in commit
ec251fe7d5bc24b5d38b0853bc5969f3a0ba06e2

src/basic/generate-gperfs.py
src/basic/macro.h
src/basic/siphash24.c
src/basic/time-util.c
src/libelogind/sd-bus/bus-message.c
src/libelogind/sd-bus/bus-objects.c
src/libelogind/sd-id128/id128-util.c
src/login/logind-gperf.gperf

index d4cc9aa45c29530c35dfa5f579b596ae12b1478d..aca9ab1fe91e3123ac3a99355efb699d715283de 100755 (executable)
@@ -7,6 +7,12 @@ import sys
 
 name, prefix, input = sys.argv[1:]
 
+print("""\
+%{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
+#endif
+%}""")
 print("""\
 struct {}_name {{ const char* name; int id; }};
 %null-strings
index a51562db35aa461599367fcfed11886455fefe97..34e0657ac764c2abf815f0e60afe080065d8794d 100644 (file)
@@ -47,6 +47,7 @@
 #define _weakref_(x) __attribute__((weakref(#x)))
 #define _alignas_(x) __attribute__((aligned(__alignof(x))))
 #define _cleanup_(x) __attribute__((cleanup(x)))
+#define _fallthrough_ __attribute__((fallthrough))
 
 /* Temporarily disable some warnings */
 #define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT                     \
index 69794b6806b2a8e711d522dcd4f4ace1fe7cbffa..fe1413469c3994aa82d27aabd52c95839bd9601c 100644 (file)
@@ -133,25 +133,25 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
         switch (left) {
                 case 7:
                         state->padding |= ((uint64_t) in[6]) << 48;
-                        /* fall through */
+                        _fallthrough_;
                 case 6:
                         state->padding |= ((uint64_t) in[5]) << 40;
-                        /* fall through */
+                        _fallthrough_;
                 case 5:
                         state->padding |= ((uint64_t) in[4]) << 32;
-                        /* fall through */
+                        _fallthrough_;
                 case 4:
                         state->padding |= ((uint64_t) in[3]) << 24;
-                        /* fall through */
+                        _fallthrough_;
                 case 3:
                         state->padding |= ((uint64_t) in[2]) << 16;
-                        /* fall through */
+                        _fallthrough_;
                 case 2:
                         state->padding |= ((uint64_t) in[1]) <<  8;
-                        /* fall through */
+                        _fallthrough_;
                 case 1:
                         state->padding |= ((uint64_t) in[0]);
-                        /* fall through */
+                        _fallthrough_;
                 case 0:
                         break;
         }
index 68cbacc303eed20f273ed35303372b123e5b7285..718d2b31b2a5f941f308581f3ad7a189c7f82b17 100644 (file)
@@ -1405,8 +1405,7 @@ bool clock_supported(clockid_t clock) {
                 if (!clock_boottime_supported())
                         return false;
 
-                /* fall through */
-
+                _fallthrough_;
         default:
                 /* For everything else, check properly */
                 return clock_gettime(clock, &ts) >= 0;
index 0440cbf2088e7d4d7eff1a75feeaeddd966cad10..28f5c66a1a2f178487622ed52ea1122aca444967 100644 (file)
@@ -1436,7 +1436,7 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
                 case SD_BUS_TYPE_STRING:
                         p = strempty(p);
 
-                        /* Fall through... */
+                        _fallthrough_;
                 case SD_BUS_TYPE_OBJECT_PATH:
                         if (!p)
                                 return -EINVAL;
@@ -1496,7 +1496,7 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
                          * into the empty string */
                         p = strempty(p);
 
-                        /* Fall through... */
+                        _fallthrough_;
                 case SD_BUS_TYPE_OBJECT_PATH:
 
                         if (!p)
index 0c9b2d36b000c78295e70adb13943228bcae4ca7..e72bd19206afe9f2c50d6b9c38f41baef04c7926 100644 (file)
@@ -1755,8 +1755,7 @@ static int add_object_vtable_internal(
                                 goto fail;
                         }
 
-                        /* Fall through */
-
+                        _fallthrough_;
                 case _SD_BUS_VTABLE_PROPERTY: {
                         struct vtable_member *m;
 
index 2edb8df6693675966ef86f0a632f863960fb8e5d..9fcbc71461b987e69a43c82645dd54d4c6f60041 100644 (file)
@@ -116,7 +116,7 @@ int id128_read_fd(int fd, Id128Format f, sd_id128_t *ret) {
                 if (buffer[32] != '\n')
                         return -EINVAL;
 
-                /* fall through */
+                _fallthrough_;
         case 32: /* plain UUID without trailing newline */
                 if (f == ID128_UUID)
                         return -EINVAL;
@@ -128,7 +128,7 @@ int id128_read_fd(int fd, Id128Format f, sd_id128_t *ret) {
                 if (buffer[36] != '\n')
                         return -EINVAL;
 
-                /* fall through */
+                _fallthrough_;
         case 36: /* RFC UUID without trailing newline */
                 if (f == ID128_PLAIN)
                         return -EINVAL;
index a3c0861e52d0a6ab6a6d9f4bf90a2c8522d13e56..63ac5a2b97e6c22f76f6c9c61e64254f9f63ca57 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "logind.h"