Bug 281633

Summary: devel/readline: Fix API when used with -Wstrict-prototypes
Product: Ports & Packages Reporter: Gleb Popov <arrowd>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Only Me CC: des, sunpoet
Priority: --- Flags: bugzilla: maintainer-feedback? (sunpoet)
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://reviews.freebsd.org/D46957
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281776
Attachments:
Description Flags
Patch arrowd: maintainer-approval? (sunpoet)

Description Gleb Popov freebsd_committer freebsd_triage 2024-09-21 17:18:29 UTC
When building multimedia/pipewire with newest Clang and without this patch I get

/usr/local/include/readline/rltypedefs.h:35:22: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
   35 | typedef int Function () __attribute__((deprecated));
      |                      ^
      |                       void
/usr/local/include/readline/rltypedefs.h:36:24: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
   36 | typedef void VFunction () __attribute__((deprecated));
      |                        ^
      |                         void
/usr/local/include/readline/rltypedefs.h:37:26: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
   37 | typedef char *CPFunction () __attribute__((deprecated));
      |                          ^
      |                           void
/usr/local/include/readline/rltypedefs.h:38:28: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
   38 | typedef char **CPPFunction () __attribute__((deprecated));
      |                            ^
      |                             void
In file included from ../src/tools/pw-cli.c:19:
/usr/local/include/readline/readline.h:410:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  410 | extern int rl_message ();
      |                       ^
      |                        void
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2024-09-21 17:26:29 UTC
Created attachment 253726 [details]
Patch
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2024-09-25 04:28:17 UTC
I'd like to name the patch file as patch-clangXX. Do you mean Clang 18 or Clang 19?
Comment 3 Gleb Popov freebsd_committer freebsd_triage 2024-09-25 07:21:00 UTC
Clang 18 which is shipped with 15-CURRENT at the moment.
Comment 4 Gleb Popov freebsd_committer freebsd_triage 2024-09-29 11:17:39 UTC
So, can we get this in?
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-09-30 13:52:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ee994524fffdfcd9c887b6826889fa7539ff90c9

commit ee994524fffdfcd9c887b6826889fa7539ff90c9
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-09-30 13:12:46 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-09-30 13:38:46 +0000

    devel/readline: Fix build for dependent ports with -Wstrict-prototypes on Clang 18

    - Bump PORTREVISION for package change

    PR:             281633

 devel/readline/Makefile                  |  1 +
 devel/readline/files/patch-clang18 (new) | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
Comment 6 Gleb Popov freebsd_committer freebsd_triage 2024-09-30 13:53:57 UTC
Great, thanks!
Comment 7 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2024-10-05 08:13:34 UTC
This just made matters worse, cf. devel/rlwrap.  The correct solution is to remove the #ifdef and leave only the correct prototype.  We don't support compilers that don't support variadic functions.
Comment 8 commit-hook freebsd_committer freebsd_triage 2024-10-09 12:07:12 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6d04fa18daaad2b5452685c842f54430e5908bf8

commit 6d04fa18daaad2b5452685c842f54430e5908bf8
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2024-10-09 12:06:09 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-10-09 12:06:09 +0000

    devel/readline: Fix build for dependent ports.

    Fixes:          ee994524fffd
    PR:             281633
    Reviewed by:    dim
    Differential Revision:  https://reviews.freebsd.org/D46957

 devel/readline/Makefile            |  2 +-
 devel/readline/files/patch-clang18 | 29 ++++++++++++++++-------------
 2 files changed, 17 insertions(+), 14 deletions(-)