Skip to content

Commit

Permalink
LibC: Define offsetof in stddef.h instead of sys/cdefs.h
Browse files Browse the repository at this point in the history
Just like Dr. POSIX ordered. Move the macro where it belongs, but make
sure it's visible to Userland files compiled with -DKERNEL. Parts of
LibEDID that are compiled into the Kernel use offsetof to parse the
EDID information given to us by hardware.
  • Loading branch information
ADKaster authored and bgianfo committed Mar 1, 2022
1 parent fcb6431 commit 39f92fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Userland/Libraries/LibC/stddef.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#pragma once

#define offsetof(type, member) __builtin_offsetof(type, member)

#ifndef KERNEL

# include <sys/cdefs.h>
Expand Down
2 changes: 0 additions & 2 deletions Userland/Libraries/LibC/sys/cdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@

#undef __P
#define __P(a) a

#define offsetof(type, member) __builtin_offsetof(type, member)

0 comments on commit 39f92fa

Please sign in to comment.