[kvm-unit-tests,3/4] Make remaining x86 code compilable with -Wstrict-prototypes
diff mbox

Message ID 1530086528-21665-4-git-send-email-thuth@redhat.com
State New
Headers show

Commit Message

Thomas Huth June 27, 2018, 8:02 a.m. UTC
This way the functions can not be called anymore with arbitrary
parameters by accident.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 lib/x86/processor.h | 2 +-
 lib/x86/smp.c       | 2 +-
 lib/x86/vm.h        | 2 +-
 x86/access.c        | 2 +-
 x86/apic.c          | 4 ++--
 x86/emulator.c      | 4 ++--
 x86/eventinj.c      | 4 ++--
 x86/kvmclock.c      | 2 +-
 x86/kvmclock.h      | 2 +-
 x86/pku.c           | 2 +-
 x86/pmu.c           | 2 +-
 x86/port80.c        | 2 +-
 x86/setjmp.c        | 2 +-
 x86/sieve.c         | 2 +-
 x86/smptest.c       | 2 +-
 x86/syscall.c       | 6 +++---
 x86/tsc.c           | 2 +-
 x86/tsc_adjust.c    | 2 +-
 x86/vmx.c           | 8 ++++----
 x86/vmx.h           | 6 +++---
 20 files changed, 30 insertions(+), 30 deletions(-)

Patch
diff mbox

diff --git a/lib/x86/processor.h b/lib/x86/processor.h
index e850029..945a94e 100644
--- a/lib/x86/processor.h
+++ b/lib/x86/processor.h
@@ -354,7 +354,7 @@  static inline void sti(void)
     asm volatile ("sti");
 }
 
