Add more clang-tidy checks.
This adds all the generic checks. There are some more project specific
ones that could be selected but this is a good start and has already
found some lint errors.
Change-Id: I7bb9d9347f5270862c2ff586eb7c86feead9e4bb
diff --git a/src/arch/aarch64/handler.c b/src/arch/aarch64/handler.c
index 8999403..94a9722 100644
--- a/src/arch/aarch64/handler.c
+++ b/src/arch/aarch64/handler.c
@@ -52,6 +52,8 @@
struct hvc_handler_return hvc_handler(size_t arg0, size_t arg1, size_t arg2,
size_t arg3)
{
+ (void)arg3;
+
struct hvc_handler_return ret;
ret.new = NULL;
diff --git a/src/arch/aarch64/mm.c b/src/arch/aarch64/mm.c
index d4898d4..f5dcdf1 100644
--- a/src/arch/aarch64/mm.c
+++ b/src/arch/aarch64/mm.c
@@ -43,7 +43,7 @@
#define STAGE2_WRITETHROUGH 2ull
#define STAGE2_WRITEBACK 3ull
-#define STAGE2_MEMATTR_NORMAL(outer, inner) ((outer << 2) | (inner))
+#define STAGE2_MEMATTR_NORMAL(outer, inner) (((outer) << 2) | (inner))
/* The following stage-2 memory attributes for device memory. */
#define STAGE2_MEMATTR_DEVICE_nGnRnE 0ull
diff --git a/src/arch/aarch64/msr.h b/src/arch/aarch64/msr.h
index 30916db..277ccea 100644
--- a/src/arch/aarch64/msr.h
+++ b/src/arch/aarch64/msr.h
@@ -10,9 +10,11 @@
__v; \
})
-#define write_msr(name, value) \
- do { \
- __asm volatile("msr " #name ", %x0" : : "rZ"((size_t)value)); \
+#define write_msr(name, value) \
+ do { \
+ __asm volatile("msr " #name ", %x0" \
+ : \
+ : "rZ"((size_t)(value))); \
} while (0)
#endif /* _MSR_H */
diff --git a/src/dlog.c b/src/dlog.c
index 38ccc85..5382096 100644
--- a/src/dlog.c
+++ b/src/dlog.c
@@ -163,7 +163,7 @@
/*
* Prints the given format string to the debug log.
*/
-void dlog(const char *str, ...)
+void dlog(const char *fmt, ...)
{
static struct spinlock sl = SPINLOCK_INIT;
const char *p;
@@ -172,11 +172,11 @@
int flags;
char buf[2];
- va_start(args, str);
+ va_start(args, fmt);
sl_lock(&sl);
- for (p = str; *p; p++) {
+ for (p = fmt; *p; p++) {
switch (*p) {
default:
arch_putchar(*p);
diff --git a/src/main.c b/src/main.c
index a23c7e8..e4957fd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -280,7 +280,7 @@
}
/* Fail if it's not a number. */
- if (*it->next < '0' && *it->next > '9') {
+ if (*it->next < '0' || *it->next > '9') {
return false;
}
diff --git a/src/mm.c b/src/mm.c
index 8942ec5..6662bae 100644
--- a/src/mm.c
+++ b/src/mm.c
@@ -105,6 +105,9 @@
*/
static void mm_free_page_pte(pte_t pte, int level, bool sync)
{
+ (void)pte;
+ (void)level;
+ (void)sync;
/* TODO: Implement.
if (!arch_mm_pte_is_present(pte) || level < 1)
return;
@@ -309,6 +312,7 @@
void mm_ptable_defrag(struct mm_ptable *t)
{
/* TODO: Implement. */
+ (void)t;
}
/**