]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:replace: Don't use deprecated readline CPPFunction cast
authorAndreas Schneider <asn@samba.org>
Tue, 21 Jan 2025 16:59:27 +0000 (17:59 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 21 Jan 2025 19:38:36 +0000 (19:38 +0000)
HAVE_RL_COMPLETION_FUNC_T was unused and not checking for the right
function.

libcli/smbreadline/smbreadline.c: In function ‘smb_readline’:
libcli/smbreadline/smbreadline.c:139:17: warning: ‘CPPFunction’ is deprecated [-Wdeprecated-declarations]
  139 |                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libcli/smbreadline/smbreadline.c:139:50: error: assignment to ‘char ** (*)(const char *, int,  int)’ from incompatible pointer type ‘char ** (*)(void)’ [-Wincompatible-pointer-types]
  139 |                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
      |                                                  ^

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15788

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jan 21 19:38:37 UTC 2025 on atb-devel-224

lib/replace/system/readline.h
libcli/smbreadline/wscript_configure

index 9a9af266ca6d1e888d01004232fb218088fb3ad1..ac3604fc12e012f02eb8c2f2935e8426ca8f3270 100644 (file)
@@ -46,7 +46,9 @@
 #endif
 
 #ifdef HAVE_NEW_LIBREADLINE
-#ifdef HAVE_CPPFUNCTION
+#if defined(HAVE_RL_COMPLETION_FUNC_T)
+#  define RL_COMPLETION_CAST (rl_completion_func_t *)
+#elif defined(HAVE_CPPFUNCTION)
 #  define RL_COMPLETION_CAST (CPPFunction *)
 #elif defined(HAVE_RL_COMPLETION_T)
 #  define RL_COMPLETION_CAST (rl_completion_t *)
index 912ff53a150de34f20423b6cc55a376681bdd87f..f5a401ebae001dfc4c90462805b296bb4a098c5b 100644 (file)
@@ -51,10 +51,12 @@ conf.CHECK_CODE('''
 #    endif
 #  endif
 #endif
-int main(void) {rl_completion_t f; return 0;}
+int main(void) {rl_completion_func_t f; return 0;}
 ''',
-'HAVE_RL_COMPLETION_FUNC_T', execute=False, addmain=False,
-msg='Checking for rl_completion_t')
+                'HAVE_RL_COMPLETION_FUNC_T',
+                execute=False,
+                addmain=False,
+                msg='Checking for rl_completion_func_t')
 
 conf.CHECK_CODE('''
 #ifdef HAVE_READLINE_READLINE_H