Require compiler warnings. (#418)

This commit is contained in:
Jonathan Hui
2016-08-18 12:22:12 -07:00
committed by GitHub
parent c26fec1692
commit 9b6afb31c0
6 changed files with 17 additions and 24 deletions
+2 -2
View File
@@ -223,8 +223,8 @@ AC_PROG_LN_S
# -Wall CC, CXX
#
PROSPECTIVE_CFLAGS="-Wall -std=c99 -pedantic-errors"
PROSPECTIVE_CXXFLAGS="-Wall"
PROSPECTIVE_CFLAGS="-Wall -Wextra -Wshadow -Werror -std=c99 -pedantic-errors"
PROSPECTIVE_CXXFLAGS="-Wall -Wextra -Wshadow -Werror"
AC_CACHE_CHECK([whether $CC is Clang],
[nl_cv_clang],
-3
View File
@@ -54,9 +54,6 @@ COMMONCFLAGS := \
-ffunction-sections \
-Os \
-g \
-Wall \
-Wextra \
-Werror \
$(NULL)
CPPFLAGS += \
-3
View File
@@ -44,9 +44,6 @@ BuildJobs ?= 99
COMMONCFLAGS := \
-O1 \
-g \
-Wall \
-Wextra \
-Werror \
$(NULL)
CPPFLAGS += \
+8 -8
View File
@@ -41,21 +41,21 @@
// Macro to append content to end of the log string.
#define LOG_PRINTF(...) \
charsWritten = snprintf(&logString[index], sizeof(logString) - index , __VA_ARGS__); \
VerifyOrExit(charsWritten >= 0, logString[index] = 0); \
index += (unsigned int)charsWritten; \
VerifyOrExit(index < sizeof(logString), logString[sizeof(logString) -1 ] = 0)
charsWritten = snprintf(&logString[offset], sizeof(logString) - offset , __VA_ARGS__); \
VerifyOrExit(charsWritten >= 0, logString[offset] = 0); \
offset += (unsigned int)charsWritten; \
VerifyOrExit(offset < sizeof(logString), logString[sizeof(logString) -1 ] = 0)
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
struct timeval tv;
char timeString[40];
char logString[512];
unsigned int index;
unsigned int offset;
int charsWritten;
va_list args;
index = 0;
offset = 0;
gettimeofday(&tv, NULL);
strftime(timeString, sizeof(timeString), "%Y-%m-%d %H:%M:%S", localtime(&tv.tv_sec));
@@ -129,10 +129,10 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat
}
va_start(args, aFormat);
charsWritten = vsnprintf(&logString[index], sizeof(logString) - index, aFormat, args);
charsWritten = vsnprintf(&logString[offset], sizeof(logString) - offset, aFormat, args);
va_end(args);
VerifyOrExit(charsWritten >= 0, logString[index] = 0);
VerifyOrExit(charsWritten >= 0, logString[offset] = 0);
exit:
fprintf(stderr, "%s\r", logString);
+3 -4
View File
@@ -143,7 +143,7 @@ void TestDiag()
// initialize platform layer
int argc = 2;
char *argv[2] = {(char *)"test_diag", (char *)"1"};
char *argv[8] = {(char *)"test_diag", (char *)"1"};
PlatformInit(argc, argv);
// initialize diagnostics module
@@ -156,12 +156,11 @@ void TestDiag()
{
char string[50];
int length = strlen(tests[i].command);
char *cmd;
char *argv[8];
int argc = 0;
char *output = NULL;
argc = 0;
memcpy(string, tests[i].command, length + 1);
for (cmd = string + 1; (cmd < string + length) && (cmd != NULL); ++cmd)
+4 -4
View File
@@ -145,12 +145,12 @@ void TestLowpanIphc(void)
"6lo: Lowpan::Decompress failed");
// ===> Test Lowpan::Compress
int resultLength = sMockLowpan.Compress(*message, macSource, macDest,
result);
int compressBytes = sMockLowpan.Compress(*message, macSource, macDest,
result);
printf("Compressed OpenThread:\n");
otTestPrintHex(result, resultLength);
otTestPrintHex(result, compressBytes);
VerifyOrQuit(memcmp(frame.GetPayload(), result, resultLength) == 0,
VerifyOrQuit(memcmp(frame.GetPayload(), result, compressBytes) == 0,
"6lo: Lowpan::Compress failed");
SuccessOrQuit(Message::Free(*message), "6lo: Message:Free failed");