From 014bd41470af7f6ed0d6a1701891d4b5ac9b7f96 Mon Sep 17 00:00:00 2001 From: Evan Lojewski Date: Fri, 16 Oct 2020 23:19:35 -0600 Subject: printf: Cleanup various linting warnings. (#144) --- libs/printf/CMakeLists.txt | 7 ++++--- libs/printf/ape_putchar.c | 4 ++-- libs/printf/em100_putchar.c | 4 ++-- libs/printf/printf.h | 11 ++++++----- 4 files changed, 14 insertions(+), 12 deletions(-) (limited to 'libs') diff --git a/libs/printf/CMakeLists.txt b/libs/printf/CMakeLists.txt index bb4dca2..b95218f 100644 --- a/libs/printf/CMakeLists.txt +++ b/libs/printf/CMakeLists.txt @@ -1,10 +1,10 @@ ################################################################################ ### -### @file libs/Ethernet/CMakeLists.txt +### @file libs/printf/CMakeLists.txt ### -### @project +### @project bcm5719-fw ### -### @brief Ethernet CMake file +### @brief printf CMake file ### ################################################################################ ### @@ -52,6 +52,7 @@ SET(SOURCES ) add_definitions(-DPRINTF_DISABLE_SUPPORT_FLOAT -DPRINTF_DISABLE_SUPPORT_LONG_LONG) +set_source_files_properties(printf.c PROPERTIES COMPILE_DEFINITIONS "NO_FLINT") # Disable linting # Host Simulation library simulator_add_library(${PROJECT_NAME} STATIC ${SOURCES}) diff --git a/libs/printf/ape_putchar.c b/libs/printf/ape_putchar.c index 2879464..af4986e 100644 --- a/libs/printf/ape_putchar.c +++ b/libs/printf/ape_putchar.c @@ -86,10 +86,10 @@ static void ape_putchar(char character, VOLATILE SHM_t *port) uint32_t write_pointer = port->RcpuWritePointer.r32; uint32_t word_pointer = write_pointer / 4; uint32_t byte_index = write_pointer % 4; - uint32_t byte_mask = 0xFF << (byte_index * 8); + uint32_t byte_mask = 0xFFu << (byte_index * 8u); uint32_t new_word = port->RcpuPrintfBuffer[word_pointer].r32 & ~byte_mask; - new_word |= character << (byte_index * 8); + new_word |= ((uint32_t)((uint8_t)character)) << (byte_index * 8u); port->RcpuPrintfBuffer[word_pointer].r32 = new_word; write_pointer++; diff --git a/libs/printf/em100_putchar.c b/libs/printf/em100_putchar.c index a898708..fc05d19 100644 --- a/libs/printf/em100_putchar.c +++ b/libs/printf/em100_putchar.c @@ -43,7 +43,7 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include +#include void em100_putchar(char character) { @@ -58,4 +58,4 @@ void em100_puts(const char *string) NVRam_EM100_putchar(*string); string++; } -} \ No newline at end of file +} diff --git a/libs/printf/printf.h b/libs/printf/printf.h index 6075bc2..de72d5c 100644 --- a/libs/printf/printf.h +++ b/libs/printf/printf.h @@ -10,10 +10,10 @@ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -57,7 +57,8 @@ void _putchar(char character); * \param format A string that specifies the format of the output * \return The number of characters that are written into the array, not counting the terminating null character */ -#define printf printf_ +//lint -esym(534,printf_) +#define printf printf_ //lint !e828 int printf_(const char* format, ...); @@ -68,7 +69,7 @@ int printf_(const char* format, ...); * \param format A string that specifies the format of the output * \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character */ -#define sprintf sprintf_ +#define sprintf sprintf_ //lint !e828 int sprintf_(char* buffer, const char* format, ...); @@ -93,7 +94,7 @@ int vsnprintf_(char* buffer, size_t count, const char* format, va_list va); * \param va A value identifying a variable arguments list * \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character */ -#define vprintf vprintf_ +#define vprintf vprintf_ //lint !e828 int vprintf_(const char* format, va_list va); -- cgit v1.2.1