mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
[v1.03] Add void to function declarations with no args. C99 Standard says in 6.7.5.3 that empty arguments are actually obsolescent - this commit fixes a warning in some compilers
This commit is contained in:
@@ -141,7 +141,7 @@ void init_cpu_info(struct cpuInfo* cpu) {
|
|||||||
// true...
|
// true...
|
||||||
// ARM32 https://elixir.bootlin.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h
|
// ARM32 https://elixir.bootlin.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h
|
||||||
// ARM64 https://elixir.bootlin.com/linux/latest/source/arch/arm64/include/uapi/asm/hwcap.h
|
// ARM64 https://elixir.bootlin.com/linux/latest/source/arch/arm64/include/uapi/asm/hwcap.h
|
||||||
struct features* get_features_info() {
|
struct features* get_features_info(void) {
|
||||||
struct features* feat = emalloc(sizeof(struct features));
|
struct features* feat = emalloc(sizeof(struct features));
|
||||||
bool *ptr = &(feat->AES);
|
bool *ptr = &(feat->AES);
|
||||||
for(uint32_t i = 0; i < sizeof(struct features)/sizeof(bool); i++, ptr++) {
|
for(uint32_t i = 0; i < sizeof(struct features)/sizeof(bool); i++, ptr++) {
|
||||||
@@ -371,7 +371,7 @@ struct cpuInfo* get_cpu_info_mach(struct cpuInfo* cpu) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct cpuInfo* get_cpu_info() {
|
struct cpuInfo* get_cpu_info(void) {
|
||||||
struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo));
|
struct cpuInfo* cpu = malloc(sizeof(struct cpuInfo));
|
||||||
init_cpu_info(cpu);
|
init_cpu_info(cpu);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "../common/cpu.h"
|
#include "../common/cpu.h"
|
||||||
|
|
||||||
struct cpuInfo* get_cpu_info();
|
struct cpuInfo* get_cpu_info(void);
|
||||||
|
|
||||||
uint32_t get_nsockets(struct topology* topo);
|
uint32_t get_nsockets(struct topology* topo);
|
||||||
char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_socket);
|
char* get_str_topology(struct cpuInfo* cpu, struct topology* topo, bool dual_socket);
|
||||||
|
|||||||
@@ -702,7 +702,7 @@ struct system_on_chip* guess_soc_apple(struct system_on_chip* soc) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct system_on_chip* get_soc() {
|
struct system_on_chip* get_soc(void) {
|
||||||
struct system_on_chip* soc = emalloc(sizeof(struct system_on_chip));
|
struct system_on_chip* soc = emalloc(sizeof(struct system_on_chip));
|
||||||
soc->raw_name = NULL;
|
soc->raw_name = NULL;
|
||||||
soc->soc_vendor = SOC_VENDOR_UNKNOWN;
|
soc->soc_vendor = SOC_VENDOR_UNKNOWN;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ struct system_on_chip {
|
|||||||
char* raw_name;
|
char* raw_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct system_on_chip* get_soc();
|
struct system_on_chip* get_soc(void);
|
||||||
char* get_soc_name(struct system_on_chip* soc);
|
char* get_soc_name(struct system_on_chip* soc);
|
||||||
VENDOR get_soc_vendor(struct system_on_chip* soc);
|
VENDOR get_soc_vendor(struct system_on_chip* soc);
|
||||||
char* get_str_process(struct system_on_chip* soc);
|
char* get_str_process(struct system_on_chip* soc);
|
||||||
|
|||||||
@@ -129,15 +129,15 @@ char* get_field_from_cpuinfo(char* CPUINFO_FIELD) {
|
|||||||
return hardware;
|
return hardware;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_hardware_from_cpuinfo() {
|
char* get_hardware_from_cpuinfo(void) {
|
||||||
return get_field_from_cpuinfo(CPUINFO_HARDWARE_STR);
|
return get_field_from_cpuinfo(CPUINFO_HARDWARE_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_revision_from_cpuinfo() {
|
char* get_revision_from_cpuinfo(void) {
|
||||||
return get_field_from_cpuinfo(CPUINFO_REVISION_STR);
|
return get_field_from_cpuinfo(CPUINFO_REVISION_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_raspberry_pi() {
|
bool is_raspberry_pi(void) {
|
||||||
int filelen;
|
int filelen;
|
||||||
char* buf;
|
char* buf;
|
||||||
if((buf = read_file(_PATH_DEVICETREE_MODEL, &filelen)) == NULL) {
|
if((buf = read_file(_PATH_DEVICETREE_MODEL, &filelen)) == NULL) {
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
#include "../common/udev.h"
|
#include "../common/udev.h"
|
||||||
|
|
||||||
#define UNKNOWN -1
|
#define UNKNOWN -1
|
||||||
int get_ncores_from_cpuinfo();
|
int get_ncores_from_cpuinfo(void);
|
||||||
uint32_t get_midr_from_cpuinfo(uint32_t core, bool* success);
|
uint32_t get_midr_from_cpuinfo(uint32_t core, bool* success);
|
||||||
char* get_hardware_from_cpuinfo();
|
char* get_hardware_from_cpuinfo(void);
|
||||||
char* get_revision_from_cpuinfo();
|
char* get_revision_from_cpuinfo(void);
|
||||||
bool is_raspberry_pi();
|
bool is_raspberry_pi(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -71,59 +71,59 @@ const char *args_str[] = {
|
|||||||
|
|
||||||
static struct args_struct args;
|
static struct args_struct args;
|
||||||
|
|
||||||
STYLE get_style() {
|
STYLE get_style(void) {
|
||||||
return args.style;
|
return args.style;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct color** get_colors() {
|
struct color** get_colors(void) {
|
||||||
return args.colors;
|
return args.colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_help() {
|
bool show_help(void) {
|
||||||
return args.help_flag;
|
return args.help_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_version() {
|
bool show_version(void) {
|
||||||
return args.version_flag;
|
return args.version_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_debug() {
|
bool show_debug(void) {
|
||||||
return args.debug_flag;
|
return args.debug_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_raw() {
|
bool show_raw(void) {
|
||||||
return args.raw_flag;
|
return args.raw_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool accurate_pp() {
|
bool accurate_pp(void) {
|
||||||
return args.accurate_pp;
|
return args.accurate_pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_full_cpu_name() {
|
bool show_full_cpu_name(void) {
|
||||||
return args.full_cpu_name_flag;
|
return args.full_cpu_name_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_logo_long() {
|
bool show_logo_long(void) {
|
||||||
return args.logo_long;
|
return args.logo_long;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_logo_short() {
|
bool show_logo_short(void) {
|
||||||
return args.logo_short;
|
return args.logo_short;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_logo_intel_new() {
|
bool show_logo_intel_new(void) {
|
||||||
return args.logo_intel_new;
|
return args.logo_intel_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_logo_intel_old() {
|
bool show_logo_intel_old(void) {
|
||||||
return args.logo_intel_old;
|
return args.logo_intel_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool verbose_enabled() {
|
bool verbose_enabled(void) {
|
||||||
return args.verbose_flag;
|
return args.verbose_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
int max_arg_str_length() {
|
int max_arg_str_length(void) {
|
||||||
int max_len = -1;
|
int max_len = -1;
|
||||||
int len = sizeof(args_str) / sizeof(args_str[0]);
|
int len = sizeof(args_str) / sizeof(args_str[0]);
|
||||||
for(int i=0; i < len; i++) {
|
for(int i=0; i < len; i++) {
|
||||||
@@ -211,7 +211,7 @@ bool parse_color(char* optarg_str, struct color*** cs) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* build_short_options() {
|
char* build_short_options(void) {
|
||||||
const char *c = args_chr;
|
const char *c = args_chr;
|
||||||
int len = sizeof(args_chr) / sizeof(args_chr[0]);
|
int len = sizeof(args_chr) / sizeof(args_chr[0]);
|
||||||
char* str = (char *) emalloc(sizeof(char) * (len*2 + 1));
|
char* str = (char *) emalloc(sizeof(char) * (len*2 + 1));
|
||||||
|
|||||||
@@ -39,21 +39,21 @@ extern const char *args_str[];
|
|||||||
|
|
||||||
#include "printer.h"
|
#include "printer.h"
|
||||||
|
|
||||||
int max_arg_str_length();
|
int max_arg_str_length(void);
|
||||||
bool parse_args(int argc, char* argv[]);
|
bool parse_args(int argc, char* argv[]);
|
||||||
bool show_help();
|
bool show_help(void);
|
||||||
bool accurate_pp();
|
bool accurate_pp(void);
|
||||||
bool show_full_cpu_name();
|
bool show_full_cpu_name(void);
|
||||||
bool show_logo_long();
|
bool show_logo_long(void);
|
||||||
bool show_logo_short();
|
bool show_logo_short(void);
|
||||||
bool show_logo_intel_new();
|
bool show_logo_intel_new(void);
|
||||||
bool show_logo_intel_old();
|
bool show_logo_intel_old(void);
|
||||||
bool show_raw();
|
bool show_raw(void);
|
||||||
bool show_debug();
|
bool show_debug(void);
|
||||||
bool show_version();
|
bool show_version(void);
|
||||||
bool verbose_enabled();
|
bool verbose_enabled(void);
|
||||||
void free_colors_struct(struct color** cs);
|
void free_colors_struct(struct color** cs);
|
||||||
struct color** get_colors();
|
struct color** get_colors(void);
|
||||||
STYLE get_style();
|
STYLE get_style(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -909,7 +909,7 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct terminal* get_terminal_size() {
|
struct terminal* get_terminal_size(void) {
|
||||||
struct terminal* term = emalloc(sizeof(struct terminal));
|
struct terminal* term = emalloc(sizeof(struct terminal));
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
// https://www.kernel.org/doc/html/latest/core-api/cpu_hotplug.html
|
// https://www.kernel.org/doc/html/latest/core-api/cpu_hotplug.html
|
||||||
int get_ncores_from_cpuinfo() {
|
int get_ncores_from_cpuinfo(void) {
|
||||||
// Examples:
|
// Examples:
|
||||||
// 0-271
|
// 0-271
|
||||||
// 0-7
|
// 0-7
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ long get_l1d_cache_size(uint32_t core);
|
|||||||
long get_l2_cache_size(uint32_t core);
|
long get_l2_cache_size(uint32_t core);
|
||||||
long get_l3_cache_size(uint32_t core);
|
long get_l3_cache_size(uint32_t core);
|
||||||
int get_num_caches_by_level(struct cpuInfo* cpu, uint32_t level);
|
int get_num_caches_by_level(struct cpuInfo* cpu, uint32_t level);
|
||||||
int get_ncores_from_cpuinfo();
|
int get_ncores_from_cpuinfo(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ struct topology* get_topology_info(struct cache* cach) {
|
|||||||
return topo;
|
return topo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t mfpvr() {
|
static inline uint32_t mfpvr(void) {
|
||||||
uint32_t pvr;
|
uint32_t pvr;
|
||||||
|
|
||||||
asm ("mfpvr %0"
|
asm ("mfpvr %0"
|
||||||
@@ -123,7 +123,7 @@ struct uarch* get_cpu_uarch(struct cpuInfo* cpu) {
|
|||||||
return get_uarch_from_pvr(cpu->pvr);
|
return get_uarch_from_pvr(cpu->pvr);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct frequency* get_frequency_info() {
|
struct frequency* get_frequency_info(void) {
|
||||||
struct frequency* freq = emalloc(sizeof(struct frequency));
|
struct frequency* freq = emalloc(sizeof(struct frequency));
|
||||||
|
|
||||||
freq->max = get_max_freq_from_file(0);
|
freq->max = get_max_freq_from_file(0);
|
||||||
@@ -158,7 +158,7 @@ int64_t get_peak_performance(struct cpuInfo* cpu, struct topology* topo, int64_t
|
|||||||
return flops;
|
return flops;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cpuInfo* get_cpu_info() {
|
struct cpuInfo* get_cpu_info(void) {
|
||||||
struct cpuInfo* cpu = emalloc(sizeof(struct cpuInfo));
|
struct cpuInfo* cpu = emalloc(sizeof(struct cpuInfo));
|
||||||
struct features* feat = emalloc(sizeof(struct features));
|
struct features* feat = emalloc(sizeof(struct features));
|
||||||
cpu->feat = feat;
|
cpu->feat = feat;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "../common/cpu.h"
|
#include "../common/cpu.h"
|
||||||
|
|
||||||
struct cpuInfo* get_cpu_info();
|
struct cpuInfo* get_cpu_info(void);
|
||||||
char* get_str_altivec(struct cpuInfo* cpu);
|
char* get_str_altivec(struct cpuInfo* cpu);
|
||||||
char* get_str_topology(struct topology* topo, bool dual_socket);
|
char* get_str_topology(struct topology* topo, bool dual_socket);
|
||||||
void print_debug(struct cpuInfo* cpu);
|
void print_debug(struct cpuInfo* cpu);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void get_name_cpuid(char* name, uint32_t reg1, uint32_t reg2, uint32_t reg3) {
|
|||||||
name[c++] = (reg3>>24) & MASK;
|
name[c++] = (reg3>>24) & MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_str_cpu_name_internal() {
|
char* get_str_cpu_name_internal(void) {
|
||||||
uint32_t eax = 0;
|
uint32_t eax = 0;
|
||||||
uint32_t ebx = 0;
|
uint32_t ebx = 0;
|
||||||
uint32_t ecx = 0;
|
uint32_t ecx = 0;
|
||||||
@@ -412,7 +412,7 @@ bool set_cpu_module(int m, int total_modules, int32_t* first_core) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t get_core_type() {
|
int32_t get_core_type(void) {
|
||||||
uint32_t eax = 0x0000001A;
|
uint32_t eax = 0x0000001A;
|
||||||
uint32_t ebx = 0;
|
uint32_t ebx = 0;
|
||||||
uint32_t ecx = 0;
|
uint32_t ecx = 0;
|
||||||
@@ -430,7 +430,7 @@ int32_t get_core_type() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cpuInfo* get_cpu_info() {
|
struct cpuInfo* get_cpu_info(void) {
|
||||||
struct cpuInfo* cpu = emalloc(sizeof(struct cpuInfo));
|
struct cpuInfo* cpu = emalloc(sizeof(struct cpuInfo));
|
||||||
cpu->peak_performance = -1;
|
cpu->peak_performance = -1;
|
||||||
cpu->next_cpu = NULL;
|
cpu->next_cpu = NULL;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "../common/cpu.h"
|
#include "../common/cpu.h"
|
||||||
|
|
||||||
struct cpuInfo* get_cpu_info();
|
struct cpuInfo* get_cpu_info(void);
|
||||||
struct cache* get_cache_info(struct cpuInfo* cpu);
|
struct cache* get_cache_info(struct cpuInfo* cpu);
|
||||||
struct frequency* get_frequency_info(struct cpuInfo* cpu);
|
struct frequency* get_frequency_info(struct cpuInfo* cpu);
|
||||||
struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, int module);
|
struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, int module);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "freq.h"
|
#include "freq.h"
|
||||||
|
|
||||||
void* compute_avx() {
|
void* compute_avx(void) {
|
||||||
bool end = false;
|
bool end = false;
|
||||||
|
|
||||||
struct timeval begin, now;
|
struct timeval begin, now;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef __FREQ_AVX__
|
#ifndef __FREQ_AVX__
|
||||||
#define __FREQ_AVX__
|
#define __FREQ_AVX__
|
||||||
|
|
||||||
void* compute_avx();
|
void* compute_avx(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "freq.h"
|
#include "freq.h"
|
||||||
|
|
||||||
void* compute_avx512() {
|
void* compute_avx512(void) {
|
||||||
bool end = false;
|
bool end = false;
|
||||||
|
|
||||||
struct timeval begin, now;
|
struct timeval begin, now;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef __FREQ_AVX512__
|
#ifndef __FREQ_AVX512__
|
||||||
#define __FREQ_AVX512__
|
#define __FREQ_AVX512__
|
||||||
|
|
||||||
void* compute_avx512();
|
void* compute_avx512(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "freq.h"
|
#include "freq.h"
|
||||||
|
|
||||||
void* compute_nov() {
|
void* compute_nov(void) {
|
||||||
bool end = false;
|
bool end = false;
|
||||||
|
|
||||||
struct timeval begin, now;
|
struct timeval begin, now;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef __FREQ_NO_VECTOR__
|
#ifndef __FREQ_NO_VECTOR__
|
||||||
#define __FREQ_NO_VECTOR__
|
#define __FREQ_NO_VECTOR__
|
||||||
|
|
||||||
void* compute_nov();
|
void* compute_nov(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user