Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

importc: add alignof macro #3840

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/importc.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,13 @@
* Define it to do what other C compilers do.
*/
#define __builtin_offsetof(t,i) ((typeof(sizeof(0)))((char *)&((t *)0)->i - (char *)0))

/****************************
* Define it to do what other C compilers do.
*/
#define _Alignof(type) __builtin_offsetof(struct { char c; type member; }, member)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this


/****************************
* clang's preprocessor generates __alignof instead
*/
#define __alignof _Alignof