mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-25 10:13:12 +08:00
Merge pull request #170 from jsalling/feature/fix-compiler-warnings
Clean up int conversion warnings in Fixture
This commit is contained in:
@ -23,9 +23,9 @@ void tearDown(void) { /*does nothing*/ }
|
||||
static void announceTestRun(unsigned int runNumber)
|
||||
{
|
||||
UnityPrint("Unity test run ");
|
||||
UnityPrintNumber(runNumber+1);
|
||||
UnityPrintNumberUnsigned(runNumber+1);
|
||||
UnityPrint(" of ");
|
||||
UnityPrintNumber(UnityFixture.RepeatCount);
|
||||
UnityPrintNumberUnsigned(UnityFixture.RepeatCount);
|
||||
UNITY_PRINT_EOL();
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void))
|
||||
UnityEnd();
|
||||
}
|
||||
|
||||
return Unity.TestFailures;
|
||||
return (int)Unity.TestFailures;
|
||||
}
|
||||
|
||||
static int selected(const char* filter, const char* name)
|
||||
@ -71,7 +71,7 @@ void UnityTestRunner(unityfunction* setup,
|
||||
const char* printableName,
|
||||
const char* group,
|
||||
const char* name,
|
||||
const char* file, int line)
|
||||
const char* file, unsigned int line)
|
||||
{
|
||||
if (testSelected(name) && groupSelected(group))
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ void UnityTestRunner(unityfunction* setup,
|
||||
const char* printableName,
|
||||
const char* group,
|
||||
const char* name,
|
||||
const char* file, int line);
|
||||
const char* file, unsigned int line);
|
||||
|
||||
void UnityIgnoreTest(const char* printableName, const char* group, const char* name);
|
||||
void UnityMalloc_StartTest(void);
|
||||
|
@ -1,8 +1,11 @@
|
||||
CC = gcc
|
||||
CFLAGS += -Werror
|
||||
#DEBUG = -O0 -g
|
||||
CFLAGS += -std=c99
|
||||
CFLAGS += -pedantic
|
||||
CFLAGS += -Wundef
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wextra
|
||||
CFLAGS += -Werror
|
||||
CFLAGS += $(DEBUG)
|
||||
DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar
|
||||
SRC = ../src/unity_fixture.c \
|
||||
../../../src/unity.c \
|
||||
@ -32,7 +35,26 @@ noStdlibMalloc: ../build/
|
||||
./$(TARGET)
|
||||
|
||||
clangEverything:
|
||||
$(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m64 -Weverything # || true #prevents make from failing
|
||||
clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m64 -Weverything
|
||||
|
||||
../build :
|
||||
mkdir -p ../build
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
|
||||
# These extended flags DO get included before any target build runs
|
||||
CFLAGS += -Wbad-function-cast
|
||||
CFLAGS += -Wcast-qual
|
||||
CFLAGS += -Wconversion
|
||||
CFLAGS += -Wformat=2
|
||||
CFLAGS += -Wmissing-prototypes
|
||||
CFLAGS += -Wold-style-definition
|
||||
CFLAGS += -Wpointer-arith
|
||||
CFLAGS += -Wshadow
|
||||
CFLAGS += -Wstrict-overflow=5
|
||||
CFLAGS += -Wstrict-prototypes
|
||||
CFLAGS += -Wswitch-default
|
||||
CFLAGS += -Wundef
|
||||
CFLAGS += -Wunused
|
||||
CFLAGS += -fstrict-aliasing
|
||||
|
@ -22,14 +22,13 @@ TEST_TEAR_DOWN(UnityFixture)
|
||||
{
|
||||
}
|
||||
|
||||
int my_int;
|
||||
int* pointer1 = 0;
|
||||
int* pointer2 = (int*)2;
|
||||
int* pointer3 = (int*)3;
|
||||
int int1;
|
||||
int int2;
|
||||
int int3;
|
||||
int int4;
|
||||
static int* pointer1 = 0;
|
||||
static int* pointer2 = (int*)2;
|
||||
static int* pointer3 = (int*)3;
|
||||
static int int1;
|
||||
static int int2;
|
||||
static int int3;
|
||||
static int int4;
|
||||
|
||||
TEST(UnityFixture, PointerSetting)
|
||||
{
|
||||
@ -112,8 +111,8 @@ TEST(UnityFixture, CallocFillsWithZero)
|
||||
free(m);
|
||||
}
|
||||
|
||||
char *p1;
|
||||
char *p2;
|
||||
static char *p1;
|
||||
static char *p2;
|
||||
|
||||
TEST(UnityFixture, PointerSet)
|
||||
{
|
||||
@ -143,10 +142,10 @@ TEST(UnityFixture, FreeNULLSafety)
|
||||
|
||||
TEST_GROUP(UnityCommandOptions);
|
||||
|
||||
int savedVerbose;
|
||||
int savedRepeat;
|
||||
const char* savedName;
|
||||
const char* savedGroup;
|
||||
static int savedVerbose;
|
||||
static unsigned int savedRepeat;
|
||||
static const char* savedName;
|
||||
static const char* savedGroup;
|
||||
|
||||
TEST_SETUP(UnityCommandOptions)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ void UnityOutputCharSpy_Create(int s)
|
||||
size = s;
|
||||
count = 0;
|
||||
spy_enable = 0;
|
||||
buffer = malloc(size);
|
||||
buffer = malloc((size_t)size);
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(buffer, "Internal malloc failed in Spy Create():" __FILE__);
|
||||
memset(buffer, 0, size);
|
||||
}
|
||||
@ -38,7 +38,7 @@ int UnityOutputCharSpy_OutputChar(int c)
|
||||
if (spy_enable)
|
||||
{
|
||||
if (count < (size-1))
|
||||
buffer[count++] = c;
|
||||
buffer[count++] = (char)c;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user