[PATCH] Add support for fall-through handling if the compiler supports it

Andreas Schneider asn at samba.org
Mon Feb 26 10:23:42 UTC 2018


On Friday, 23 February 2018 19:07:44 CET Andrew Bartlett wrote:
> On Tue, 2018-02-20 at 17:32 +0100, Andreas Schneider via samba-
> 
> technical wrote:
> > Yes, that's true. I've addressed it in the attached patchset.
> 
> I tried to push this, but it failed autobuild on ldb.
> 
> Can you push it to github and make a pull request?  That will trigger a
> Travis CI job that should cover everything on 14.04.  (or do a private
> autobuild).

I've fixed it, the configure check for the attribute needed to be build with 
'-Werror' to detect it correctly.

The latest rebased patchset is attached.

A travis CI run is in the following pull request:
https://github.com/samba-team/samba/pull/133


Thanks for the review.



	Andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org
-------------- next part --------------
>From ca7cb8e8a3c8c0bd000ca278140711bfa24a812d Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:16:43 +0200
Subject: [PATCH 01/58] s4:lib:com: Fix function declartions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 librpc/idl/dcom.idl              | 2 +-
 source4/lib/com/classes/simple.c | 4 ++--
 source4/lib/com/main.c           | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/librpc/idl/dcom.idl b/librpc/idl/dcom.idl
index e53d7b8f811..5559811be38 100644
--- a/librpc/idl/dcom.idl
+++ b/librpc/idl/dcom.idl
@@ -52,7 +52,7 @@ interface IUnknown
 	[local] WERROR CreateInstance(
 		[in,unique] MInterfacePointer *pUnknown,
 		[in,unique] GUID *iid,
-		[out, iid_is(riid),unique] MInterfacePointer *ppv
+		[out, iid_is(riid),unique] MInterfacePointer **ppv
 		);
 
 	[call_as(CreateInstance)] WERROR RemoteCreateInstance();
diff --git a/source4/lib/com/classes/simple.c b/source4/lib/com/classes/simple.c
index 4d28a158102..54c74ce564b 100644
--- a/source4/lib/com/classes/simple.c
+++ b/source4/lib/com/classes/simple.c
@@ -75,7 +75,7 @@ static WERROR simpleclass_IClassFactory_CreateInstance(struct IClassFactory *d,
 						       TALLOC_CTX *mem_ctx,
 						       struct MInterfacePointer *pUnknown,
 						       struct GUID *iid,
-						       struct MInterfacePointer *ppv)
+						       struct MInterfacePointer **ppv)
 {
 	struct IStream *ret;
 	/* FIXME: Check whether IID == ISTREAM_IID */
@@ -84,7 +84,7 @@ static WERROR simpleclass_IClassFactory_CreateInstance(struct IClassFactory *d,
 	ret->vtable = &simple_IStream_vtable;
 	ret->object_data = NULL;
 
-	ppv = (struct MInterfacePointer *)ret;
+	*ppv = (struct MInterfacePointer *)ret;
 
 	return WERR_OK;
 }
diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c
index 68a3bc6d3d3..647f32346d9 100644
--- a/source4/lib/com/main.c
+++ b/source4/lib/com/main.c
@@ -52,7 +52,7 @@ WERROR com_create_object(struct com_context *ctx, struct GUID *clsid, int num_if
 	}
 
 	/* Run IClassFactory::CreateInstance() */
-	error = IClassFactory_CreateInstance(factory, ctx, NULL, &classfact_iid, (struct MInterfacePointer *) &iunk);
+	error = IClassFactory_CreateInstance(factory, ctx, NULL, &classfact_iid, (struct MInterfacePointer **)&iunk);
 	if (!W_ERROR_IS_OK(error)) {
 		DEBUG(3, ("Error while calling IClassFactory::CreateInstance : %s\n", win_errstr(error)));
 		return error;
@@ -64,7 +64,7 @@ WERROR com_create_object(struct com_context *ctx, struct GUID *clsid, int num_if
 	}
 	
 	/* Release class object */
-	IUnknown_Release(factory, ctx);
+	IUnknown_Release((struct IUnknown *)factory, ctx);
 	
 	error = WERR_OK;
 	
-- 
2.16.2


>From 98530e32d697bbd17fe25ca21cd027df6902a854 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:51:39 +0200
Subject: [PATCH 02/58] lib:texpect: Avoid some compiler warnings

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/texpect/texpect.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c
index b553de8ca5c..dd786705e8e 100644
--- a/lib/texpect/texpect.c
+++ b/lib/texpect/texpect.c
@@ -434,6 +434,9 @@ int main(int argc, const char **argv)
 	switch (pid) {
 		case -1:
 			err(1, "Failed to fork");
+
+			/* Never reached */
+			return 1;
 		case 0:
 
 			if(setsid()<0)
@@ -448,6 +451,9 @@ int main(int argc, const char **argv)
 			/* texpect <expect_instructions> <progname> [<args>] */
 			execvp(program, program_args);
 			err(1, "Failed to exec: %s", program);
+
+			/* Never reached */
+			return 1;
 		default:
 			close(slave);
 			{
@@ -462,4 +468,7 @@ int main(int argc, const char **argv)
 
 			return eval_parent(pid);
 	}
+
+	/* Never reached */
+	return 1;
 }
-- 
2.16.2


>From 6863c2e80abccf30d0319886c4577af34daec2db Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:33:10 +0200
Subject: [PATCH 03/58] lib:replace: Add FALL_THROUGH support

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 .ycm_extra_conf.py    |  1 +
 lib/replace/replace.h |  9 +++++++++
 lib/replace/wscript   | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+)

diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py
index c96b59e373b..97122a9169e 100644
--- a/.ycm_extra_conf.py
+++ b/.ycm_extra_conf.py
@@ -47,6 +47,7 @@ flags = [
     '-D_XOPEN_SOURCE_EXTENDED=1',
     '-DAD_DC_BUILD_IS_ENABLED=1',
     '-DHAVE_IPV6=1',
+    '-DFALL_THROUGH',
     '-I/usr/local/include',
     '-I.',
     '-Iauth',
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 128978c561e..e2a55415e04 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -922,6 +922,15 @@ void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
 #define setproctitle_init rep_setproctitle_init
 void rep_setproctitle_init(int argc, char *argv[], char *envp[]);
 #endif
+
+#ifndef FALL_THROUGH
+# ifdef HAVE_FALLTHROUGH_ATTRIBUTE
+#  define FALL_THROUGH __attribute__ ((fallthrough))
+# else /* HAVE_FALLTHROUGH_ATTRIBUTE */
+#  define FALL_THROUGH ((void)0)
+# endif /* HAVE_FALLTHROUGH_ATTRIBUTE */
+#endif /* FALL_THROUGH */
+
 bool nss_wrapper_enabled(void);
 bool nss_wrapper_hosts_enabled(void);
 bool socket_wrapper_enabled(void);
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 2c638b77212..309e9f7c156 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -250,6 +250,42 @@ def configure(conf):
                     headers='stdint.h sys/atomic.h',
                     msg='Checking for atomic_add_32 compiler builtin')
 
+    conf.CHECK_CODE('''
+                    #define FALL_THROUGH __attribute__((fallthrough))
+
+                    enum direction_e {
+                        UP = 0,
+                        DOWN,
+                    };
+
+                    int main(void) {
+                        enum direction_e key = UP;
+                        int i = 10;
+                        int j = 0;
+
+                        switch (key) {
+                        case UP:
+                            i = 5;
+                            FALL_THROUGH;
+                        case DOWN:
+                            j = i * 2;
+                            break;
+                        default:
+                            break;
+                        }
+
+                        if (j < i) {
+                            return 1;
+                        }
+
+                        return 0;
+                    }
+                    ''',
+                    'HAVE_FALLTHROUGH_ATTRIBUTE',
+                    addmain=False,
+                    cflags='-Werror',
+                    msg='Checking for fallthrough attribute')
+
     # these may be builtins, so we need the link=False strategy
     conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy strncpy bzero', link=False)
 
-- 
2.16.2


>From 81db24fd2a91bd730e43075217d4564068994a25 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:25:46 +0200
Subject: [PATCH 04/58] lib:replace: Add FALL_THROUGH statements in strptime.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/replace/strptime.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/replace/strptime.c b/lib/replace/strptime.c
index 20e5d8c39b6..bbc742277de 100644
--- a/lib/replace/strptime.c
+++ b/lib/replace/strptime.c
@@ -462,7 +462,8 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
 	      *decided = raw;
 	    }
 #endif
-	  /* Fall through.  */
+
+	  FALL_THROUGH;
 	case 'D':
 	  /* Match standard day format.  */
 	  if (!recursive (HERE_D_FMT))
@@ -611,7 +612,8 @@ strptime_internal (rp, fmt, tm, decided, era_cnt)
 	      *decided = raw;
 	    }
 #endif
-	  /* Fall through.  */
+
+	  FALL_THROUGH;
 	case 'T':
 	  if (!recursive (HERE_T_FMT))
 	    return NULL;
-- 
2.16.2


>From 0fcc03d870dd7321f8dea1dd3149d6b60af9229f Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:17:21 +0200
Subject: [PATCH 05/58] lib:ldb: Add FALL_THROUGH statements in common/ldb_dn.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/ldb/common/ldb_dn.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c
index b23ee1734cd..dfeb600f56f 100644
--- a/lib/ldb/common/ldb_dn.c
+++ b/lib/ldb/common/ldb_dn.c
@@ -629,7 +629,8 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 					l++;
 					break;
 				}
-				/* fall through */
+
+				FALL_THROUGH;
 			case '\"':
 			case '<':
 			case '>':
-- 
2.16.2


>From 366bfa59947f747d549ff00659cd047d2df302aa Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:18:28 +0200
Subject: [PATCH 06/58] lib:ldb: Add FALL_THROUGH statements in
 ldb_map/ldb_map_inbound.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/ldb/ldb_map/ldb_map_inbound.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/ldb/ldb_map/ldb_map_inbound.c b/lib/ldb/ldb_map/ldb_map_inbound.c
index 461e68113ab..861c4c1622d 100644
--- a/lib/ldb/ldb_map/ldb_map_inbound.c
+++ b/lib/ldb/ldb_map/ldb_map_inbound.c
@@ -87,7 +87,8 @@ static int ldb_msg_el_partition(struct ldb_module *module, enum ldb_request_type
 			el = ldb_msg_el_map_local(module, remote, map, old);
 			break;
 		}
-		/* fall through */
+
+		FALL_THROUGH;
 	case LDB_MAP_IGNORE:
 		goto local;
 
@@ -99,7 +100,8 @@ static int ldb_msg_el_partition(struct ldb_module *module, enum ldb_request_type
 				  map->local_name);
 			goto local;
 		}
-		/* fall through */
+
+		FALL_THROUGH;
 	case LDB_MAP_KEEP:
 	case LDB_MAP_RENAME:
 		el = ldb_msg_el_map_local(module, remote, map, old);
-- 
2.16.2


>From 11e78f17b0823a4f17a53a2a254b0c51239ce1df Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:19:23 +0200
Subject: [PATCH 07/58] lib:ldb: Add FALL_THROUGH statements in
 ldb_map/ldb_map.c

---
 lib/ldb/ldb_map/ldb_map.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/ldb/ldb_map/ldb_map.c b/lib/ldb/ldb_map/ldb_map.c
index f2a86fedd45..b453dff80d2 100644
--- a/lib/ldb/ldb_map/ldb_map.c
+++ b/lib/ldb/ldb_map/ldb_map.c
@@ -523,7 +523,8 @@ struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, struct
 					  "used in DN!", ldb_dn_get_component_name(dn, i));
 				goto failed;
 			}
-			/* fall through */
+
+			FALL_THROUGH;
 		case LDB_MAP_KEEP:
 		case LDB_MAP_RENAME:
 		case LDB_MAP_RENDROP:
@@ -599,7 +600,8 @@ struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, struc
 					  "used in DN!", ldb_dn_get_component_name(dn, i));
 				goto failed;
 			}
-			/* fall through */
+
+			FALL_THROUGH;
 		case LDB_MAP_KEEP:
 		case LDB_MAP_RENAME:
 		case LDB_MAP_RENDROP:
-- 
2.16.2


>From bce1fc644bddb3444101eb160cab70ec9bbf7bc7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:20:04 +0200
Subject: [PATCH 08/58] lib:ldb: Add FALL_THROUGH statements in
 ldb_map/ldb_map_outbound.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/ldb/ldb_map/ldb_map_outbound.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ldb/ldb_map/ldb_map_outbound.c b/lib/ldb/ldb_map/ldb_map_outbound.c
index fd25c3658da..1f1a7e80142 100644
--- a/lib/ldb/ldb_map/ldb_map_outbound.c
+++ b/lib/ldb/ldb_map/ldb_map_outbound.c
@@ -330,7 +330,8 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local
 				  attr_name);
 			return LDB_SUCCESS;
 		}
-		/* fall through */
+
+		FALL_THROUGH;
 	case LDB_MAP_KEEP:
 	case LDB_MAP_RENAME:
 	case LDB_MAP_RENDROP:
-- 
2.16.2


>From e5d5db48afa4a7d56be609b0e66c0e7214418f9d Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 15:20:57 +0200
Subject: [PATCH 09/58] lib:param: Add FALL_THROUGH statements in loadparm.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/param/loadparm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index efad4a10f03..b46700dfb54 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2058,7 +2058,8 @@ void lpcfg_print_parameter(struct parm_struct *p, void *ptr, FILE * f)
 
 		case P_CMDLIST:
 			list_sep = " ";
-			/* fall through */
+
+			FALL_THROUGH;
 		case P_LIST:
 			if ((char ***)ptr && *(char ***)ptr) {
 				char **list = *(char ***)ptr;
-- 
2.16.2


>From 5328f2e1954b887747cfa881d29ef101c7843871 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:49:50 +0200
Subject: [PATCH 10/58] lib:util: Add FALL_THROUGH statements in substitute.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/util/substitute.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/util/substitute.c b/lib/util/substitute.c
index 49adeaf178a..2c18257da25 100644
--- a/lib/util/substitute.c
+++ b/lib/util/substitute.c
@@ -84,6 +84,7 @@ static void string_sub2(char *s,const char *pattern, const char *insert, size_t
 					p[i] = insert[i];
 					break;
 				}
+				FALL_THROUGH;
 			case '`':
 			case '"':
 			case '\'':
@@ -98,6 +99,7 @@ static void string_sub2(char *s,const char *pattern, const char *insert, size_t
 					 * not replacing unsafe chars */
 					break;
 				}
+				FALL_THROUGH;
 			default:
 				p[i] = insert[i];
 			}
-- 
2.16.2


>From 5c5ddbae5f994afcf203c3bd7256fa4d76506f72 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:40:14 +0200
Subject: [PATCH 11/58] lib:util: Add FALL_THROUGH statements in
 charset/charset_macosxfs.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/util/charset/charset_macosxfs.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/util/charset/charset_macosxfs.c b/lib/util/charset/charset_macosxfs.c
index 895277d001a..24e21fd6d2c 100644
--- a/lib/util/charset/charset_macosxfs.c
+++ b/lib/util/charset/charset_macosxfs.c
@@ -457,10 +457,11 @@ static size_t macosxfs_encoding_pull(
 
 	switch(result) {
 	case kCFStringEncodingConversionSuccess:
-		if (*inbytesleft == srcCharsUsed)
+		if (*inbytesleft == srcCharsUsed) {
 			break;
-		else
-			; /*fall through*/
+		}
+
+		FALL_THROUGH;
 	case kCFStringEncodingInsufficientOutputBufferLength:
 		debug_out("String conversion: "
 			  "Output buffer too small\n");
@@ -546,10 +547,11 @@ static size_t macosxfs_encoding_push(
 
 	switch(result) {
 	case kCFStringEncodingConversionSuccess:
-		if (*inbytesleft/2 == srcCharsUsed)
+		if (*inbytesleft/2 == srcCharsUsed) {
 			break;
-		else
-			; /*fall through*/
+		}
+
+		FALL_THROUGH;
 	case kCFStringEncodingInsufficientOutputBufferLength:
 		debug_out("String conversion: "
 			  "Output buffer too small\n");
-- 
2.16.2


>From 6b99b5a7688c44f9ad93e26389fd299bea0a967c Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:41:25 +0200
Subject: [PATCH 12/58] lib:util: Add FALL_THROUGH statements in util_file.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/util/util_file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index ac8206008a3..499e8c46693 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -130,7 +130,8 @@ char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, int maxlen, FILE *f)
 			    if (start_of_line) {
 				    break;
 			    }
-			    /* fall through */
+
+			    FALL_THROUGH;
 		    default:
 			    start_of_line = false;
 			    s[len++] = c;
-- 
2.16.2


>From ca06c1b59d6aaa329316098a1ef907f107cfdee7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:22:44 +0200
Subject: [PATCH 13/58] s3:lib: Add FALL_THROUGH statements in
 substitute_generic.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/lib/substitute_generic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/lib/substitute_generic.c b/source3/lib/substitute_generic.c
index f24608eb96c..0498cd03833 100644
--- a/source3/lib/substitute_generic.c
+++ b/source3/lib/substitute_generic.c
@@ -68,6 +68,7 @@ char *realloc_string_sub2(char *string,
 				if (allow_trailing_dollar && (i == li - 1 )) {
 					break;
 				}
+				FALL_THROUGH;
 			case '`':
 			case '"':
 			case '\'':
@@ -79,6 +80,7 @@ char *realloc_string_sub2(char *string,
 					in[i] = '_';
 					break;
 				}
+				FALL_THROUGH;
 			default:
 				/* ok */
 				break;
-- 
2.16.2


>From 8bd9c096f867cf769f9b2150003c5e00d419fd98 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 16:57:38 +0200
Subject: [PATCH 14/58] s3:lib: Add FALL_THROUGH statements in util_path.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/lib/util_path.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/source3/lib/util_path.c b/source3/lib/util_path.c
index 6f58a03ae58..5b133dfdc78 100644
--- a/source3/lib/util_path.c
+++ b/source3/lib/util_path.c
@@ -204,16 +204,20 @@ char *canonicalize_absolute_path(TALLOC_CTX *ctx, const char *abs_path)
 			switch(siz) {
 				case 5:
 					*d++ = *s++;
-					/*fall through*/
+
+					FALL_THROUGH;
 				case 4:
 					*d++ = *s++;
-					/*fall through*/
+
+					FALL_THROUGH;
 				case 3:
 					*d++ = *s++;
-					/*fall through*/
+
+					FALL_THROUGH;
 				case 2:
 					*d++ = *s++;
-					/*fall through*/
+
+					FALL_THROUGH;
 				case 1:
 					*d++ = *s++;
 					break;
-- 
2.16.2


>From 8984a15b796b01c9dcd95b12abfdbb30859bde9e Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:25:20 +0200
Subject: [PATCH 15/58] s3:lib: Add FALL_THROUGH statements in util_str.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/lib/util_str.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 48e434f777e..eb36478d8a2 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -276,6 +276,8 @@ char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
 				if (allow_trailing_dollar && (i == li - 1 )) {
 					break;
 				}
+
+				FALL_THROUGH;
 			case '`':
 			case '"':
 			case '\'':
@@ -287,6 +289,8 @@ char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src,
 					in[i] = '_';
 					break;
 				}
+
+				FALL_THROUGH;
 			default:
 				/* ok */
 				break;
-- 
2.16.2


>From 65c2867fdaac4fc6b7cb6897c3d88d275a2376c4 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:55:10 +0200
Subject: [PATCH 16/58] lib:tdb: Add FALL_THROUGH statements in hash.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/tdb/common/hash.c | 50 +++++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/lib/tdb/common/hash.c b/lib/tdb/common/hash.c
index 1eed7221d2a..4de7ba94d2c 100644
--- a/lib/tdb/common/hash.c
+++ b/lib/tdb/common/hash.c
@@ -232,16 +232,16 @@ static uint32_t hashlittle( const void *key, size_t length )
     switch(length)
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-    case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
-    case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
-    case 9 : c+=k8[8];                   /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16; FALL_THROUGH;
+    case 10: c+=((uint32_t)k8[9])<<8;   FALL_THROUGH;
+    case 9 : c+=k8[8];                  FALL_THROUGH;
     case 8 : b+=k[1]; a+=k[0]; break;
-    case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
-    case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
-    case 5 : b+=k8[4];                   /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;  FALL_THROUGH;
+    case 6 : b+=((uint32_t)k8[5])<<8;   FALL_THROUGH;
+    case 5 : b+=k8[4];                  FALL_THROUGH;
     case 4 : a+=k[0]; break;
-    case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
-    case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;  FALL_THROUGH;
+    case 2 : a+=((uint32_t)k8[1])<<8;   FALL_THROUGH;
     case 1 : a+=k8[0]; break;
     case 0 : return c;
     }
@@ -268,23 +268,23 @@ static uint32_t hashlittle( const void *key, size_t length )
              b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 11: c+=((uint32_t)k8[10])<<16;     /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;      FALL_THROUGH;
     case 10: c+=k[4];
              b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 9 : c+=k8[8];                      /* fall through */
+    case 9 : c+=k8[8];                       FALL_THROUGH;
     case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 7 : b+=((uint32_t)k8[6])<<16;      /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;       FALL_THROUGH;
     case 6 : b+=k[2];
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 5 : b+=k8[4];                      /* fall through */
+    case 5 : b+=k8[4];                       FALL_THROUGH;
     case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 3 : a+=((uint32_t)k8[2])<<16;      /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;       FALL_THROUGH;
     case 2 : a+=k[0];
              break;
     case 1 : a+=k8[0];
@@ -316,19 +316,19 @@ static uint32_t hashlittle( const void *key, size_t length )
     }
 
     /*-------------------------------- last block: affect all 32 bits of (c) */
-    switch(length)                   /* all the case statements fall through */
+    switch(length)
     {
-    case 12: c+=((uint32_t)k[11])<<24;
-    case 11: c+=((uint32_t)k[10])<<16;
-    case 10: c+=((uint32_t)k[9])<<8;
-    case 9 : c+=k[8];
-    case 8 : b+=((uint32_t)k[7])<<24;
-    case 7 : b+=((uint32_t)k[6])<<16;
-    case 6 : b+=((uint32_t)k[5])<<8;
-    case 5 : b+=k[4];
-    case 4 : a+=((uint32_t)k[3])<<24;
-    case 3 : a+=((uint32_t)k[2])<<16;
-    case 2 : a+=((uint32_t)k[1])<<8;
+    case 12: c+=((uint32_t)k[11])<<24; FALL_THROUGH;
+    case 11: c+=((uint32_t)k[10])<<16; FALL_THROUGH;
+    case 10: c+=((uint32_t)k[9])<<8;   FALL_THROUGH;
+    case 9 : c+=k[8];                  FALL_THROUGH;
+    case 8 : b+=((uint32_t)k[7])<<24;  FALL_THROUGH;
+    case 7 : b+=((uint32_t)k[6])<<16;  FALL_THROUGH;
+    case 6 : b+=((uint32_t)k[5])<<8;   FALL_THROUGH;
+    case 5 : b+=k[4];                  FALL_THROUGH;
+    case 4 : a+=((uint32_t)k[3])<<24;  FALL_THROUGH;
+    case 3 : a+=((uint32_t)k[2])<<16;  FALL_THROUGH;
+    case 2 : a+=((uint32_t)k[1])<<8;   FALL_THROUGH;
     case 1 : a+=k[0];
              break;
     case 0 : return c;
-- 
2.16.2


>From 49ae2217097743d75d37fb6c79df5f768f1f62b2 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:58:00 +0200
Subject: [PATCH 17/58] lib:tdb: Add FALL_THROUGH statements in tdbtool.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/tdb/tools/tdbtool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c
index e3535b93c7c..d8bacdb61b8 100644
--- a/lib/tdb/tools/tdbtool.c
+++ b/lib/tdb/tools/tdbtool.c
@@ -930,10 +930,13 @@ int main(int argc, char *argv[])
 		break;
 	case 5:
 		arg2 = tdb_convert_string(argv[4],&arg2len);
+		FALL_THROUGH;
 	case 4:
 		arg1 = tdb_convert_string(argv[3],&arg1len);
+		FALL_THROUGH;
 	case 3:
 		cmdname = argv[2];
+		FALL_THROUGH;
 	default:
 		do_command();
 		break;
-- 
2.16.2


>From f6ba541fc49b733296b0ca14cdf2243365027f27 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:28:12 +0200
Subject: [PATCH 18/58] lib:tdb: Add FALL_THROUGH statements in
 common/summary.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/tdb/common/summary.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/tdb/common/summary.c b/lib/tdb/common/summary.c
index d786132d4a1..c9b5bc4c1d0 100644
--- a/lib/tdb/common/summary.c
+++ b/lib/tdb/common/summary.c
@@ -151,7 +151,8 @@ _PUBLIC_ char *tdb_summary(struct tdb_context *tdb)
 				rec.rec_len = tdb_dead_space(tdb, off)
 					- sizeof(rec);
 			}
-			/* Fall through */
+
+			FALL_THROUGH;
 		case TDB_DEAD_MAGIC:
 			tally_add(&dead, rec.rec_len);
 			break;
-- 
2.16.2


>From f2a56477aad8a6e022a83c74f2f9a16a07737a46 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:43:53 +0200
Subject: [PATCH 19/58] libgpo: Add FALL_THROUGH statements in gpo_sec.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 libgpo/gpo_sec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libgpo/gpo_sec.c b/libgpo/gpo_sec.c
index af73697e56e..98ee8eb3cc9 100644
--- a/libgpo/gpo_sec.c
+++ b/libgpo/gpo_sec.c
@@ -47,13 +47,15 @@ static bool gpo_sd_check_agp_object_guid(const struct security_ace_object *objec
 				       &ext_right_apg_guid)) {
 				return true;
 			}
-			/* FALL TROUGH */
+
+			FALL_THROUGH;
 		case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
 			if (GUID_equal(&object->inherited_type.inherited_type,
 				       &ext_right_apg_guid)) {
 				return true;
 			}
-			/* FALL TROUGH */
+
+			FALL_THROUGH;
 		default:
 			break;
 	}
