Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
85dac0d6
Commit
85dac0d6
authored
Jan 06, 2012
by
Pieter Noordhuis
Browse files
Don't warn when test helper functions are unused
parent
afb46269
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/test-helper.h
View file @
85dac0d6
...
@@ -17,6 +17,12 @@
...
@@ -17,6 +17,12 @@
#include "spawn.h"
#include "spawn.h"
#include "../handle.h"
#include "../handle.h"
#ifdef __GNUC__
#define UNUSED __attribute__ ((unused))
#else
#define UNUSED
#endif
/******************************************************************************/
/******************************************************************************/
/* ASSERTS ********************************************************************/
/* ASSERTS ********************************************************************/
/******************************************************************************/
/******************************************************************************/
...
@@ -59,7 +65,7 @@
...
@@ -59,7 +65,7 @@
} while(0)
} while(0)
#define ERR_TO_STR_OFFSET 4
#define ERR_TO_STR_OFFSET 4
static
const
char
*
err_to_str
[]
=
{
UNUSED
static
const
char
*
err_to_str
[]
=
{
[
REDIS_OK
+
ERR_TO_STR_OFFSET
]
=
"REDIS_OK"
,
[
REDIS_OK
+
ERR_TO_STR_OFFSET
]
=
"REDIS_OK"
,
[
REDIS_ESYS
+
ERR_TO_STR_OFFSET
]
=
"REDIS_ESYS"
,
[
REDIS_ESYS
+
ERR_TO_STR_OFFSET
]
=
"REDIS_ESYS"
,
[
REDIS_EGAI
+
ERR_TO_STR_OFFSET
]
=
"REDIS_EGAI"
,
[
REDIS_EGAI
+
ERR_TO_STR_OFFSET
]
=
"REDIS_EGAI"
,
...
@@ -67,7 +73,7 @@ static const char *err_to_str[] = {
...
@@ -67,7 +73,7 @@ static const char *err_to_str[] = {
[
REDIS_EEOF
+
ERR_TO_STR_OFFSET
]
=
"REDIS_EEOF"
[
REDIS_EEOF
+
ERR_TO_STR_OFFSET
]
=
"REDIS_EEOF"
};
};
static
void
assert_equal_return_failure
(
int
actual
,
int
expected
,
const
char
*
file
,
int
line
)
{
UNUSED
static
void
assert_equal_return_failure
(
int
actual
,
int
expected
,
const
char
*
file
,
int
line
)
{
const
char
*
actualstr
=
err_to_str
[
actual
+
ERR_TO_STR_OFFSET
];
const
char
*
actualstr
=
err_to_str
[
actual
+
ERR_TO_STR_OFFSET
];
const
char
*
expectedstr
=
err_to_str
[
expected
+
ERR_TO_STR_OFFSET
];
const
char
*
expectedstr
=
err_to_str
[
expected
+
ERR_TO_STR_OFFSET
];
char
reason
[
128
];
char
reason
[
128
];
...
@@ -98,7 +104,7 @@ static void assert_equal_return_failure(int actual, int expected, const char *fi
...
@@ -98,7 +104,7 @@ static void assert_equal_return_failure(int actual, int expected, const char *fi
/* TEST DEFINITION ************************************************************/
/* TEST DEFINITION ************************************************************/
/******************************************************************************/
/******************************************************************************/
static
const
char
*
current_test
=
NULL
;
UNUSED
static
const
char
*
current_test
=
NULL
;
#define TEST(name) \
#define TEST(name) \
static void test__##name(void); \
static void test__##name(void); \
...
@@ -115,7 +121,7 @@ static void test__##name(void)
...
@@ -115,7 +121,7 @@ static void test__##name(void)
/* TIMING *********************************************************************/
/* TIMING *********************************************************************/
/******************************************************************************/
/******************************************************************************/
static
long
long
usec
(
void
)
{
UNUSED
static
long
long
usec
(
void
)
{
struct
timeval
tv
;
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
gettimeofday
(
&
tv
,
NULL
);
return
(
long
long
)
tv
.
tv_sec
*
1000000
+
tv
.
tv_usec
;
return
(
long
long
)
tv
.
tv_sec
*
1000000
+
tv
.
tv_usec
;
...
@@ -127,7 +133,7 @@ static long long usec(void) {
...
@@ -127,7 +133,7 @@ static long long usec(void) {
#define REDIS_DEFAULT_PORT 6379
#define REDIS_DEFAULT_PORT 6379
static
int
redis_port
(
void
)
{
UNUSED
static
int
redis_port
(
void
)
{
char
*
env
,
*
eptr
;
char
*
env
,
*
eptr
;
long
port
=
REDIS_DEFAULT_PORT
;
long
port
=
REDIS_DEFAULT_PORT
;
...
...
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