Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
0017faaf
Commit
0017faaf
authored
1 year ago
by
Pierre Nigron
Browse files
Options
Downloads
Patches
Plain Diff
[kernel] Macro INTX_C are machine-dependent
parent
db081543
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
share/libc/stdint.h
+0
-10
0 additions, 10 deletions
share/libc/stdint.h
src/kernel_internals/runtime/machdep.ml
+42
-0
42 additions, 0 deletions
src/kernel_internals/runtime/machdep.ml
with
42 additions
and
10 deletions
share/libc/stdint.h
+
0
−
10
View file @
0017faaf
...
@@ -163,16 +163,6 @@ typedef __UINTMAX_T uintmax_t;
...
@@ -163,16 +163,6 @@ typedef __UINTMAX_T uintmax_t;
#define WINT_MIN __FC_WINT_MIN
#define WINT_MIN __FC_WINT_MIN
#define WINT_MAX __FC_WINT_MAX
#define WINT_MAX __FC_WINT_MAX
/* ISO C: 7.18.4 */
#define INT8_C(c) c
#define UINT8_C(c) c
#define INT16_C(c) c
#define UINT16_C(c) c
#define INT32_C(c) (c ## L)
#define UINT32_C(c) (c ## UL)
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#define INTMAX_C(c) (c ## LL)
#define INTMAX_C(c) (c ## LL)
#define UINTMAX_C(c) (c ## ULL)
#define UINTMAX_C(c) (c ## ULL)
...
...
This diff is collapsed.
Click to expand it.
src/kernel_internals/runtime/machdep.ml
+
42
−
0
View file @
0017faaf
...
@@ -68,6 +68,47 @@ let pp_of_kind =
...
@@ -68,6 +68,47 @@ let pp_of_kind =
"long long"
,
"ll"
"long long"
,
"ll"
]
]
let
gen_precise_size_type
fmt
mach
=
let
open
struct
type
ty
=
CHAR
|
SHORT
|
INT
|
LONG
|
LONGLONG
end
in
let
all
=
[
CHAR
;
SHORT
;
INT
;
LONG
;
LONGLONG
]
in
let
size_of_ty
t
=
match
t
with
|
CHAR
->
1
|
SHORT
->
mach
.
sizeof_short
|
INT
->
mach
.
sizeof_int
|
LONG
->
mach
.
sizeof_long
|
LONGLONG
->
mach
.
sizeof_longlong
in
let
suffix_of_ty
is_signed
t
=
let
suff
=
try
List
.
assoc
(
match
t
with
|
CHAR
->
"char"
|
SHORT
->
"short"
|
INT
->
"int"
|
LONG
->
"long"
|
LONGLONG
->
"long long"
)
suff_of_kind
with
Not_found
->
Kernel
.
fatal
"Undefined suffix type"
in
let
suff
=
(
if
is_signed
then
""
else
"U"
)
^
suff
in
if
suff
=
""
then
""
else
"## "
^
suff
in
let
suffix
is_signed
n
=
let
t
=
try
List
.
find
(
fun
i
->
size_of_ty
i
*
8
==
n
)
all
with
Not_found
->
LONGLONG
in
suffix_of_ty
is_signed
t
in
gen_define_string
fmt
"INT8_C(c)"
(
"(c"
^
(
suffix
true
8
)
^
")"
);
gen_define_string
fmt
"INT16_C(c)"
(
"(c"
^
(
suffix
true
16
)
^
")"
);
gen_define_string
fmt
"INT32_C(c)"
(
"(c"
^
(
suffix
true
32
)
^
")"
);
gen_define_string
fmt
"INT64_C(c)"
(
"(c"
^
(
suffix
true
64
)
^
")"
);
gen_define_string
fmt
"UINT8_C(c)"
(
"(c"
^
(
suffix
false
8
)
^
")"
);
gen_define_string
fmt
"UINT16_C(c)"
(
"(c"
^
(
suffix
false
16
)
^
")"
);
gen_define_string
fmt
"UINT32_C(c)"
(
"(c"
^
(
suffix
false
32
)
^
")"
);
gen_define_string
fmt
"UINT64_C(c)"
(
"(c"
^
(
suffix
false
64
)
^
")"
)
let
max_val
bitsize
is_signed
kind
=
let
max_val
bitsize
is_signed
kind
=
let
suff
=
List
.
assoc
kind
suff_of_kind
in
let
suff
=
List
.
assoc
kind
suff_of_kind
in
let
suff
=
if
is_signed
then
suff
else
"U"
^
suff
in
let
suff
=
if
is_signed
then
suff
else
"U"
^
suff
in
...
@@ -249,6 +290,7 @@ let gen_all_defines fmt mach =
...
@@ -249,6 +290,7 @@ let gen_all_defines fmt mach =
gen_char_unsigned_flag
fmt
mach
;
gen_char_unsigned_flag
fmt
mach
;
gen_sizeof_std
fmt
mach
;
gen_sizeof_std
fmt
mach
;
gen_char_bit
fmt
mach
;
gen_char_bit
fmt
mach
;
gen_precise_size_type
fmt
mach
;
gen_define_string
fmt
"__PTRDIFF_T"
mach
.
ptrdiff_t
;
gen_define_string
fmt
"__PTRDIFF_T"
mach
.
ptrdiff_t
;
gen_define_string
fmt
"__SIZE_T"
mach
.
size_t
;
gen_define_string
fmt
"__SIZE_T"
mach
.
size_t
;
gen_define_string
fmt
"__WCHAR_T"
mach
.
wchar_t
;
gen_define_string
fmt
"__WCHAR_T"
mach
.
wchar_t
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment