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
e593563f
Commit
e593563f
authored
9 years ago
by
Kostyantyn Vorobyov
Browse files
Options
Downloads
Patches
Plain Diff
Added format-based assertions
Replaced system-wide assertions with custom assertions using embedded printf library
parent
d9a352b8
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
src/plugins/e-acsl/share/e-acsl/e_acsl_printf.h
+28
-5
28 additions, 5 deletions
src/plugins/e-acsl/share/e-acsl/e_acsl_printf.h
src/plugins/e-acsl/share/e-acsl/memory_model/e_acsl_mmodel.c
+0
-1
0 additions, 1 deletion
src/plugins/e-acsl/share/e-acsl/memory_model/e_acsl_mmodel.c
with
28 additions
and
6 deletions
src/plugins/e-acsl/share/e-acsl/e_acsl_printf.h
+
28
−
5
View file @
e593563f
...
...
@@ -33,6 +33,12 @@
#include
<stddef.h>
#include
<stdint.h>
#include
<unistd.h>
#include
<limits.h>
// For PATH_MAX in Linux
#ifdef __linux__
#include
<linux/limits.h>
#endif
static
void
printf
(
char
*
fmt
,
...);
...
...
@@ -262,11 +268,6 @@ static void eprintf(char *fmt, ...) {
}
static
void
vabort
(
char
*
fmt
,
...)
{
char
*
mtstr
=
"E_ACSL ERROR:"
;
char
extfmt
[
strlen
(
mtstr
)
+
strlen
(
fmt
)
+
1
]
;
sprintf
(
extfmt
,
"%s%s"
,
mtstr
,
fmt
);
fmt
=
extfmt
;
va_list
va
;
va_start
(
va
,
fmt
);
_format
(
NULL
,
_charc_stderr
,
fmt
,
va
);
...
...
@@ -289,3 +290,25 @@ static void sprintf(char* s,char *fmt, ...) {
putcp
(
&
s
,
0
);
va_end
(
va
);
}
#define assert(expr) \
((expr) ? (void)(0) : vabort("%s at %s:%d\n", \
#expr, __FILE__,__LINE__))
static
void
vassert_fail
(
int
expr
,
int
line
,
char
*
file
,
char
*
fmt
,
...)
{
if
(
!
expr
)
{
char
*
afmt
=
"%s at %s:%d
\n
"
;
char
buf
[
strlen
(
fmt
)
+
strlen
(
afmt
)
+
PATH_MAX
+
11
];
sprintf
(
buf
,
afmt
,
fmt
,
file
,
line
);
fmt
=
buf
;
va_list
va
;
va_start
(
va
,
fmt
);
_format
(
NULL
,
_charc_stderr
,
fmt
,
va
);
va_end
(
va
);
abort
();
}
}
#define vassert(expr, fmt, ...) \
vassert_fail(expr, __LINE__, __FILE__, fmt, __VA_ARGS__)
This diff is collapsed.
Click to expand it.
src/plugins/e-acsl/share/e-acsl/memory_model/e_acsl_mmodel.c
+
0
−
1
View file @
e593563f
...
...
@@ -23,7 +23,6 @@
#include
<stdlib.h>
#include
<string.h>
#include
<stdbool.h>
#include
<assert.h>
#include
"e_acsl_mmodel_api.h"
#include
"e_acsl_mmodel.h"
#include
"../e_acsl_printf.h"
...
...
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