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
27d8c48f
Commit
27d8c48f
authored
4 years ago
by
Andre Maroneze
Browse files
Options
Downloads
Patches
Plain Diff
[Compliance] add C11 headers
parent
ebaef508
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
share/compliance/c11_headers.json
+35
-0
35 additions, 0 deletions
share/compliance/c11_headers.json
tests/libc/check_compliance.ml
+11
-9
11 additions, 9 deletions
tests/libc/check_compliance.ml
tests/libc/oracle/fc_libc.4.res.oracle
+1
-0
1 addition, 0 deletions
tests/libc/oracle/fc_libc.4.res.oracle
with
47 additions
and
9 deletions
share/compliance/c11_headers.json
0 → 100644
+
35
−
0
View file @
27d8c48f
{
"description"
:
"C11 standard library headers"
,
"source"
:
"ISO/IEC 9899:2011, 7.1.2§2"
,
"data"
:[
"assert.h"
,
"complex.h"
,
"ctype.h"
,
"errno.h"
,
"fenv.h"
,
"float.h"
,
"inttypes.h"
,
"iso646.h"
,
"limits.h"
,
"locale.h"
,
"math.h"
,
"setjmp.h"
,
"signal.h"
,
"stdalign.h"
,
"stdarg.h"
,
"stdatomic.h"
,
"stdbool.h"
,
"stddef.h"
,
"stdint.h"
,
"stdio.h"
,
"stdlib.h"
,
"stdnoreturn.h"
,
"string.h"
,
"tgmath.h"
,
"threads.h"
,
"time.h"
,
"uchar.h"
,
"wchar.h"
,
"wctype.h"
]
}
This diff is collapsed.
Click to expand it.
tests/libc/check_compliance.ml
+
11
−
9
View file @
27d8c48f
...
@@ -45,7 +45,7 @@ let run_once = ref false
...
@@ -45,7 +45,7 @@ let run_once = ref false
module
StringSet
=
Set
.
Make
(
String
)
module
StringSet
=
Set
.
Make
(
String
)
let
g
et_
idents
_from_list
dir
f
=
let
s
et_
of_data
_from_list
dir
f
=
let
file
=
Filename
.
concat
dir
f
in
let
file
=
Filename
.
concat
dir
f
in
let
open
Yojson
.
Basic
.
Util
in
let
open
Yojson
.
Basic
.
Util
in
Kernel
.
feedback
"parsing %s"
f
;
Kernel
.
feedback
"parsing %s"
f
;
...
@@ -56,7 +56,7 @@ let get_idents_from_list dir f =
...
@@ -56,7 +56,7 @@ let get_idents_from_list dir f =
)
StringSet
.
empty
elements
)
StringSet
.
empty
elements
let
g
et_
idents
_from_assoc
dir
f
=
let
s
et_
of_data
_from_assoc
dir
f
=
let
file
=
Filename
.
concat
dir
f
in
let
file
=
Filename
.
concat
dir
f
in
let
open
Yojson
.
Basic
.
Util
in
let
open
Yojson
.
Basic
.
Util
in
Kernel
.
feedback
"parsing %s"
f
;
Kernel
.
feedback
"parsing %s"
f
;
...
@@ -66,7 +66,7 @@ let get_idents_from_assoc dir f =
...
@@ -66,7 +66,7 @@ let get_idents_from_assoc dir f =
StringSet
.
add
ident
acc
StringSet
.
add
ident
acc
)
StringSet
.
empty
elements
)
StringSet
.
empty
elements
let
get
_ident_headers
dir
f
=
let
hashtable_of
_ident_headers
dir
f
=
let
file
=
Filename
.
concat
dir
f
in
let
file
=
Filename
.
concat
dir
f
in
let
idents
=
Hashtbl
.
create
500
in
let
idents
=
Hashtbl
.
create
500
in
let
open
Yojson
.
Basic
.
Util
in
let
open
Yojson
.
Basic
.
Util
in
...
@@ -79,7 +79,7 @@ let get_ident_headers dir f =
...
@@ -79,7 +79,7 @@ let get_ident_headers dir f =
)
elements
;
)
elements
;
idents
idents
let
get
_ident_headers_and_extensions
dir
f
=
let
hashtable_of
_ident_headers_and_extensions
dir
f
=
let
file
=
Filename
.
concat
dir
f
in
let
file
=
Filename
.
concat
dir
f
in
let
idents
=
Hashtbl
.
create
500
in
let
idents
=
Hashtbl
.
create
500
in
let
open
Yojson
.
Basic
.
Util
in
let
open
Yojson
.
Basic
.
Util
in
...
@@ -101,10 +101,11 @@ let () =
...
@@ -101,10 +101,11 @@ let () =
ignore
(
Visitor
.
visitFramacFile
(
vis
:>
Visitor
.
frama_c_visitor
)
(
Ast
.
get
()
));
ignore
(
Visitor
.
visitFramacFile
(
vis
:>
Visitor
.
frama_c_visitor
)
(
Ast
.
get
()
));
let
fc_stdlib_idents
=
vis
#
get_idents
in
let
fc_stdlib_idents
=
vis
#
get_idents
in
let
dir
=
Filename
.
concat
Fc_config
.
datadir
"compliance"
in
let
dir
=
Filename
.
concat
Fc_config
.
datadir
"compliance"
in
let
c11_idents
=
get_ident_headers
dir
"c11_functions.json"
in
let
c11_idents
=
hashtable_of_ident_headers
dir
"c11_functions.json"
in
let
glibc_idents
=
get_idents_from_list
dir
"glibc_functions.json"
in
let
c11_headers
=
set_of_data_from_list
dir
"c11_headers.json"
in
let
posix_idents
=
get_ident_headers_and_extensions
dir
"posix_identifiers.json"
in
let
glibc_idents
=
set_of_data_from_list
dir
"glibc_functions.json"
in
let
nonstandard_idents
=
get_idents_from_assoc
dir
"nonstandard_identifiers.json"
in
let
posix_idents
=
hashtable_of_ident_headers_and_extensions
dir
"posix_identifiers.json"
in
let
nonstandard_idents
=
set_of_data_from_assoc
dir
"nonstandard_identifiers.json"
in
Hashtbl
.
iter
(
fun
id
headers
->
Hashtbl
.
iter
(
fun
id
headers
->
if
not
(
Extlib
.
string_prefix
"__"
id
)
&&
if
not
(
Extlib
.
string_prefix
"__"
id
)
&&
not
(
Extlib
.
string_prefix
"Frama_C"
id
)
&&
not
(
Extlib
.
string_prefix
"Frama_C"
id
)
&&
...
@@ -115,13 +116,14 @@ let () =
...
@@ -115,13 +116,14 @@ let () =
let
id_in_posix
=
Hashtbl
.
mem
posix_idents
id
in
let
id_in_posix
=
Hashtbl
.
mem
posix_idents
id
in
let
id_in_glibc
=
StringSet
.
mem
id
glibc_idents
in
let
id_in_glibc
=
StringSet
.
mem
id
glibc_idents
in
let
id_in_nonstd
=
StringSet
.
mem
id
nonstandard_idents
in
let
id_in_nonstd
=
StringSet
.
mem
id
nonstandard_idents
in
let
header_in_c11
h
=
StringSet
.
mem
h
c11_headers
in
if
id_in_c11
then
begin
if
id_in_c11
then
begin
(* Check that the header is the expected one.
(* Check that the header is the expected one.
Note that some symbols may appear in more than one header,
Note that some symbols may appear in more than one header,
possibly due to collisions
possibly due to collisions
(e.g. 'flock' as type and function). *)
(e.g. 'flock' as type and function). *)
let
h
=
Hashtbl
.
find
c11_idents
id
in
let
h
=
Hashtbl
.
find
c11_idents
id
in
if
not
(
List
.
mem
h
headers
)
then
if
not
(
header_in_c11
h
)
then
Kernel
.
warning
"<%a>:%s : C11 says %s"
Kernel
.
warning
"<%a>:%s : C11 says %s"
(
Pretty_utils
.
pp_list
~
sep
:
","
Format
.
pp_print_string
)
headers
(
Pretty_utils
.
pp_list
~
sep
:
","
Format
.
pp_print_string
)
headers
id
h
id
h
...
...
This diff is collapsed.
Click to expand it.
tests/libc/oracle/fc_libc.4.res.oracle
+
1
−
0
View file @
27d8c48f
[kernel] Parsing tests/libc/fc_libc.c (with preprocessing)
[kernel] Parsing tests/libc/fc_libc.c (with preprocessing)
[kernel] parsing c11_functions.json
[kernel] parsing c11_functions.json
[kernel] parsing c11_headers.json
[kernel] parsing glibc_functions.json
[kernel] parsing glibc_functions.json
[kernel] parsing posix_identifiers.json
[kernel] parsing posix_identifiers.json
[kernel] parsing nonstandard_identifiers.json
[kernel] parsing nonstandard_identifiers.json
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