diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 08ae4de2e23d657160048f4c3295944884cd5d65..157fa7b087ff3fa44258e8c7a80a401b532fcb7d 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -100,7 +100,7 @@ if [ "x$warning_mode" != "xpedantic" ]; then
 # C++ warnings
   cxx_warnings="$warnings -Wno-unused-parameter"
 # cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
-  cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
+  cxx_warnings="$cxx_warnings -Wnon-virtual-dtor"
 # Added unless --with-debug=full
   debug_extra_cflags="-O0 -g3 -gdwarf-2"
 else
diff --git a/cmd-line-utils/readline/terminal.c b/cmd-line-utils/readline/terminal.c
index 3f92821f9dd7a4e312893a784a56275f44680604..e2785908160e62f22f34765d9f38cf71de9f7198 100644
--- a/cmd-line-utils/readline/terminal.c
+++ b/cmd-line-utils/readline/terminal.c
@@ -268,7 +268,7 @@ _rl_get_screen_size (tty, ignore_env)
 
 #if !defined (__DJGPP__)
       if (_rl_screenwidth <= 0 && term_string_buffer)
-	_rl_screenwidth = tgetnum ("co");
+	_rl_screenwidth = tgetnum ((char *)"co");
 #endif
     }
 
@@ -284,7 +284,7 @@ _rl_get_screen_size (tty, ignore_env)
 
 #if !defined (__DJGPP__)
       if (_rl_screenheight <= 0 && term_string_buffer)
-	_rl_screenheight = tgetnum ("li");
+	_rl_screenheight = tgetnum ((char *)"li");
 #endif
     }
 
@@ -516,7 +516,7 @@ _rl_init_terminal_io (terminal_name)
   if (!_rl_term_cr)
     _rl_term_cr = "\r";
 
-  _rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
+  _rl_term_autowrap = tgetflag ((char *)"am") && tgetflag ((char *)"xn");
 
   /* Allow calling application to set default height and width, using
      rl_set_screen_size */
@@ -531,7 +531,7 @@ _rl_init_terminal_io (terminal_name)
 
   /* Check to see if this terminal has a meta key and clear the capability
      variables if there is none. */
-  term_has_meta = (tgetflag ("km") || tgetflag ("MT"));
+  term_has_meta = (tgetflag ((char *)"km") || tgetflag ((char *)"MT"));
   if (!term_has_meta)
     _rl_term_mm = _rl_term_mo = (char *)NULL;
 
diff --git a/mysys/my_gethostbyname.c b/mysys/my_gethostbyname.c
index 067fdfee9db11bd98f622883bfe178a85ab9559c..12cf90271dd2a97a02ff687cca9b369aeb9a12ad 100644
--- a/mysys/my_gethostbyname.c
+++ b/mysys/my_gethostbyname.c
@@ -92,8 +92,10 @@ extern pthread_mutex_t LOCK_gethostbyname_r;
 */
 
 struct hostent *my_gethostbyname_r(const char *name,
-				   struct hostent *result, char *buffer,
-				   int buflen, int *h_errnop)
+                                   struct hostent *res __attribute__((unused)),
+                                   char *buffer __attribute__((unused)),
+                                   int buflen __attribute__((unused)),
+                                   int *h_errnop)
 {
   struct hostent *hp;
   pthread_mutex_lock(&LOCK_gethostbyname_r);
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index 97540f5eb48addb3aaaef076c8c717b74f90560c..d6ca4f1c1df6917c1caa0fff5f866fa1a5d98c87 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -89,6 +89,8 @@ int my_sync(File fd, myf my_flags)
 
 
 static const char cur_dir_name[]= {FN_CURLIB, 0};
+
+
 /*
   Force directory information to disk.
 
@@ -100,9 +102,11 @@ static const char cur_dir_name[]= {FN_CURLIB, 0};
   RETURN
     0 if ok, !=0 if error
 */
+
+#ifdef NEED_EXPLICIT_SYNC_DIR
+
 int my_sync_dir(const char *dir_name, myf my_flags)
 {
-#ifdef NEED_EXPLICIT_SYNC_DIR
   File dir_fd;
   int res= 0;
   const char *correct_dir_name;
@@ -124,11 +128,18 @@ int my_sync_dir(const char *dir_name, myf my_flags)
   else
     res= 1;
   DBUG_RETURN(res);
-#else
+}
+
+#else /* NEED_EXPLICIT_SYNC_DIR */
+
+int my_sync_dir(const char *dir_name __attribute__((unused)),
+                myf my_flags __attribute__((unused)))
+{
   return 0;
-#endif
 }
 
+#endif /* NEED_EXPLICIT_SYNC_DIR */
+
 
 /*
   Force directory information to disk.
@@ -141,15 +152,24 @@ int my_sync_dir(const char *dir_name, myf my_flags)
   RETURN
     0 if ok, !=0 if error
 */
+
+#ifdef NEED_EXPLICIT_SYNC_DIR
+
 int my_sync_dir_by_file(const char *file_name, myf my_flags)
 {
-#ifdef NEED_EXPLICIT_SYNC_DIR
   char dir_name[FN_REFLEN];
   size_t dir_name_length;
   dirname_part(dir_name, file_name, &dir_name_length);
   return my_sync_dir(dir_name, my_flags);
-#else
+}
+
+#else /* NEED_EXPLICIT_SYNC_DIR */
+
+int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
+                        myf my_flags __attribute__((unused)))
+{
   return 0;
-#endif
 }
 
+#endif /* NEED_EXPLICIT_SYNC_DIR */
+