Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 853
    • Issues 853
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 54
    • Merge requests 54
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !3201

tests/macros.c: Define check_alignof for std=c11 and newer

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Khem Raj requested to merge kraj/glib:alignof into main Jan 14, 2023
  • Overview 2
  • Commits 1
  • Pipelines 1
  • Changes 1

WG14 N2350 made very clear that it is an UB having type definitions within "offsetof" [1]. This patch changes the implementation of macro check_alignof to builtin "_Alignof" to avoid undefined behavior.

clang 16+ has started to diagnose this [2]

Fixes build when using -std >= gnu11 and using clang16+

[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm [2] https://reviews.llvm.org/D133574

Signed-off-by: Khem Raj raj.khem@gmail.com

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: alignof