Mark unused parameters

Signed-off-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
Simon Horman
2010-02-02 14:42:02 +11:00
parent c59af3ab34
commit 43836a2357
34 changed files with 89 additions and 60 deletions

15
include/unused.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef UNUSED_H
#define UNUSED_H
/* http://sourcefrog.net/weblog/software/languages/C/unused.html */
#ifdef UNUSED
#elif defined(__GNUC__)
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
#elif defined(__LCLINT__)
# define UNUSED(x) /*@unused@*/ x
#else
# define UNUSED(x) x
#endif
#endif

View File

@@ -23,7 +23,7 @@ static struct memory_range memory_range[MAX_MEMORY_RANGES];
/* Return a sorted list of available memory ranges. */
int get_memory_ranges(struct memory_range **range, int *ranges,
unsigned long kexec_flags)
unsigned long UNUSED(kexec_flags))
{
const char *iomem = proc_iomem();
int memory_ranges = 0;
@@ -116,12 +116,12 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}
void arch_update_purgatory(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}

View File

@@ -18,7 +18,7 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
return 1;
}
void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), unsigned long r_type,
void *location, unsigned long address, unsigned long value)
{
switch(r_type) {

View File

@@ -78,7 +78,7 @@ struct tag {
#define byte_size(t) ((t)->hdr.size << 2)
#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type) + 3) >> 2)
int zImage_arm_probe(const char *buf, off_t len)
int zImage_arm_probe(const char *UNUSED(buf), off_t UNUSED(len))
{
/*
* Only zImage loading is supported. Do not check if

View File

@@ -23,7 +23,8 @@
static struct memory_range memory_range[MAX_MEMORY_RANGES];
/* Return a sorted list of memory ranges. */
int get_memory_ranges(struct memory_range **range, int *ranges, unsigned long kexec_flags)
int get_memory_ranges(struct memory_range **range, int *ranges,
unsigned long UNUSED(kexec_flags))
{
int memory_ranges = 0;
@@ -79,12 +80,12 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}
void arch_update_purgatory(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}

View File

@@ -75,7 +75,7 @@ void beoboot_usage(void)
#define KERN32_BASE 0x100000 /* 1MB */
#define INITRD_BASE 0x1000000 /* 16MB */
int beoboot_load(int argc, char **argv, const char *buf, off_t len,
int beoboot_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
struct kexec_info *info)
{
struct beoboot_header bb_header;

View File

@@ -18,7 +18,7 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
return 1;
}
void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), unsigned long r_type,
void *location, unsigned long address, unsigned long value)
{
switch(r_type) {

View File

@@ -150,7 +150,7 @@ void nbi_usage(void)
);
}
int nbi_load(int argc, char **argv, const char *buf, off_t len,
int nbi_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
struct kexec_info *info)
{
struct imgheader hdr;

View File

@@ -211,7 +211,7 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}
@@ -255,7 +255,7 @@ int update_loaded_segments(struct kexec_info *info, struct mem_ehdr *ehdr)
return -1;
}
void arch_update_purgatory(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}

View File

@@ -29,8 +29,10 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
return 1;
}
void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
void *location, unsigned long address, unsigned long value)
void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), unsigned long r_type,
void *UNUSED(location),
unsigned long UNUSED(address),
unsigned long UNUSED(value))
{
switch(r_type) {

View File

@@ -26,7 +26,8 @@
static struct memory_range memory_range[MAX_MEMORY_RANGES];
/* Return a sorted list of memory ranges. */
int get_memory_ranges(struct memory_range **range, int *ranges, unsigned long kexec_flags)
int get_memory_ranges(struct memory_range **range, int *ranges,
unsigned long UNUSED(kexec_flags))
{
int memory_ranges = 0;
@@ -129,12 +130,12 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}
void arch_update_purgatory(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}

View File

@@ -316,7 +316,7 @@ void dol_ppc_usage(void)
}
int dol_ppc_load(int argc, char **argv, const char *buf, off_t len,
int dol_ppc_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
struct kexec_info *info)
{
dol_header header, *h;

View File

@@ -17,7 +17,7 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
return 1;
}
void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), unsigned long r_type,
void *location, unsigned long address, unsigned long value)
{
switch(r_type) {

View File

@@ -23,8 +23,8 @@
static struct memory_range memory_range[MAX_MEMORY_RANGES];
/* Return a sorted list of memory ranges. */
int get_memory_ranges(struct memory_range **range, int *ranges,
unsigned long kexec_flags)
int get_memory_ranges(struct memory_range **UNUSED(range), int *UNUSED(ranges),
unsigned long UNUSED(kexec_flags))
{
#ifdef WITH_GAMECUBE
int memory_ranges = 0;
@@ -83,12 +83,12 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}
void arch_update_purgatory(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}

View File

@@ -804,11 +804,11 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}
void arch_update_purgatory(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}

View File

@@ -63,8 +63,9 @@ int zImage_ppc64_probe(FILE *file)
elf.e_machine == EM_PPC);
}
int zImage_ppc64_load(FILE *file, int argc, char **argv, void **ret_entry,
struct kexec_segment **ret_segments, int *ret_nr_segments)
int zImage_ppc64_load(FILE *file, int UNUSED(argc), char **UNUSED(argv),
void **ret_entry, struct kexec_segment **ret_segments,
int *ret_nr_segments)
{
Elf32_Ehdr elf;
Elf32_Phdr *p, *ph;

View File

@@ -12,12 +12,15 @@
#include "../../kexec.h"
#include "../../kexec-elf.h"
int machine_verify_elf_rel(struct mem_ehdr *ehdr)
int machine_verify_elf_rel(struct mem_ehdr *UNUSED(ehdr))
{
return 0;
}
void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
void *location, unsigned long address, unsigned long value)
void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
unsigned long UNUSED(r_type),
void *UNUSED(location),
unsigned long UNUSED(address),
unsigned long UNUSED(value))
{
}