-- 
2.16.2


>From d498fffbfd752a401a4e36235afafb52105c9252 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:03:09 +0200
Subject: [PATCH 20/58] librpc:ndr: Add FALL_THROUGH statements in ndr_cab.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 librpc/ndr/ndr_cab.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/librpc/ndr/ndr_cab.c b/librpc/ndr/ndr_cab.c
index 837ed253065..c415bfab34c 100644
--- a/librpc/ndr/ndr_cab.c
+++ b/librpc/ndr/ndr_cab.c
@@ -95,10 +95,13 @@ static uint32_t ndr_cab_compute_checksum(uint8_t *data, uint32_t length, uint32_
 	switch (length % 4) {
 	case 3:
 		ul |= (((uint32_t)(*pb++)) << 16);
+		FALL_THROUGH;
 	case 2:
 		ul |= (((uint32_t)(*pb++)) <<  8);
+		FALL_THROUGH;
 	case 1:
 		ul |= (uint32_t)(*pb++);
+		FALL_THROUGH;
 	default:
 		break;
 	}
-- 
2.16.2


>From d7a95d2a51fe8ad87616e29363375fe6c4b50aa7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:35:28 +0200
Subject: [PATCH 21/58] s3:auth: Add FALL_THROUGH statements in auth_sam.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/auth/auth_sam.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c
index 4bcb7926c6e..46958c54d3a 100644
--- a/source3/auth/auth_sam.c
+++ b/source3/auth/auth_sam.c
@@ -88,6 +88,8 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context,
 					? "ROLE_DOMAIN_MEMBER" : "ROLE_STANDALONE") ));
 				return NT_STATUS_NOT_IMPLEMENTED;
 			}
+
+			FALL_THROUGH;
 		case ROLE_DOMAIN_PDC:
 		case ROLE_DOMAIN_BDC:
 			if ( !is_local_name && !is_my_domain ) {
@@ -95,6 +97,8 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context,
 					user_info->mapped.domain_name));
 				return NT_STATUS_NOT_IMPLEMENTED;
 			}
+
+			FALL_THROUGH;
 		default: /* name is ok */
 			break;
 	}
-- 
2.16.2


>From 36fc89c9d14bcf2aac3f14625956e230864ed805 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 16:55:23 +0200
Subject: [PATCH 22/58] s3:auth: Add FALL_THROUGH statements in pampass.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/auth/pampass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 1a82fe7f203..8cb894482ae 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -168,7 +168,7 @@ static int smb_pam_conv(int num_msg,
 				break;
 
 			case PAM_TEXT_INFO:
-				/* fall through */
+				FALL_THROUGH;
 
 			case PAM_ERROR_MSG:
 				/* ignore it... */
@@ -390,7 +390,7 @@ static int smb_pam_passchange_conv(int num_msg,
 			break;
 
 		case PAM_TEXT_INFO:
-			/* fall through */
+			FALL_THROUGH;
 
 		case PAM_ERROR_MSG:
 			/* ignore it... */
-- 
2.16.2


>From 374e2f5d31a0b045ab52613c77b680e5ba641f92 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:25:30 +0200
Subject: [PATCH 23/58] s3:lib: Add FALL_THROUGH statements in cbuf.c

---
 source3/lib/cbuf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/lib/cbuf.c b/source3/lib/cbuf.c
index 611aa80609f..426ecdb5a3b 100644
--- a/source3/lib/cbuf.c
+++ b/source3/lib/cbuf.c
@@ -278,7 +278,8 @@ int cbuf_print_quoted_string(cbuf* ost, const char* s)
 		case '\\':
 			cbuf_putc(ost, '\\');
 		        n++;
-			/* no break */
+
+			FALL_THROUGH;
 		default:
 			cbuf_putc(ost, *s);
 			n++;
-- 
2.16.2


>From f48e06bb1f3ca129db05bbee94b6c01f14c9ee00 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:51:08 +0200
Subject: [PATCH 24/58] s3:lib: Add FALL_THROUGH statements in sysacls.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/lib/sysacls.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
index 0bf3c37edfa..c80f8f30c90 100644
--- a/source3/lib/sysacls.c
+++ b/source3/lib/sysacls.c
@@ -186,7 +186,8 @@ char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p)
 
 			case SMB_ACL_USER:
 				id = uidtoname(ap->info.user.uid);
-				/* FALL TROUGH */
+
+				FALL_THROUGH;
 			case SMB_ACL_USER_OBJ:
 				tag = "user";
 				break;
@@ -199,7 +200,8 @@ char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p)
 				} else {
 					id = gr->gr_name;
 				}