-static inline unsigned long long rdtsc()
+static inline unsigned long long rdtsc(void)
 {
 	long long r;
 
diff --git a/lib/x86/smp.c b/lib/x86/smp.c
index bffb6de..2e98de8 100644
--- a/lib/x86/smp.c
+++ b/lib/x86/smp.c
@@ -19,7 +19,7 @@  static volatile bool ipi_wait;
 static int _cpu_count;
 static atomic_t active_cpus;
 
-static __attribute__((used)) void ipi()
+static __attribute__((used)) void ipi(void)
 {
     void (*function)(void *data) = ipi_function;
     void *data = ipi_data;
diff --git a/lib/x86/vm.h b/lib/x86/vm.h
index ae1b769..729f172 100644
--- a/lib/x86/vm.h
+++ b/lib/x86/vm.h
@@ -5,7 +5,7 @@ 
 #include "asm/page.h"
 #include "asm/io.h"
 
-void setup_5level_page_table();
+void setup_5level_page_table(void);
 
 struct pte_search {
 	int level;
diff --git a/x86/access.c b/x86/access.c
index 11f561b..8f8c228 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -992,7 +992,7 @@  int ac_test_run(void)
     return successes == tests;
 }
 
-int main()
+int main(void)
 {
     int r;
 
diff --git a/x86/apic.c b/x86/apic.c
index 630fe86..013e296 100644
--- a/x86/apic.c
+++ b/x86/apic.c
@@ -518,7 +518,7 @@  static inline void apic_change_mode(unsigned long new_mode)
 	apic_write(APIC_LVTT, (lvtt & ~APIC_LVT_TIMER_MASK) | new_mode);
 }
 
-static void test_apic_change_mode()
+static void test_apic_change_mode(void)
 {
 	uint32_t tmict = 0x999999;
 
@@ -570,7 +570,7 @@  static void test_apic_change_mode()
 	report("TMCCT should stay at zero", !apic_read(APIC_TMCCT));
 }
 
-int main()
+int main(void)
 {
     setup_vm();
     smp_init();
diff --git a/x86/emulator.c b/x86/emulator.c
index 38688dc..0d88409 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -33,7 +33,7 @@  struct insn_desc {
 
 static char st1[] = "abcdefghijklmnop";
 
-void test_stringio()
+static void test_stringio(void)
 {
 	unsigned char r = 0;
 	asm volatile("cld \n\t"
@@ -1015,7 +1015,7 @@  static void record_no_fep(struct ex_regs *regs)
 	regs->rip += KVM_FEP_LENGTH;
 }
 
-int main()
+int main(void)
 {
 	void *mem;
 	void *insn_page;
diff --git a/x86/eventinj.c b/x86/eventinj.c
index 247604c..cbfc03f 100644
--- a/x86/eventinj.c
+++ b/x86/eventinj.c
@@ -37,7 +37,7 @@  void apic_self_nmi(void)
 
 extern char isr_iret_ip[];
 
-static void flush_idt_page()
+static void flush_idt_page(void)
 {
 	struct descriptor_table_ptr ptr;
 	sidt(&ptr);
@@ -196,7 +196,7 @@  ulong saved_stack;
 		asm volatile ("mov %0, %%" R "sp"::"r"(saved_stack));	\
 	} while(0)
 
-int main()
+int main(void)
 {
 	unsigned int res;
 	ulong *pt, *cr3, i;
diff --git a/x86/kvmclock.c b/x86/kvmclock.c
index bad0784..e7b6054 100644
--- a/x86/kvmclock.c
+++ b/x86/kvmclock.c
@@ -160,7 +160,7 @@  bool pvclock_read_retry(const struct pvclock_vcpu_time_info *src,
 	return version != src->version;
 }
 
-static inline u64 rdtsc_ordered()
+static inline u64 rdtsc_ordered(void)
 {
 	/*
 	 * FIXME: on Intel CPUs rmb() aka lfence is sufficient which brings up
diff --git a/x86/kvmclock.h b/x86/kvmclock.h
index dff6802..f823c6d 100644
--- a/x86/kvmclock.h
+++ b/x86/kvmclock.h
@@ -36,7 +36,7 @@  struct timespec {
 };
 
 void pvclock_set_flags(unsigned char flags);
-cycle_t kvm_clock_read();
+cycle_t kvm_clock_read(void);
 void kvm_get_wallclock(struct timespec *ts);
 void kvm_clock_init(void *data);
 void kvm_clock_clear(void *data);
diff --git a/x86/pku.c b/x86/pku.c
index 0e7b03f..d51d26f 100644
--- a/x86/pku.c
+++ b/x86/pku.c
@@ -49,7 +49,7 @@  asm ("pf_tss: \n\t"
     "jmp pf_tss\n\t"
     );
 
-static void init_test()
+static void init_test(void)
 {
     pf_count = 0;
 
diff --git a/x86/pmu.c b/x86/pmu.c
index 12a5880..f7b3010 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -95,7 +95,7 @@  static int num_counters;
 
 char *buf;
 
-static inline void loop()
+static inline void loop(void)
 {
 	unsigned long tmp, tmp2, tmp3;
 
diff --git a/x86/port80.c b/x86/port80.c
index 522c1a4..791431c 100644
--- a/x86/port80.c
+++ b/x86/port80.c
@@ -1,6 +1,6 @@ 
 #include "libcflat.h"
 
-int main()
+int main(void)
 {
     int i;
 
diff --git a/x86/setjmp.c b/x86/setjmp.c
index fa33179..976a632 100644
--- a/x86/setjmp.c
+++ b/x86/setjmp.c
@@ -1,7 +1,7 @@ 
 #include "libcflat.h"
 #include "setjmp.h"
 
-int main()
+int main(void)
 {
     volatile int i;
     jmp_buf j;
diff --git a/x86/sieve.c b/x86/sieve.c
index 2ee2919..35da34f 100644
--- a/x86/sieve.c
+++ b/x86/sieve.c
@@ -32,7 +32,7 @@  void test_sieve(const char *msg, char *data, int size)
 #define VSIZE 100000000
 char static_data[STATIC_SIZE];
 
-int main()
+int main(void)
 {
     void *v;
     int i;
diff --git a/x86/smptest.c b/x86/smptest.c
index 68f35ee..2d271e7 100644
--- a/x86/smptest.c
+++ b/x86/smptest.c
@@ -14,7 +14,7 @@  static void ipi_test(void *data)
         nipis++;
 }
 
-int main()
+int main(void)
 {
     int ncpus;
     int i;
diff --git a/x86/syscall.c b/x86/syscall.c
index 8c3992d..e2d6514 100644
--- a/x86/syscall.c
+++ b/x86/syscall.c
@@ -7,7 +7,7 @@ 
 
 static void test_syscall_lazy_load(void)
 {
-    extern void syscall_target();
+    extern void syscall_target(void);
     u16 cs = read_cs(), ss = read_ss();
     ulong tmp;
 
@@ -57,8 +57,8 @@  asm("   .code32\n"
 
 static void test_syscall_tf(void)
 {
-    extern void syscall32_target();
-    extern void syscall_tf_user32();
+    extern void syscall32_target(void);
+    extern void syscall_tf_user32(void);
     ulong rcx;
 
     wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_SCE);
diff --git a/x86/tsc.c b/x86/tsc.c
index 6dc05af..2268682 100644
--- a/x86/tsc.c
+++ b/x86/tsc.c
@@ -26,7 +26,7 @@  void test_rdtscp(u64 aux)
        report("Test RDTSCP %" PRIu64, ecx == aux, aux);
 }
 
-int main()
+int main(void)
 {
 	u64 t1, t2;
 
diff --git a/x86/tsc_adjust.c b/x86/tsc_adjust.c
index 20a9e89..0f32d8a 100644
--- a/x86/tsc_adjust.c
+++ b/x86/tsc_adjust.c
@@ -1,7 +1,7 @@ 
 #include "libcflat.h"
 #include "processor.h"
 
-int main()
+int main(void)
 {
 	u64 t1, t2, t3, t4, t5;
 	u64 est_delta_time;
diff --git a/x86/vmx.c b/x86/vmx.c
index aa04ac6..e5a8fbd 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -1453,7 +1453,7 @@  static void __attribute__((__used__)) hypercall(u32 hypercall_no)
 	asm volatile("vmcall\n\t");
 }
 
-static bool is_hypercall()
+static bool is_hypercall(void)
 {
 	ulong reason, hyper_bit;
 
@@ -1464,7 +1464,7 @@  static bool is_hypercall()
 	return false;
 }
 
-static int handle_hypercall()
+static int handle_hypercall(void)
 {
 	ulong hypercall_no;
 
@@ -1518,7 +1518,7 @@  void test_skip(const char *msg)
 	abort();
 }
 
-static int exit_handler()
+static int exit_handler(void)
 {
 	int ret;
 
@@ -1590,7 +1590,7 @@  static bool vmx_enter_guest(struct vmentry_failure *failure)
 	return !failure->early && !(vmcs_read(EXI_REASON) & VMX_ENTRY_FAILURE);
 }
 
-static int vmx_run()
+static int vmx_run(void)
 {
 	while (1) {
 		u32 ret;
diff --git a/x86/vmx.h b/x86/vmx.h
index c035420..cb6739b 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -53,8 +53,8 @@  struct vmentry_failure {
 struct vmx_test {
 	const char *name;
 	int (*init)(struct vmcs *vmcs);
-	void (*guest_main)();
-	int (*exit_handler)();
+	void (*guest_main)(void);
+	int (*exit_handler)(void);
 	void (*syscall_handler)(u64 syscall_no);
 	struct regs guest_regs;
 	int (*entry_failure_handler)(struct vmentry_failure *failure);
@@ -721,7 +721,7 @@  static inline bool invvpid(unsigned long type, u64 vpid, u64 gla)
 }
 
 const char *exit_reason_description(u64 reason);
-void print_vmexit_info();
+void print_vmexit_info(void);
 void print_vmentry_failure_info(struct vmentry_failure *failure);
 void ept_sync(int type, u64 eptp);
 void vpid_sync(int type, u16 vpid);