generate warnings for incorrect format strings for kprintf, bring stdint.h

inline for x86 and arm and fix some format strings as a consequence
This commit is contained in:
Anna Lyons
2015-09-29 16:35:59 +10:00
parent b039ba17cf
commit 07a7f4c42e
8 changed files with 21 additions and 57 deletions

View File

@@ -1,23 +0,0 @@
/*
* Copyright 2014, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#ifndef __ARCH_STDINT_H
#define __ARCH_STDINT_H
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed long int32_t;
#endif

View File

@@ -1,24 +0,0 @@
/*
* Copyright 2014, General Dynamics C4 Systems
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(GD_GPL)
*/
#ifndef __ARCH_STDINT_H
#define __ARCH_STDINT_H
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
#endif

View File

@@ -15,11 +15,14 @@
#include <arch/types.h>
#include <plat/machine/io.h>
#define FORMAT(archetype, string_index, first_to_check) \
__attribute__((format(archetype, string_index, first_to_check)))
#if defined DEBUG || defined RELEASE_PRINTF
unsigned int puts(const char *s) VISIBLE;
/* for prints that you want enabled in both DEBUG and RELEASE_PRINTF modes,
use kprintf directly */
unsigned int kprintf(const char *format, ...) VISIBLE;
unsigned int kprintf(const char *format, ...) VISIBLE FORMAT(printf, 1, 2);
unsigned int print_unsigned_long(unsigned long x, unsigned int ui_base) VISIBLE;
#endif

View File

@@ -11,6 +11,14 @@
#ifndef __STDINT_H
#define __STDINT_H
#include <arch/stdint.h>
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed long int32_t;
typedef signed long long int64_t;
#endif

View File

@@ -561,7 +561,7 @@ try_boot_sys(
modules[i].start,
modules[i].end,
modules[i].end - modules[i].start,
modules[i].name
(char *) modules[i].name
);
if ((int32_t)(modules[i].end - modules[i].start) <= 0) {
printf("Invalid boot module size! Possible cause: boot module file not found by QEMU\n");

View File

@@ -135,7 +135,7 @@ decodeIRQHandlerInvocation(word_t label, unsigned int length, irq_t irq,
bool_t trig, pol;
if (length < 2) {
userError("IRQSetMode: Not enough arguments", length);
userError("IRQSetMode: Not enough arguments: %d", length);
current_syscall_error.type = seL4_TruncatedMessage;
return EXCEPTION_SYSCALL_ERROR;
}

View File

@@ -599,20 +599,20 @@ decodeInvocation(word_t label, unsigned int length,
switch (cap_get_capType(cap)) {
case cap_null_cap:
userError("Attempted to invoke a null cap #%u.", capIndex);
userError("Attempted to invoke a null cap #%lu.", capIndex);
current_syscall_error.type = seL4_InvalidCapability;
current_syscall_error.invalidCapNumber = 0;
return EXCEPTION_SYSCALL_ERROR;
case cap_zombie_cap:
userError("Attempted to invoke a zombie cap #%u.", capIndex);
userError("Attempted to invoke a zombie cap #%lu.", capIndex);
current_syscall_error.type = seL4_InvalidCapability;
current_syscall_error.invalidCapNumber = 0;
return EXCEPTION_SYSCALL_ERROR;
case cap_endpoint_cap:
if (unlikely(!cap_endpoint_cap_get_capCanSend(cap))) {
userError("Attempted to invoke a read-only endpoint cap #%u.",
userError("Attempted to invoke a read-only endpoint cap #%lu.",
capIndex);
current_syscall_error.type = seL4_InvalidCapability;
current_syscall_error.invalidCapNumber = 0;
@@ -629,7 +629,7 @@ decodeInvocation(word_t label, unsigned int length,
word_t msg;
if (unlikely(!cap_async_endpoint_cap_get_capAEPCanSend(cap))) {
userError("Attempted to invoke a read-only async-endpoint cap #%u.",
userError("Attempted to invoke a read-only async-endpoint cap #%lu.",
capIndex);
current_syscall_error.type = seL4_InvalidCapability;
current_syscall_error.invalidCapNumber = 0;
@@ -650,7 +650,7 @@ decodeInvocation(word_t label, unsigned int length,
case cap_reply_cap:
if (unlikely(cap_reply_cap_get_capReplyMaster(cap))) {
userError("Attempted to invoke an invalid reply cap #%u.",
userError("Attempted to invoke an invalid reply cap #%lu.",
capIndex);
current_syscall_error.type = seL4_InvalidCapability;
current_syscall_error.invalidCapNumber = 0;

View File

@@ -734,7 +734,7 @@ decodeDomainInvocation(word_t label, unsigned int length, extra_caps_t extraCaps
} else {
domain = getSyscallArg(0, buffer);
if (domain >= CONFIG_NUM_DOMAINS) {
userError("Domain Configure: invalid domain (%u >= %u).",
userError("Domain Configure: invalid domain (%lu >= %u).",
domain, CONFIG_NUM_DOMAINS);
current_syscall_error.type = seL4_InvalidArgument;
current_syscall_error.invalidArgumentNumber = 0;