Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
ce6f4737
T
Third Party Unity
项目概览
OpenHarmony
/
Third Party Unity
1 年多 前同步成功
通知
36
Star
144
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Unity
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ce6f4737
编写于
2月 29, 2016
作者:
M
Mark VanderVoord
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #175 from jsalling/feature/C89-build
Fix C89 warnings about variables at top of scope, enums, variadic macros
上级
4187255a
3bb51bd7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
12 deletion
+30
-12
extras/fixture/src/unity_fixture_internals.h
extras/fixture/src/unity_fixture_internals.h
+1
-0
extras/fixture/test/Makefile
extras/fixture/test/Makefile
+6
-0
extras/fixture/test/unity_fixture_Test.c
extras/fixture/test/unity_fixture_Test.c
+22
-11
src/unity_internals.h
src/unity_internals.h
+1
-1
未找到文件。
extras/fixture/src/unity_fixture_internals.h
浏览文件 @
ce6f4737
...
@@ -15,6 +15,7 @@ struct _UnityFixture
...
@@ -15,6 +15,7 @@ struct _UnityFixture
const
char
*
NameFilter
;
const
char
*
NameFilter
;
const
char
*
GroupFilter
;
const
char
*
GroupFilter
;
};
};
extern
struct
_UnityFixture
UnityFixture
;
typedef
void
unityfunction
(
void
);
typedef
void
unityfunction
(
void
);
void
UnityTestRunner
(
unityfunction
*
setup
,
void
UnityTestRunner
(
unityfunction
*
setup
,
...
...
extras/fixture/test/Makefile
浏览文件 @
ce6f4737
...
@@ -34,6 +34,11 @@ noStdlibMalloc: ../build/
...
@@ -34,6 +34,11 @@ noStdlibMalloc: ../build/
@
echo
"build with noStdlibMalloc"
@
echo
"build with noStdlibMalloc"
./
$(TARGET)
./
$(TARGET)
clang89
:
../build/
clang
$(CFLAGS)
$(DEFINES)
$(SRC)
$(INC_DIR)
-o
$(TARGET)
-m32
-std
=
c89
-Wno-comment
clang
$(CFLAGS)
$(DEFINES)
$(SRC)
$(INC_DIR)
-o
$(TARGET)
-m32
\
-D
UNITY_EXCLUDE_STDLIB_MALLOC
-std
=
c89
-Wno-comment
;
./
$(TARGET)
clangEverything
:
clangEverything
:
clang
$(CFLAGS)
$(DEFINES)
$(SRC)
$(INC_DIR)
-o
$(TARGET)
-m64
-Weverything
clang
$(CFLAGS)
$(DEFINES)
$(SRC)
$(INC_DIR)
-o
$(TARGET)
-m64
-Weverything
...
@@ -56,5 +61,6 @@ CFLAGS += -Wstrict-overflow=5
...
@@ -56,5 +61,6 @@ CFLAGS += -Wstrict-overflow=5
CFLAGS
+=
-Wstrict-prototypes
CFLAGS
+=
-Wstrict-prototypes
CFLAGS
+=
-Wswitch-default
CFLAGS
+=
-Wswitch-default
CFLAGS
+=
-Wundef
CFLAGS
+=
-Wundef
CFLAGS
+=
-Wno-error
=
undef
# Warning only, this should not stop the build
CFLAGS
+=
-Wunused
CFLAGS
+=
-Wunused
CFLAGS
+=
-fstrict-aliasing
CFLAGS
+=
-fstrict-aliasing
extras/fixture/test/unity_fixture_Test.c
浏览文件 @
ce6f4737
...
@@ -10,8 +10,6 @@
...
@@ -10,8 +10,6 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
extern
struct
_UnityFixture
UnityFixture
;
TEST_GROUP
(
UnityFixture
);
TEST_GROUP
(
UnityFixture
);
TEST_SETUP
(
UnityFixture
)
TEST_SETUP
(
UnityFixture
)
...
@@ -314,6 +312,9 @@ TEST_TEAR_DOWN(LeakDetection)
...
@@ -314,6 +312,9 @@ TEST_TEAR_DOWN(LeakDetection)
}
}
// This tricky set of defines lets us see if we are using the Spy, returns 1 if true
// This tricky set of defines lets us see if we are using the Spy, returns 1 if true
#ifdef __STDC_VERSION__
#if __STDC_VERSION__ >= 199901L
#define USING_SPY_AS(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0)
#define USING_SPY_AS(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0)
#define ASSIGN_VALUE(a) VAL_##a
#define ASSIGN_VALUE(a) VAL_##a
#define VAL_UnityOutputCharSpy_OutputChar 0, 1
#define VAL_UnityOutputCharSpy_OutputChar 0, 1
...
@@ -322,6 +323,16 @@ TEST_TEAR_DOWN(LeakDetection)
...
@@ -322,6 +323,16 @@ TEST_TEAR_DOWN(LeakDetection)
#if USING_SPY_AS(UNITY_OUTPUT_CHAR)
#if USING_SPY_AS(UNITY_OUTPUT_CHAR)
#define USING_OUTPUT_SPY // UNITY_OUTPUT_CHAR = UnityOutputCharSpy_OutputChar
#define USING_OUTPUT_SPY // UNITY_OUTPUT_CHAR = UnityOutputCharSpy_OutputChar
#endif
#endif
#endif // >= 199901
#else // __STDC_VERSION__ else
#define UnityOutputCharSpy_OutputChar 42
#if UNITY_OUTPUT_CHAR == UnityOutputCharSpy_OutputChar // Works if no -Wundef -Werror
#define USING_OUTPUT_SPY
#endif
#undef UnityOutputCharSpy_OutputChar
#endif // __STDC_VERSION__
TEST
(
LeakDetection
,
DetectsLeak
)
TEST
(
LeakDetection
,
DetectsLeak
)
{
{
#ifndef USING_OUTPUT_SPY
#ifndef USING_OUTPUT_SPY
...
@@ -346,8 +357,8 @@ TEST(LeakDetection, BufferOverrunFoundDuringFree)
...
@@ -346,8 +357,8 @@ TEST(LeakDetection, BufferOverrunFoundDuringFree)
TEST_IGNORE
();
TEST_IGNORE
();
#else
#else
void
*
m
=
malloc
(
10
);
void
*
m
=
malloc
(
10
);
TEST_ASSERT_NOT_NULL
(
m
);
char
*
s
=
(
char
*
)
m
;
char
*
s
=
(
char
*
)
m
;
TEST_ASSERT_NOT_NULL
(
m
);
s
[
10
]
=
(
char
)
0xFF
;
s
[
10
]
=
(
char
)
0xFF
;
UnityOutputCharSpy_Enable
(
1
);
UnityOutputCharSpy_Enable
(
1
);
EXPECT_ABORT_BEGIN
EXPECT_ABORT_BEGIN
...
@@ -365,8 +376,8 @@ TEST(LeakDetection, BufferOverrunFoundDuringRealloc)
...
@@ -365,8 +376,8 @@ TEST(LeakDetection, BufferOverrunFoundDuringRealloc)
TEST_IGNORE
();
TEST_IGNORE
();
#else
#else
void
*
m
=
malloc
(
10
);
void
*
m
=
malloc
(
10
);
TEST_ASSERT_NOT_NULL
(
m
);
char
*
s
=
(
char
*
)
m
;
char
*
s
=
(
char
*
)
m
;
TEST_ASSERT_NOT_NULL
(
m
);
s
[
10
]
=
(
char
)
0xFF
;
s
[
10
]
=
(
char
)
0xFF
;
UnityOutputCharSpy_Enable
(
1
);
UnityOutputCharSpy_Enable
(
1
);
EXPECT_ABORT_BEGIN
EXPECT_ABORT_BEGIN
...
@@ -384,8 +395,8 @@ TEST(LeakDetection, BufferGuardWriteFoundDuringFree)
...
@@ -384,8 +395,8 @@ TEST(LeakDetection, BufferGuardWriteFoundDuringFree)
TEST_IGNORE
();
TEST_IGNORE
();
#else
#else
void
*
m
=
malloc
(
10
);
void
*
m
=
malloc
(
10
);
TEST_ASSERT_NOT_NULL
(
m
);
char
*
s
=
(
char
*
)
m
;
char
*
s
=
(
char
*
)
m
;
TEST_ASSERT_NOT_NULL
(
m
);
s
[
-
1
]
=
(
char
)
0x00
;
// Will not detect 0
s
[
-
1
]
=
(
char
)
0x00
;
// Will not detect 0
s
[
-
2
]
=
(
char
)
0x01
;
s
[
-
2
]
=
(
char
)
0x01
;
UnityOutputCharSpy_Enable
(
1
);
UnityOutputCharSpy_Enable
(
1
);
...
@@ -404,8 +415,8 @@ TEST(LeakDetection, BufferGuardWriteFoundDuringRealloc)
...
@@ -404,8 +415,8 @@ TEST(LeakDetection, BufferGuardWriteFoundDuringRealloc)
TEST_IGNORE
();
TEST_IGNORE
();
#else
#else
void
*
m
=
malloc
(
10
);
void
*
m
=
malloc
(
10
);
TEST_ASSERT_NOT_NULL
(
m
);
char
*
s
=
(
char
*
)
m
;
char
*
s
=
(
char
*
)
m
;
TEST_ASSERT_NOT_NULL
(
m
);
s
[
-
1
]
=
(
char
)
0x0A
;
s
[
-
1
]
=
(
char
)
0x0A
;
UnityOutputCharSpy_Enable
(
1
);
UnityOutputCharSpy_Enable
(
1
);
EXPECT_ABORT_BEGIN
EXPECT_ABORT_BEGIN
...
@@ -445,8 +456,8 @@ TEST(InternalMalloc, MallocPastBufferFails)
...
@@ -445,8 +456,8 @@ TEST(InternalMalloc, MallocPastBufferFails)
{
{
#ifdef UNITY_EXCLUDE_STDLIB_MALLOC
#ifdef UNITY_EXCLUDE_STDLIB_MALLOC
void
*
m
=
malloc
(
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
1
);
void
*
m
=
malloc
(
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
1
);
TEST_ASSERT_NOT_NULL
(
m
);
void
*
n
=
malloc
(
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
);
void
*
n
=
malloc
(
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
);
TEST_ASSERT_NOT_NULL
(
m
);
TEST_ASSERT_NULL
(
n
);
TEST_ASSERT_NULL
(
n
);
free
(
m
);
free
(
m
);
#endif
#endif
...
@@ -456,8 +467,8 @@ TEST(InternalMalloc, CallocPastBufferFails)
...
@@ -456,8 +467,8 @@ TEST(InternalMalloc, CallocPastBufferFails)
{
{
#ifdef UNITY_EXCLUDE_STDLIB_MALLOC
#ifdef UNITY_EXCLUDE_STDLIB_MALLOC
void
*
m
=
calloc
(
1
,
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
1
);
void
*
m
=
calloc
(
1
,
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
1
);
TEST_ASSERT_NOT_NULL
(
m
);
void
*
n
=
calloc
(
1
,
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
);
void
*
n
=
calloc
(
1
,
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
);
TEST_ASSERT_NOT_NULL
(
m
);
TEST_ASSERT_NULL
(
n
);
TEST_ASSERT_NULL
(
n
);
free
(
m
);
free
(
m
);
#endif
#endif
...
@@ -467,8 +478,8 @@ TEST(InternalMalloc, MallocThenReallocGrowsMemoryInPlace)
...
@@ -467,8 +478,8 @@ TEST(InternalMalloc, MallocThenReallocGrowsMemoryInPlace)
{
{
#ifdef UNITY_EXCLUDE_STDLIB_MALLOC
#ifdef UNITY_EXCLUDE_STDLIB_MALLOC
void
*
m
=
malloc
(
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
1
);
void
*
m
=
malloc
(
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
1
);
TEST_ASSERT_NOT_NULL
(
m
);
void
*
n
=
realloc
(
m
,
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
9
);
void
*
n
=
realloc
(
m
,
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
9
);
TEST_ASSERT_NOT_NULL
(
m
);
TEST_ASSERT_EQUAL
(
m
,
n
);
TEST_ASSERT_EQUAL
(
m
,
n
);
free
(
n
);
free
(
n
);
#endif
#endif
...
@@ -478,11 +489,11 @@ TEST(InternalMalloc, ReallocFailDoesNotFreeMem)
...
@@ -478,11 +489,11 @@ TEST(InternalMalloc, ReallocFailDoesNotFreeMem)
{
{
#ifdef UNITY_EXCLUDE_STDLIB_MALLOC
#ifdef UNITY_EXCLUDE_STDLIB_MALLOC
void
*
m
=
malloc
(
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
);
void
*
m
=
malloc
(
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
);
TEST_ASSERT_NOT_NULL
(
m
);
void
*
n1
=
malloc
(
10
);
void
*
n1
=
malloc
(
10
);
void
*
out_of_mem
=
realloc
(
n1
,
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
1
);
void
*
out_of_mem
=
realloc
(
n1
,
UNITY_INTERNAL_HEAP_SIZE_BYTES
/
2
+
1
);
TEST_ASSERT_NULL
(
out_of_mem
);
void
*
n2
=
malloc
(
10
);
void
*
n2
=
malloc
(
10
);
TEST_ASSERT_NOT_NULL
(
m
);
TEST_ASSERT_NULL
(
out_of_mem
);
TEST_ASSERT_NOT_EQUAL
(
n2
,
n1
);
TEST_ASSERT_NOT_EQUAL
(
n2
,
n1
);
free
(
n2
);
free
(
n2
);
free
(
n1
);
free
(
n1
);
...
...
src/unity_internals.h
浏览文件 @
ce6f4737
...
@@ -396,7 +396,7 @@ typedef enum _UNITY_FLOAT_TRAIT_T
...
@@ -396,7 +396,7 @@ typedef enum _UNITY_FLOAT_TRAIT_T
UNITY_FLOAT_IS_NOT_NAN
,
UNITY_FLOAT_IS_NOT_NAN
,
UNITY_FLOAT_IS_NAN
,
UNITY_FLOAT_IS_NAN
,
UNITY_FLOAT_IS_NOT_DET
,
UNITY_FLOAT_IS_NOT_DET
,
UNITY_FLOAT_IS_DET
,
UNITY_FLOAT_IS_DET
}
UNITY_FLOAT_TRAIT_T
;
}
UNITY_FLOAT_TRAIT_T
;
#endif
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录