View File

@@ -119,7 +119,7 @@ image_s390_load(int argc, char **argv, const char *kernel_buf,
}
int
image_s390_probe(const char *kernel_buf, off_t kernel_size)
image_s390_probe(const char *UNUSED(kernel_buf), off_t UNUSED(kernel_size))
{
/*
* Can't reliably tell if an image is valid,

View File

@@ -36,7 +36,8 @@ static struct memory_range memory_range[MAX_MEMORY_RANGES];
* - (-1) if something went wrong.
*/
int get_memory_ranges(struct memory_range **range, int *ranges, unsigned long flags)
int get_memory_ranges(struct memory_range **range, int *ranges,
unsigned long UNUSED(flags))
{
char sys_ram[] = "System RAM\n";
char *iomem = proc_iomem();
@@ -89,7 +90,7 @@ void arch_usage(void)
{
}
int arch_process_options(int argc, char **argv)
int arch_process_options(int UNUSED(argc), char **UNUSED(argv))
{
return 0;
}
@@ -100,12 +101,12 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}
void arch_update_purgatory(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}

View File

@@ -34,7 +34,7 @@ static struct memory_range crash_memory_range[CRASH_MAX_MEMORY_RANGES];
uint64_t saved_max_mem;
static int crash_sh_range_nr;
static int crash_sh_memory_range_callback(void *data, int nr,
static int crash_sh_memory_range_callback(void *UNUSED(data), int UNUSED(nr),
char *str,
unsigned long base,
unsigned long length)

View File

@@ -28,8 +28,8 @@ int machine_verify_elf_rel(struct mem_ehdr *ehdr)
return 1;
}
void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
void *orig_loc, unsigned long address, unsigned long relocation)
void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), unsigned long r_type,
void *orig_loc, unsigned long UNUSED(address), unsigned long relocation)
{
uint32_t *location = orig_loc;
uint32_t value;

View File

@@ -33,7 +33,7 @@ const extern unsigned char netbsd_booter[];
*
* Make sure that the file image has a reasonable chance of working.
*/
int netbsd_sh_probe(const char *buf, off_t len)
int netbsd_sh_probe(const char *buf, off_t UNUSED(len))
{
Elf32_Ehdr *ehdr;
@@ -54,7 +54,7 @@ void netbsd_sh_usage(void)
" --miniroot=FILE NetBSD miniroot ramdisk.\n\n");
}
int netbsd_sh_load(int argc, char **argv, const char *buf, off_t len,
int netbsd_sh_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
struct kexec_info *info)
{
const char *howto, *miniroot;

View File

@@ -22,8 +22,8 @@
#define MAX_MEMORY_RANGES 64
static struct memory_range memory_range[MAX_MEMORY_RANGES];
static int kexec_sh_memory_range_callback(void *data, int nr,
char *str,
static int kexec_sh_memory_range_callback(void *UNUSED(data), int nr,
char *UNUSED(str),
unsigned long base,
unsigned long length)
{
@@ -138,12 +138,12 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}
void arch_update_purgatory(struct kexec_info *info)
void arch_update_purgatory(struct kexec_info *UNUSED(info))
{
}

View File

@@ -57,7 +57,7 @@ static const char *reloc_name(unsigned long r_type)
return name;
}
void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr), unsigned long r_type,
void *location, unsigned long address, unsigned long value)
{
#ifdef DEBUG

View File

@@ -148,7 +148,7 @@ const struct arch_map_entry arches[] = {
{ 0 },
};
int arch_compat_trampoline(struct kexec_info *info)
int arch_compat_trampoline(struct kexec_info *UNUSED(info))
{
return 0;
}

View File

@@ -72,8 +72,8 @@ unsigned long xen_architecture(struct crash_elf_info *elf_info)
return machine;
}
static int xen_crash_note_callback(void *data, int nr,
char *str,
static int xen_crash_note_callback(void *UNUSED(data), int nr,
char *UNUSED(str),
unsigned long base,
unsigned long length)
{

View File

@@ -64,7 +64,7 @@ int kexec_iomem_for_each_line(char *match,
}
static int kexec_iomem_single_callback(void *data, int nr,
char *str,
char *UNUSED(str),
unsigned long base,
unsigned long length)
{

View File

@@ -13,6 +13,7 @@
#define _GNU_SOURCE
#include "kexec-elf.h"
#include "unused.h"
#ifndef BYTE_ORDER
#error BYTE_ORDER not defined
@@ -258,7 +259,7 @@ extern int add_backup_segments(struct kexec_info *info,
#define dbgprintf(_args...) do {printf(_args);} while(0)
#else
static inline int __attribute__ ((format (printf, 1, 2)))
dbgprintf(const char *fmt, ...) {return 0;}
dbgprintf(const char *UNUSED(fmt), ...) {return 0;}
#endif
char *concat_cmdline(const char *base, const char *append);

View File

@@ -3,6 +3,7 @@
#include "kexec-lzma.h"
#include "config.h"
#include "kexec.h"
#ifdef HAVE_LIBLZMA
#define _GNU_SOURCE
@@ -16,8 +17,6 @@
#include <ctype.h>
#include <lzma.h>
#include "kexec.h"
#define kBufferSize (1 << 15)
typedef struct lzfile {
@@ -197,7 +196,7 @@ char *lzma_decompress_file(const char *filename, off_t *r_size)
return buf;
}
#else
char *lzma_decompress_file(const char *filename, off_t *r_size)
char *lzma_decompress_file(const char *UNUSED(filename), off_t *UNUSED(r_size))
{
return NULL;
}

View File

@@ -1,7 +1,7 @@
#include "kexec.h"
#include <stdlib.h>
unsigned long virt_to_phys(unsigned long addr)
unsigned long virt_to_phys(unsigned long UNUSED(addr))
{
abort();
}

View File

@@ -1,4 +1,6 @@
#include "kexec-zlib.h"
#include "kexec.h"
#ifdef HAVE_LIBZ
#define _GNU_SOURCE
#include <stdio.h>
@@ -13,8 +15,6 @@
#include <ctype.h>
#include <zlib.h>
#include "kexec.h"
char *zlib_decompress_file(const char *filename, off_t *r_size)
{
gzFile fp;
@@ -71,7 +71,7 @@ char *zlib_decompress_file(const char *filename, off_t *r_size)
return buf;
}
#else
char *zlib_decompress_file(const char *filename, off_t *r_size)
char *zlib_decompress_file(const char *UNUSED(filename), off_t *UNUSED(r_size))
{
return NULL;
}

View File

@@ -53,6 +53,7 @@ $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
-I$(srcdir)/purgatory/include \
-I$(srcdir)/purgatory/arch/$(ARCH)/include \
-I$(srcdir)/util_lib/include \
-I$(srcdir)/include \
-I$(shell $(CC) -print-file-name=include)
$(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\
--no-undefined -nostartfiles -nostdlib -nodefaultlibs \

View File

@@ -1,5 +1,7 @@
#include <purgatory.h>
void putchar(int ch)
#include "unused.h"
void putchar(int UNUSED(ch))
{
/* Nothing for now */
}

View File

@@ -1,5 +1,7 @@
#include <purgatory.h>
void putchar(int ch)
#include "unused.h"
void putchar(int UNUSED(ch))
{
/* Nothing for now */
}