Bug 282166 - devel/bazel5: fix build with clang 19
Summary: devel/bazel5: fix build with clang 19
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: Charlie Li
URL:
Keywords:
Depends on:
Blocks: 280562
  Show dependency treegraph
 
Reported: 2024-10-17 19:18 UTC by Dimitry Andric
Modified: 2024-10-30 18:36 UTC (History)
0 users

See Also:
vishwin: maintainer-feedback+


Attachments
devel/bazel5: fix build with clang 19 (2.39 KB, patch)
2024-10-17 19:23 UTC, Dimitry Andric
vishwin: maintainer-approval+
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 2024-10-17 19:18:48 UTC
Clang 19 has become more strict about C23 extensions, which results in
errors building devel/bazel5:

  external/upb/upb/upb.c:215:25: error: defining a type within '__builtin_offsetof' is a C23 extension [-Werror,-Wc23-extensions]
    215 |   n = UPB_ALIGN_DOWN(n, UPB_ALIGN_OF(upb_arena));
        |                         ^~~~~~~~~~~~~~~~~~~~~~~
  external/upb/upb/port_def.inc:94:38: note: expanded from macro 'UPB_ALIGN_OF'
     94 | #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
        |                                      ^~~~~~
  /usr/include/stddef.h:64:42: note: expanded from macro 'offsetof'
     64 | #define offsetof(type, field)   __offsetof(type, field)
        |                                            ^~~~
  /usr/include/sys/cdefs.h:324:53: note: expanded from macro '__offsetof'
    324 | #define __offsetof(type, field)  __builtin_offsetof(type, field)
        |                                                     ^~~~
  external/upb/upb/port_def.inc:92:48: note: expanded from macro 'UPB_ALIGN_DOWN'
     92 | #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
        |                                                ^~~~~

To work around this, amend extra-patch-upb_bazel_build__defs.bzl to also
add -Wno-c23-extensions. Alternatively, the -Werror option could be
taken out.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-10-17 19:23:10 UTC
Created attachment 254316 [details]
devel/bazel5: fix build with clang 19
Comment 2 Charlie Li freebsd_committer freebsd_triage 2024-10-30 18:25:10 UTC
Comment on attachment 254316 [details]
devel/bazel5: fix build with clang 19

ship it
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-10-30 18:34:56 UTC
A commit in branch main references this bug:

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

commit a34c378a051d3df7767855bb37fc359924f4dcc1
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-10-17 18:56:45 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-10-30 18:34:11 +0000

    devel/bazel5: fix build with clang 19

    Clang 19 has become more strict about C23 extensions, which results in
    errors building devel/bazel5:

      external/upb/upb/upb.c:215:25: error: defining a type within '__builtin_offsetof' is a C23 extension [-Werror,-Wc23-extensions]
        215 |   n = UPB_ALIGN_DOWN(n, UPB_ALIGN_OF(upb_arena));
            |                         ^~~~~~~~~~~~~~~~~~~~~~~
      external/upb/upb/port_def.inc:94:38: note: expanded from macro 'UPB_ALIGN_OF'
         94 | #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
            |                                      ^~~~~~
      /usr/include/stddef.h:64:42: note: expanded from macro 'offsetof'
         64 | #define offsetof(type, field)   __offsetof(type, field)
            |                                            ^~~~
      /usr/include/sys/cdefs.h:324:53: note: expanded from macro '__offsetof'
        324 | #define __offsetof(type, field)  __builtin_offsetof(type, field)
            |                                                     ^~~~
      external/upb/upb/port_def.inc:92:48: note: expanded from macro 'UPB_ALIGN_DOWN'
         92 | #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
            |                                                ^~~~~

    To work around this, amend extra-patch-upb_bazel_build__defs.bzl to also
    add -Wno-c23-extensions. Alternatively, the -Werror option could be
    taken out.

    PR:             282166
    Approved by:    vishwin (maintainer)
    MFH:            2024Q4

 devel/bazel5/files/extra-patch-upb_bazel_build__defs.bzl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-10-30 18:35:57 UTC
A commit in branch 2024Q4 references this bug:

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

commit c6a101e55094536ebf9519670ce5b9cbb8522bea
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-10-17 18:56:45 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-10-30 18:35:08 +0000

    devel/bazel5: fix build with clang 19

    Clang 19 has become more strict about C23 extensions, which results in
    errors building devel/bazel5:

      external/upb/upb/upb.c:215:25: error: defining a type within '__builtin_offsetof' is a C23 extension [-Werror,-Wc23-extensions]
        215 |   n = UPB_ALIGN_DOWN(n, UPB_ALIGN_OF(upb_arena));
            |                         ^~~~~~~~~~~~~~~~~~~~~~~
      external/upb/upb/port_def.inc:94:38: note: expanded from macro 'UPB_ALIGN_OF'
         94 | #define UPB_ALIGN_OF(type) offsetof (struct { char c; type member; }, member)
            |                                      ^~~~~~
      /usr/include/stddef.h:64:42: note: expanded from macro 'offsetof'
         64 | #define offsetof(type, field)   __offsetof(type, field)
            |                                            ^~~~
      /usr/include/sys/cdefs.h:324:53: note: expanded from macro '__offsetof'
        324 | #define __offsetof(type, field)  __builtin_offsetof(type, field)
            |                                                     ^~~~
      external/upb/upb/port_def.inc:92:48: note: expanded from macro 'UPB_ALIGN_DOWN'
         92 | #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
            |                                                ^~~~~

    To work around this, amend extra-patch-upb_bazel_build__defs.bzl to also
    add -Wno-c23-extensions. Alternatively, the -Werror option could be
    taken out.

    PR:             282166
    Approved by:    vishwin (maintainer)
    MFH:            2024Q4

    (cherry picked from commit a34c378a051d3df7767855bb37fc359924f4dcc1)

 devel/bazel5/files/extra-patch-upb_bazel_build__defs.bzl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)