Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
7a4542c9
Commit
7a4542c9
authored
Mar 05, 2003
by
David S. Miller
Committed by
Linus Torvalds
Mar 05, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[KERNEL]: Add typecheck macro for verifying types at compile time.
parent
23f3c02f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
include/linux/kernel.h
include/linux/kernel.h
+11
-0
No files found.
include/linux/kernel.h
View file @
7a4542c9
...
@@ -188,6 +188,17 @@ extern void dump_stack(void);
...
@@ -188,6 +188,17 @@ extern void dump_stack(void);
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
(type *)( (char *)__mptr - offsetof(type,member) );})
/*
* Check at compile time that something is of a particular type.
* Always evaluates to 1 so you may use it easily in conparisons.
*/
#define typecheck(type,x) \
({ type __dummy; \
typeof(x) __dummy2; \
(void)(&__dummy == &__dummy2); \
1; \
})
#endif
/* __KERNEL__ */
#endif
/* __KERNEL__ */
#define SI_LOAD_SHIFT 16
#define SI_LOAD_SHIFT 16
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment