mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-24 23:40:39 +01:00
Add gcc flags to improve reliability
This commit is contained in:
5
Makefile
5
Makefile
@@ -1,6 +1,7 @@
|
||||
CXX=gcc
|
||||
|
||||
CXXFLAGS=-g -Wall -Werror -fstack-protector-all -pedantic -Wno-unused
|
||||
CXXFLAGS=-g -Wall -Wextra -Werror -fstack-protector-all -pedantic -Wno-unused
|
||||
SANITY_FLAGS=-Wfloat-equal -Wshadow -Wpointer-arith -Wstrict-overflow=5 -Wformat=2
|
||||
|
||||
SOURCE=main.c standart.c extended.c cpuid.c udev.c printer.c args.c global.c
|
||||
HEADERS=standart.h extended.h cpuid.h udev.h printer.h ascii.h args.h global.h
|
||||
@@ -8,7 +9,7 @@ HEADERS=standart.h extended.h cpuid.h udev.h printer.h ascii.h args.h global.h
|
||||
OUTPUT=cpufetch
|
||||
|
||||
$(OUTPUT): Makefile $(SOURCE) $(HEADERS)
|
||||
$(CXX) $(CXXFLAGS) $(SOURCE) -o $(OUTPUT)
|
||||
$(CXX) $(CXXFLAGS) $(SANITY_FLAGS) $(SOURCE) -o $(OUTPUT)
|
||||
|
||||
run:
|
||||
./$(OUTPUT)
|
||||
|
||||
@@ -49,9 +49,9 @@ struct cpuInfo {
|
||||
/*** Threads per core(Intel HyperThreading) ***/
|
||||
int HT;
|
||||
/*** Max CPUIDs levels ***/
|
||||
int maxLevels;
|
||||
unsigned maxLevels;
|
||||
/*** Max CPUIDs extended levels ***/
|
||||
int maxExtendedLevels;
|
||||
unsigned maxExtendedLevels;
|
||||
};
|
||||
|
||||
void initializeCpuInfo(struct cpuInfo* cpu) {
|
||||
@@ -224,7 +224,7 @@ char* getPeakPerformance(struct cpuInfo* cpu, long freq) {
|
||||
***/
|
||||
|
||||
//7 for GFLOP/s and 6 for digits,eg 412.14
|
||||
int size = 7+6+1+1;
|
||||
unsigned int size = 7+6+1+1;
|
||||
assert(strlen(STRING_UNKNOWN)+1 <= size);
|
||||
char* string = malloc(sizeof(char)*size);
|
||||
|
||||
|
||||
2
udev.c
2
udev.c
@@ -161,7 +161,7 @@ char* getString_L3(struct cache* cach) {
|
||||
|
||||
char* getString_MaxFrequency(struct frequency* freq) {
|
||||
//Max 3 digits and 3 for '(M/G)Hz' plus 1 for '\0'
|
||||
int size = (4+3+1);
|
||||
unsigned int size = (4+3+1);
|
||||
assert(strlen(STRING_UNKNOWN)+1 <= size);
|
||||
char* string = malloc(sizeof(char)*size);
|
||||
if(freq->max == UNKNOWN)
|
||||
|
||||
Reference in New Issue
Block a user