Bug 268277 - textproc/scdoc: fix build with clang 15
Summary: textproc/scdoc: fix build with clang 15
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-09 15:24 UTC by Dimitry Andric
Modified: 2022-12-09 17:46 UTC (History)
0 users

See Also:
jbeich: maintainer-feedback+
jbeich: merge-quarterly+


Attachments
textproc/scdoc: fix build with clang 15 (1.77 KB, patch)
2022-12-09 15:25 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2022-12-09 15:24:45 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that textproc/scdoc failed to build with clang 15:

  In file included from src/main.c:12:
  include/str.h:10:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  struct str *str_create();
                        ^
                         void
  1 error generated.

This is because -Wstrict-prototypes now requires functions taking no parameters to be declared with "(void)".
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-09 15:25:05 UTC
Created attachment 238665 [details]
textproc/scdoc: fix build with clang 15
Comment 2 Jan Beich freebsd_committer freebsd_triage 2022-12-09 16:01:22 UTC
Can you send the patch upstream to ~sircmpwn/public-inbox@lists.sr.ht in git-format(1) way or via git-send-email(1) ? See https://lists.sr.ht/~sircmpwn/public-inbox/patches?search=prefix%3Ascdoc for workflow examples e.g., how to format Subject line

> This is because -Wstrict-prototypes now requires functions taking no parameters to be declared with "(void)".

- vendor Makefile doesn't pass -Wstrict-prototypes directly, so it's probably from -Wall or -Wextra
- instead of "now" referencing upstream LLVM commit may provide more insight
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2022-12-09 16:34:54 UTC
(In reply to Jan Beich from comment #2)

Well, the program attempts to compile with both -std=c99 -pedantic and -Wall -Wextra -Werror, so I assume that the authors want to check for warnings as pedantically as possible. :-)

Upstream clang changed this in https://github.com/llvm/llvm-project/commit/33d3fc4466479285121cbb1a62db249454da0bda, with a whole discussion going on at https://discourse.llvm.org/t/rfc-enabling-wstrict-prototypes-by-default-in-c/60521.

I'm personally not completely convinced that making these warnings errors by default is a good choice, but it was not up to me...
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2022-12-09 17:01:13 UTC
Submitted as https://lists.sr.ht/~sircmpwn/public-inbox/patches/37432
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-12-09 17:39:21 UTC
A commit in branch main references this bug:

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

commit d30ead133df49f67fa29fbcc5cc4be19a2ad6af4
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-09 15:21:42 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2022-12-09 17:32:07 +0000

    textproc/scdoc: unbreak build with clang 15

    In file included from src/string.c:3:
    include/str.h:10:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    struct str *str_create();
                          ^
                           void
    src/string.c:15:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    struct str *str_create() {
                          ^
                           void

    PR:             268277
    Reported by:    antoine (via bug 265425 exp-run)

 textproc/scdoc/files/patch-clang15 (new) | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-12-09 17:40:22 UTC
A commit in branch 2022Q4 references this bug:

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

commit 2a57c51d01741ce7265033de6fff1b5dee6fd837
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-09 15:21:42 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2022-12-09 17:39:27 +0000

    textproc/scdoc: unbreak build with clang 15

    In file included from src/string.c:3:
    include/str.h:10:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    struct str *str_create();
                          ^
                           void
    src/string.c:15:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    struct str *str_create() {
                          ^
                           void

    PR:             268277
    Reported by:    antoine (via bug 265425 exp-run)

    (cherry picked from commit d30ead133df49f67fa29fbcc5cc4be19a2ad6af4)

 textproc/scdoc/files/patch-clang15 (new) | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
Comment 7 Jan Beich freebsd_committer freebsd_triage 2022-12-09 17:46:12 UTC
Thanks. Landed with cosmetic changes:
- dropped redundant bits from the commit message
- combined patches by topic with upstream(ing) reference (which has better commit message)