Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
3ef62a62
Commit
3ef62a62
authored
Nov 06, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move static asserts to vas.h, and decouple from OS #includes
parent
3e0cdae0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
31 deletions
+27
-31
flint.lnt
flint.lnt
+3
-0
vas.h
include/vas.h
+22
-0
vdef.h
include/vdef.h
+1
-30
vsctool.py
lib/libvcc/vsctool.py
+1
-1
No files found.
flint.lnt
View file @
3ef62a62
...
...
@@ -112,6 +112,9 @@
-emacro(527, WRONG) // unreachable code
-emacro(774, VALID_OBJ) // boolean always true
-emacro(506, v_static_assert) // Constant value Boolean
-esym(751, __vassert_*) // local typedef '___' (___) not referenced
///////////////////////////////////////////////////////////////////////
// Places where we use x<<0 for reasons of symmetry
...
...
include/vas.h
View file @
3ef62a62
...
...
@@ -90,4 +90,26 @@ do { \
"", VAS_INCOMPLETE); \
} while (0)
/*
* Most of this nightmare is stolen from FreeBSD's <cdefs.h>
*/
#ifndef __has_extension
# define __has_extension(x) 0
#endif
#if __has_extension(c_static_assert)
# define v_static_assert _Static_assert
#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
# define v_static_assert _Static_assert
#else
# if defined(__COUNTER__)
# define v_static_assert(x, y) __v_static_assert(x, __COUNTER__)
# else
# define v_static_assert(x, y) __v_static_assert(x, __LINE__)
# endif
# define __v_static_assert(x, y) ___v_static_assert(x, y)
# define ___v_static_assert(x, y) \
typedef char __vassert_## y[(x) ? 1 : -1] v_unused_
#endif
#endif
include/vdef.h
View file @
3ef62a62
...
...
@@ -73,9 +73,7 @@
# endif
#endif
#ifdef __printflike
# define v_printflike_(f,a) __printflike(f,a)
#elif __GNUC_PREREQ__(2, 95) || defined(__INTEL_COMPILER)
#if __GNUC_PREREQ__(2, 95) || defined(__INTEL_COMPILER)
# define v_printflike_(f,a) __attribute__((format(printf, f, a)))
#else
# define v_printflike_(f,a)
...
...
@@ -139,33 +137,6 @@
# define v_unused_
#endif
/*
* Most of this nightmare is stolen from FreeBSD's <cdefs.h>
*/
#ifndef __has_extension
# define __has_extension(x) 0
#endif
#if defined(_Static_assert)
/* Nothing, somebody already did this for us */
#elif __has_extension(c_static_assert)
/* Nothing, we should be fine */
#elif (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_static_assert)
# define _Static_assert(x, y) static_assert(x, y)
#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
#else
# if defined(__COUNTER__)
# define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
# else
# define _Static_assert(x, y) __Static_assert(x, __LINE__)
# endif
# define __Static_assert(x, y) ___Static_assert(x, y)
# define ___Static_assert(x, y) \
typedef char __assert_## y[(x) ? 1 : -1] v_unused_
#endif
/* VTIM API overhaul WIP */
typedef
double
vtim_mono
;
typedef
double
vtim_real
;
...
...
lib/libvcc/vsctool.py
View file @
3ef62a62
...
...
@@ -219,7 +219,7 @@ class CounterSet(object):
def
emit_c_paranoia
(
self
,
fo
):
'''Emit asserts to make sure compiler gets same byte index'''
fo
.
write
(
"#define PARANOIA(a,n)
\t\t\t\t\\\n
"
)
fo
.
write
(
"
_S
tatic_assert(
\t\t\t\t\\\n
"
)
fo
.
write
(
"
v_s
tatic_assert(
\t\t\t\t\\\n
"
)
fo
.
write
(
"
\t
offsetof("
+
self
.
struct
+
", a) == n,
\t\\\n
"
)
fo
.
write
(
"
\t\"
VSC element '
\"
#a
\"
' at wrong offset
\"
)
\n\n
"
)
...
...
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