-				/* FALL TROUGH */
+
+				FALL_THROUGH;
 			case SMB_ACL_GROUP_OBJ:
 				tag = "group";
 				break;
-- 
2.16.2


>From 1cf28fdcc36adc216e62586f341caa274e62a11e Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:54:48 +0200
Subject: [PATCH 25/58] s3:lib: Add FALL_THROUGH statements in util_sd.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/lib/util_sd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/lib/util_sd.c b/source3/lib/util_sd.c
index aa6d4809fc8..39083b15438 100644
--- a/source3/lib/util_sd.c
+++ b/source3/lib/util_sd.c
@@ -394,6 +394,8 @@ static bool parse_ace_flags(const char *str, unsigned int *pflags)
 		switch (*p) {
 		case '|':
 			p++;
+
+			FALL_THROUGH;
 		case '\0':
 			continue;
 		default:
-- 
2.16.2


>From 2bdd3ce2ec30c09917cbc7b9daf6a976de1e4f9b Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:36:50 +0200
Subject: [PATCH 26/58] s3:libsmb: Add FALL_THROUGH statements in dsgetdcname.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/libsmb/dsgetdcname.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c
index 2fb9842a893..a7fe5a1e748 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -715,6 +715,8 @@ static void map_dc_and_domain_names(uint32_t flags,
 				*domain_p = domain_name;
 				break;
 			}
+
+			FALL_THROUGH;
 		case DS_RETURN_DNS_NAME:
 		default:
 			if (dns_dc_name && dns_domain_name &&
-- 
2.16.2


>From f301b3a314fbd0a357d99d935cd4e789852c5c76 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:53:45 +0200
Subject: [PATCH 27/58] s3:modules: Add FALL_THROUGH statements in
 vfs_acl_common.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/modules/vfs_acl_common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index 546e97b9b5d..b323079d08a 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -519,6 +519,7 @@ static NTSTATUS validate_nt_acl_blob(TALLOC_CTX *mem_ctx,
 		}
 
 		/* Otherwise, fall though and see if the NT ACL hash matches */
+		FALL_THROUGH;
 	}
 	case 3:
 		/* Get the full underlying sd for the hash
-- 
2.16.2


>From 030341683c71c6efc5aaaec917e9a269e010cbf7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:50:18 +0200
Subject: [PATCH 28/58] s3:smbd: Add FALL_THROUGH statements in nttrans.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/smbd/nttrans.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 7b7f2056099..ca02dbcc3d9 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -2387,6 +2387,7 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
 
 			start_enum = False;
 
+			FALL_THROUGH;
 		case TRANSACT_GET_USER_QUOTA_LIST_START:
 
 			if (qt_handle->quota_list==NULL &&
-- 
2.16.2


>From 6c3f59d7cff79af0217385a3e148486cf203fc8a Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:52:06 +0200
Subject: [PATCH 29/58] s3:smbd: Add FALL_THROUGH statements in trans2.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/smbd/trans2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 512918efc89..b49c3ca7836 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -4032,7 +4032,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
 				SIVAL(pdata,84,0x100); /* Don't support mac... */
 				break;
 			}
-			/* drop through */
+
+			FALL_THROUGH;
 		default:
 			return NT_STATUS_INVALID_LEVEL;
 	}
-- 
2.16.2


>From ca201d611b6af03debd41012288da0181b0f93d2 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:55:35 +0200
Subject: [PATCH 30/58] s3:utils: Add FALL_THROUGH statements in regedit.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/utils/regedit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/utils/regedit.c b/source3/utils/regedit.c
index 14e75c25bfa..27bd6f8f2c2 100644
--- a/source3/utils/regedit.c
+++ b/source3/utils/regedit.c
@@ -507,7 +507,8 @@ static void handle_value_input(struct regedit *regedit, int c)
 	case 'b':
 	case 'B':
 		binmode = true;
-		/* Falthrough... */
+
+		FALL_THROUGH;
 	case '\n':
 	case KEY_ENTER:
 		vitem = value_list_get_current_item(regedit->vl);
-- 
2.16.2


>From 8ef2f7ac1791d6914677db19a231fbbcf613e7c9 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:57:10 +0200
Subject: [PATCH 31/58] s3:utils: Add FALL_THROUGH statements in net_conf.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/utils/net_conf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 8d9f1e6b99b..097baa1b82e 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -294,6 +294,8 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
 				d_printf(_("error: out of memory!\n"));
 				goto done;
 			}
+
+			FALL_THROUGH;
 		case 1:
 			filename = argv[0];
 			break;
@@ -563,6 +565,8 @@ static int net_conf_addshare(struct net_context *c,
 			goto done;
 		case 5:
 			comment = argv[4];
+
+			FALL_THROUGH;
 		case 4:
 			if (!strnequal(argv[3], "guest_ok=", 9)) {
 				net_conf_addshare_usage(c, argc, argv);
@@ -581,6 +585,8 @@ static int net_conf_addshare(struct net_context *c,
 					net_conf_addshare_usage(c, argc, argv);
 					goto done;
 			}
+
+			FALL_THROUGH;
 		case 3:
 			if (!strnequal(argv[2], "writeable=", 10)) {
 				net_conf_addshare_usage(c, argc, argv);
@@ -599,6 +605,8 @@ static int net_conf_addshare(struct net_context *c,
 					net_conf_addshare_usage(c, argc, argv);
 					goto done;
 			}
+
+			FALL_THROUGH;
 		case 2:
 			path = argv[1];
 			sharename = talloc_strdup(mem_ctx, argv[0]);
-- 
2.16.2


>From 0f2108f5b5ff62af0aa6064db96f14be4b34796f Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:58:40 +0200
Subject: [PATCH 32/58] s3:utils: Add FALL_THROUGH statements in net_rpc_conf.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/utils/net_rpc_conf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/source3/utils/net_rpc_conf.c b/source3/utils/net_rpc_conf.c
index 0b1b59e3b45..4747da98325 100644
--- a/source3/utils/net_rpc_conf.c
+++ b/source3/utils/net_rpc_conf.c
@@ -1155,6 +1155,8 @@ static NTSTATUS rpc_conf_import_internal(struct net_context *c,
 				d_printf(_("error: out of memory!\n"));
 				goto error;
 			}
+
+			FALL_THROUGH;
 		case 1:
 			filename = argv[0];
 			break;
@@ -1426,6 +1428,8 @@ static NTSTATUS rpc_conf_addshare_internal(struct net_context *c,
 			goto error;
 		case 5:
 			comment = argv[4];
+
+			FALL_THROUGH;
 		case 4:
 			if (!strnequal(argv[3], "guest_ok=", 9)) {
 				rpc_conf_addshare_usage(c, argc, argv);
@@ -1446,6 +1450,8 @@ static NTSTATUS rpc_conf_addshare_internal(struct net_context *c,
 					status = NT_STATUS_INVALID_PARAMETER;
 					goto error;
 			}
+
+			FALL_THROUGH;
 		case 3:
 			if (!strnequal(argv[2], "writeable=", 10)) {
 				rpc_conf_addshare_usage(c, argc, argv);
@@ -1466,6 +1472,8 @@ static NTSTATUS rpc_conf_addshare_internal(struct net_context *c,
 					status = NT_STATUS_INVALID_PARAMETER;
 					goto error;
 			}
+
+			FALL_THROUGH;
 		case 2:
 			path = argv[1];
 			sharename = talloc_strdup(frame, argv[0]);
-- 
2.16.2


>From f83aa7e27a69772fb13d9000c098b4f635ef11b4 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:42:46 +0200
Subject: [PATCH 33/58] s3:rpc_server: Add FALL_THROUGH statements in
 rpc_server.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/rpc_server/rpc_server.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
index 94335b3ea53..2327e433d8a 100644
--- a/source3/rpc_server/rpc_server.c
+++ b/source3/rpc_server/rpc_server.c
@@ -1068,7 +1068,8 @@ void dcerpc_ncacn_accept(struct tevent_context *ev_ctx,
 					}
 				}
 			}
-			/* FALL TROUGH */
+
+			FALL_THROUGH;
 		case NCACN_NP:
 			pipe_name = talloc_strdup(ncacn_conn,
 						  name);
-- 
2.16.2


>From 741b5df1d458ba3b7a90f645a0f279cc758f13e0 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:21:02 +0200
Subject: [PATCH 34/58] s4:samdb: Add FALL_THROUGH statements in cracknames.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/dsdb/samdb/cracknames.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index d43f510b949..d8fe0975d15 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -1083,7 +1083,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
 				return WERR_OK;
 			}
 		}
-		/* FALL TROUGH */
+		FALL_THROUGH;
 		default:
 			info1->status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE;
 			return WERR_OK;
-- 
2.16.2


>From 828b689cd362433779df7d015deb297b46561680 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:28:11 +0200
Subject: [PATCH 35/58] s4:samdb: Add FALL_THROUGH statements in
 linked_attributes.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/dsdb/samdb/ldb_modules/linked_attributes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
index c6beb25e58b..57d25076a75 100644
--- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c
+++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
@@ -573,8 +573,7 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques
 			/* treat as just a normal add the delete part is handled by the callback */
 			store_el = true;
 
-			/* break intentionally missing */
-
+			FALL_THROUGH;
 		case LDB_FLAG_MOD_ADD:
 
 			/* For each value being added, we need to setup the adds */
-- 
2.16.2


>From 09ff20a3afe03b2ef352f6a12a08684209cdf126 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:29:55 +0200
Subject: [PATCH 36/58] s4:auth: Add FALL_THROUGH statements in auth_util.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/auth/ntlm/auth_util.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/source4/auth/ntlm/auth_util.c b/source4/auth/ntlm/auth_util.c
index 7feb20b8f62..5084cc4a929 100644
--- a/source4/auth/ntlm/auth_util.c
+++ b/source4/auth/ntlm/auth_util.c
@@ -62,7 +62,8 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth4_context *auth_conte
 				return nt_status;
 			}
 			user_info_in = user_info_temp2;
-			/* fall through */
+
+			FALL_THROUGH;
 		}
 		case AUTH_PASSWORD_HASH:
 		{
@@ -122,7 +123,8 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth4_context *auth_conte
 			}
 
 			user_info_in = user_info_temp;
-			/* fall through */
+
+			FALL_THROUGH;
 		}
 		case AUTH_PASSWORD_RESPONSE:
 			*user_info_encrypted = user_info_in;
@@ -160,7 +162,8 @@ NTSTATUS encrypt_user_info(TALLOC_CTX *mem_ctx, struct auth4_context *auth_conte
 			*user_info_temp->password.hash.nt = nt;
 			
 			user_info_in = user_info_temp;
-			/* fall through */
+
+			FALL_THROUGH;
 		}
 		case AUTH_PASSWORD_HASH:
 			*user_info_encrypted = user_info_in;
-- 
2.16.2


>From fe53b0553ee1f3f83ff25a0896e6d236ab728688 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:30:53 +0200
Subject: [PATCH 37/58] s4:auth: Add FALL_THROUGH statements in auth_sam.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/auth/ntlm/auth_sam.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/auth/ntlm/auth_sam.c b/source4/auth/ntlm/auth_sam.c
index 8c5ebd747e7..d63a7d131a6 100644
--- a/source4/auth/ntlm/auth_sam.c
+++ b/source4/auth/ntlm/auth_sam.c
@@ -70,7 +70,7 @@ static NTSTATUS authsam_password_ok(struct auth4_context *auth_context,
 		}
 		user_info = user_info_temp;
 
-		/*fall through*/
+		FALL_THROUGH;
 	}
 	case AUTH_PASSWORD_HASH:
 		*lm_sess_key = data_blob(NULL, 0);
-- 
2.16.2


>From 2a71a326648f8fb6385c0e55aedc7657d5a41dd7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:33:12 +0200
Subject: [PATCH 38/58] s4:auth: Add FALL_THROUGH statements in gensec_krb5.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/auth/gensec/gensec_krb5.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c
index 86ec23fe433..0323da87d29 100644
--- a/source4/auth/gensec/gensec_krb5.c
+++ b/source4/auth/gensec/gensec_krb5.c
@@ -407,12 +407,9 @@ static NTSTATUS gensec_krb5_common_client_creds(struct gensec_security *gensec_s
 		/* Too much clock skew - we will need to kinit to re-skew the clock */
 	case KRB5KRB_AP_ERR_SKEW:
 	case KRB5_KDCREP_SKEW:
-	{
 		DEBUG(3, ("kerberos (mk_req) failed: %s\n", 
 			  smb_get_krb5_error_message(gensec_krb5_state->smb_krb5_context->krb5_context, ret, gensec_krb5_state)));
-		/*fall through*/
-	}
-	
+		FALL_THROUGH;
 	/* just don't print a message for these really ordinary messages */
 	case KRB5_FCC_NOFILE:
 	case KRB5_CC_NOTFOUND:
-- 
2.16.2


>From 649c5be527eef81dc12ab72552473253acd5d380 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:39:04 +0200
Subject: [PATCH 39/58] s4:rpc_server: Add FALL_THROUGH statements in
 dcesrv_srvsvc.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
index 4dd3e977b68..a6bee0d8ca0 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -1127,6 +1127,7 @@ static WERROR dcesrv_srvsvc_fill_share_info(struct share_info *info, int *count,
 		*((int *)info[i].value) = max_users;
 		i++;
 
+		FALL_THROUGH;
 	case 501:
 	case 1:
 		info[i].name = SHARE_TYPE;
@@ -1147,6 +1148,7 @@ static WERROR dcesrv_srvsvc_fill_share_info(struct share_info *info, int *count,
 		W_ERROR_HAVE_NO_MEMORY(info[i].value);
 		i++;
 
+		FALL_THROUGH;
 	case 1004:
 		if (comment) {
 			info[i].name = SHARE_COMMENT;
@@ -1156,6 +1158,8 @@ static WERROR dcesrv_srvsvc_fill_share_info(struct share_info *info, int *count,
 
 			i++;
 		}
+
+		FALL_THROUGH;
 	case 0:
 		if (name &&
 		    strcasecmp(share_name, name) != 0) {
-- 
2.16.2


>From b2619ccae5be9ee25dbcf283b6756a83ec90effe Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:39:52 +0200
Subject: [PATCH 40/58] s4:torture: Add FALL_THROUGH statements in basic/misc.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/torture/basic/misc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c
index 68b7cbec812..25ae4560de8 100644
--- a/source4/torture/basic/misc.c
+++ b/source4/torture/basic/misc.c
@@ -985,6 +985,8 @@ bool run_benchrw(struct torture_context *tctx)
 					break;
 				}
 				state[i]->mode=FINISHED;
+
+				FALL_THROUGH;
 			case FINISHED:
 				finished++;
 				break;
-- 
2.16.2


>From 837a222b5d40cc264ac0d77af0c7b41bc4221a06 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 17:41:26 +0200
Subject: [PATCH 41/58] s4:torture: Add FALL_THROUGH statements in
 rpc/spoolss.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/torture/rpc/spoolss.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 31b9525ee62..91f32692042 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -1402,6 +1402,8 @@ static bool test_SetPrinter_errors(struct torture_context *tctx,
 				/* ignored then */
 				break;
 			}
+
+			FALL_THROUGH;
 		case SPOOLSS_PRINTER_CONTROL_PAUSE: /* 1 */
 		case SPOOLSS_PRINTER_CONTROL_RESUME: /* 2 */
 		case SPOOLSS_PRINTER_CONTROL_PURGE: /* 3 */
-- 
2.16.2


>From 917d3b4c588a858ac5bfc8f532a9a8eabae12f56 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:20:53 +0200
Subject: [PATCH 42/58] auth:credentials: Add FALL_THROUGH statements in
 credentials.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 auth/credentials/credentials.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
index 4f3042e3152..4663185c979 100644
--- a/auth/credentials/credentials.c
+++ b/auth/credentials/credentials.c
@@ -1277,17 +1277,21 @@ _PUBLIC_ bool cli_credentials_parse_password_fd(struct cli_credentials *credenti
 				*++p = '\0'; /* advance p, and null-terminate pass */
 				break;
 			}
-			/* fall through */
+
+			FALL_THROUGH;
 		case 0:
 			if (p - pass) {
 				*p = '\0'; /* null-terminate it, just in case... */
 				p = NULL; /* then force the loop condition to become false */
 				break;
-			} else {
-				fprintf(stderr, "Error reading password from file descriptor %d: %s\n", fd, "empty password\n");
-				return false;
 			}
 
+			fprintf(stderr,
+				"Error reading password from file descriptor "
+				"%d: empty password\n",
+				fd);
+			return false;
+
 		default:
 			fprintf(stderr, "Error reading password from file descriptor %d: %s\n",
 					fd, strerror(errno));
-- 
2.16.2


>From 21531d87daa97d64587f561806538f5f39e2c782 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:23:31 +0200
Subject: [PATCH 43/58] auth:credentials: Add FALL_THROUGH statements in
 credentials_secrets.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 auth/credentials/credentials_secrets.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/auth/credentials/credentials_secrets.c b/auth/credentials/credentials_secrets.c
index beb292848ad..ae1d23b51c1 100644
--- a/auth/credentials/credentials_secrets.c
+++ b/auth/credentials/credentials_secrets.c
@@ -372,7 +372,8 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account_db_ctx(struct cli_credenti
 				if (security != SEC_ADS) {
 					break;
 				}
-				/* fall through */
+
+				FALL_THROUGH;
 			case ROLE_ACTIVE_DIRECTORY_DC:
 				use_kerberos = CRED_AUTO_USE_KERBEROS;
 				break;
-- 
2.16.2


>From f0c4c7fafd546dd3dec78fb2401448299fc10af5 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 18:24:26 +0200
Subject: [PATCH 44/58] auth:gensec: Add FALL_THROUGH statements in spnego.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 auth/gensec/spnego.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c
index 56f9be412ab..0b3fbdce7ac 100644
--- a/auth/gensec/spnego.c
+++ b/auth/gensec/spnego.c
@@ -1649,7 +1649,7 @@ static struct tevent_req *gensec_spnego_update_send(TALLOC_CTX *mem_ctx,
 			return tevent_req_post(req, ev);
 		}
 
-		/* fall through */
+		FALL_THROUGH;
 	case SPNEGO_CLIENT_START:
 	case SPNEGO_SERVER_START:
 
-- 
2.16.2


>From 3a6a4a5fa4e8f607e648e63bec886adf9937a9f3 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 16:56:27 +0200
Subject: [PATCH 45/58] nsswitch: Add FALL_THROUGH statements in pam_winbind.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 nsswitch/pam_winbind.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index e14fcfeb263..63fede87c78 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -2886,7 +2886,8 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
 			ret = atoi(tmp);
 			switch (ret) {
 			case PAM_AUTHTOK_EXPIRED:
-				/* fall through, since new token is required in this case */
+				/* Since new token is required in this case */
+				FALL_THROUGH;
 			case PAM_NEW_AUTHTOK_REQD:
 				_pam_log(ctx, LOG_WARNING,
 					 "pam_sm_acct_mgmt success but %s is set",
-- 
2.16.2


>From 0ce901b9a781a118bbd6674fe9c941a818a9c194 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 27 Jul 2017 16:59:40 +0200
Subject: [PATCH 46/58] s3:libnet: Add FALL_THROUGH statements in libnet_join.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/libnet/libnet_join.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 0595cfe64ab..9b1bf342c19 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -2418,7 +2418,8 @@ static WERROR libnet_join_check_config(TALLOC_CTX *mem_ctx,
 					valid_realm = true;
 					ignored_realm = true;
 				}
-				/* FALL THROUGH */
+
+				FALL_THROUGH;
 			case SEC_ADS:
 				valid_security = true;
 			}
-- 
2.16.2


>From 45cde768b6833651a9844b6c68c6943428701bb0 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:08:36 +0200
Subject: [PATCH 47/58] s3:modules: Add FALL_THROUGH statements in getdate.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/modules/getdate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/source3/modules/getdate.c b/source3/modules/getdate.c
index 6ed994649c4..2879bc87f4b 100644
--- a/source3/modules/getdate.c
+++ b/source3/modules/getdate.c
@@ -1098,9 +1098,10 @@ yytnamerr (char *yyres, const char *yystr)
 	    goto do_not_strip_quotes;
 
 	  case '\\':
-	    if (*++yyp != '\\')
+	    if (*++yyp != '\\') {
 	      goto do_not_strip_quotes;
-	    /* Fall through.  */
+	    }
+	    FALL_THROUGH;
 	  default:
 	    if (yyres)
 	      yyres[yyn] = *yyp;
-- 
2.16.2


>From 374e27c5adf93b7218c50c2430987a007ec81eef Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:12:43 +0200
Subject: [PATCH 48/58] s3:lsa: Add FALL_THROUGH statements in srv_lsa_nt.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/rpc_server/lsa/srv_lsa_nt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c
index 3cc87ad9081..a3254a61667 100644
--- a/source3/rpc_server/lsa/srv_lsa_nt.c
+++ b/source3/rpc_server/lsa/srv_lsa_nt.c
@@ -4288,11 +4288,13 @@ static NTSTATUS check_ft_info(TALLOC_CTX *mem_ctx,
 					exclusion = true;
 					break;
 				}
-				/* fall through */
+
+				FALL_THROUGH;
 			case DNS_CMP_FIRST_IS_CHILD:
 			case DNS_CMP_SECOND_IS_CHILD:
 				tln_conflict = true;
-				/* fall through */
+
+				FALL_THROUGH;
 			default:
 				break;
 			}
-- 
2.16.2


>From ed8cf71e3133d893bab6c99f34f5de7a2fe97543 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:13:42 +0200
Subject: [PATCH 49/58] s3:rpcclient: Add FALL_THROUGH statements in
 rpcclient.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/rpcclient/rpcclient.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index c1039ed84c5..4eb1e145715 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -744,7 +744,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
 				use_kerberos = CRED_AUTO_USE_KERBEROS;
 				break;
 			}
-			/* Fall through */
+			FALL_THROUGH;
 		case DCERPC_AUTH_TYPE_NTLMSSP:
 		case DCERPC_AUTH_TYPE_KRB5:
 			ntresult = cli_rpc_pipe_open_generic_auth(
-- 
2.16.2


>From 3665ae0eb40c7f51f804a534946bbaf21f836854 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:15:31 +0200
Subject: [PATCH 50/58] s3:smbd: Add FALL_THROUGH statements in reply.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/smbd/reply.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 623f83b1250..881667a6b44 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -190,16 +190,16 @@ static NTSTATUS check_path_syntax_internal(char *path,
 			switch(siz) {
 				case 5:
 					*d++ = *s++;
-					/*fall through*/
+					FALL_THROUGH;
 				case 4:
 					*d++ = *s++;
-					/*fall through*/
+					FALL_THROUGH;
 				case 3:
 					*d++ = *s++;
-					/*fall through*/
+					FALL_THROUGH;
 				case 2:
 					*d++ = *s++;
-					/*fall through*/
+					FALL_THROUGH;
 				case 1:
 					*d++ = *s++;
 					break;
-- 
2.16.2


>From c9c435d275a58bf4a0bbd789b1994942822fb87b Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:18:09 +0200
Subject: [PATCH 51/58] s3:utils: Add FALL_THROUGH statements in
 net_registry_check.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/utils/net_registry_check.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c
index de79f3e6af3..2274b739b0d 100644
--- a/source3/utils/net_registry_check.c
+++ b/source3/utils/net_registry_check.c
@@ -810,7 +810,8 @@ static int check_tdb_action(struct db_record *rec, void *check_ctx)
 					talloc_free(key);
 					key = p;
 				}
-			} /* fall through */
+				FALL_THROUGH;
+			}
 			case 'r': /* retry */
 				once_more = true;
 				break;
-- 
2.16.2


>From c7842fd2e3c0e36b33ef17af460572d4f8050268 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:24:23 +0200
Subject: [PATCH 52/58] s3:utils: Add FALL_THROUGH statements in ntlm_auth.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/utils/ntlm_auth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 78bafe12efa..2c8d9910790 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -1390,7 +1390,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
 			 * NTLMSSP_CLIENT_1 for now.
 			 */
 			use_cached_creds = false;
-			/* fall through */
+			FALL_THROUGH;
 		case NTLMSSP_CLIENT_1:
 			/* setup the client side */
 
@@ -1486,7 +1486,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
 			if (!in.length) {
 				first = true;
 			}
-			/* fall through */
+			FALL_THROUGH;
 		case SQUID_2_5_NTLMSSP:
 			nt_status = gensec_start_mech_by_oid(state->gensec_state, GENSEC_OID_NTLMSSP);
 			break;
-- 
2.16.2


>From efedbcfd68bd96f41ca06a83da2ff1ae40393b44 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:25:27 +0200
Subject: [PATCH 53/58] s3:winbindd: Add FALL_THROUGH statements in
 idmap_autorid.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/winbindd/idmap_autorid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index 39027d1511b..65b3d5af222 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -260,7 +260,7 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg,
 		    }
 		    /* If we end up here, something weird is in the record. */
 
-		    /* FALL THROUGH */
+		    FALL_THROUGH;
 	    default:
 		    DBG_DEBUG("SID/domain range: %s\n",
 			      (const char *)data.dptr);
-- 
2.16.2


>From 6b06babf2fad9848cb8b3274d1a680b8c7405619 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:26:38 +0200
Subject: [PATCH 54/58] s4:dsdb: Add FALL_THROUGH statements in password_hash.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/dsdb/samdb/ldb_modules/password_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index c428ff7f359..2e6464f0dd1 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -2241,7 +2241,7 @@ static int setup_last_set_field(struct setup_password_fields_io *io)
 		if (!io->ac->update_password) {
 			break;
 		}
-		/* fall through */
+		FALL_THROUGH;
 	case UINT64_MAX:
 		if (!io->ac->update_password &&
 		    io->u.pwdLastSet != 0 &&
-- 
2.16.2


>From 0567705857b5b0ab9f70c4780f4b2e523bd3d752 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:27:38 +0200
Subject: [PATCH 55/58] s4:lib: Add FALL_THROUGH statements in http.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/lib/http/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/lib/http/http.c b/source4/lib/http/http.c
index 659cba0ff14..10b49cd14fe 100644
--- a/source4/lib/http/http.c
+++ b/source4/lib/http/http.c
@@ -117,7 +117,7 @@ static enum http_read_status http_parse_headers(struct http_read_response_state
 				state->parser_state = HTTP_READING_BODY;
 				break;
 			}
-			/* fall through */
+			FALL_THROUGH;
 		case 0:
 			DEBUG(11, ("%s: Skipping body for code %d\n", __func__,
 				   state->response->response_code));
-- 
2.16.2


>From 84f914559c48f0f6aa18400f204479d23ea17360 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:11:24 +0200
Subject: [PATCH 56/58] s3:spoolss: Remove incorrect fall through comment in
 srv_spoolss_nt.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/rpc_server/spoolss/srv_spoolss_nt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index f0226ba9441..e5463683598 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -1804,7 +1804,6 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p,
 		DEBUG(4,("Setting print server access = %s\n", (r->in.access_mask == SERVER_ACCESS_ADMINISTER)
 			? "SERVER_ACCESS_ADMINISTER" : "SERVER_ACCESS_ENUMERATE" ));
 
-		/* We fall through to return WERR_OK */
 		break;
 
 	case SPLHND_PRINTER:
-- 
2.16.2


>From 94b852a61f006117089e6d615b71f601b105cd80 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 13 Oct 2017 11:06:48 +0200
Subject: [PATCH 57/58] libsmb: Remove incorrect fall through comment in
 trusts_util.c

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/libsmb/trusts_util.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index fd1b3372b36..3ebf67f231e 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -84,7 +84,6 @@ char *trust_pw_new_value(TALLOC_CTX *mem_ctx,
 		min = 120;
 		max = 120;
 		break;
-		/* fall through */
 	case SEC_CHAN_DOMAIN:
 		/*
 		 * The maximum length of a trust account password.
-- 
2.16.2


>From 81e453fcd7fed2265c0ebd3733c6308e14f5be16 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 26 Jul 2017 16:29:06 +0200
Subject: [PATCH 58/58] wafsamba: Add -Wimplicit-fallthrough if available

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 buildtools/wafsamba/samba_autoconf.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index cc08e0d5c3d..35f4f36f61c 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -711,6 +711,8 @@ def SAMBA_CONFIG_H(conf, path=None):
                         testflags=True)
         conf.ADD_CFLAGS('-Werror=uninitialized -Wuninitialized',
                         testflags=True)
+        conf.ADD_CFLAGS('-Wimplicit-fallthrough',
+                        testflags=True)
 
         conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True)
         conf.ADD_CFLAGS('-Wno-format-zero-length', testflags=True)
-- 
2.16.2



More information about the samba-technical mailing list