mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
Add gcc flags to improve reliability
This commit is contained in:
5
Makefile
5
Makefile
@@ -1,6 +1,7 @@
|
|||||||
CXX=gcc
|
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
|
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
|
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=cpufetch
|
||||||
|
|
||||||
$(OUTPUT): Makefile $(SOURCE) $(HEADERS)
|
$(OUTPUT): Makefile $(SOURCE) $(HEADERS)
|
||||||
$(CXX) $(CXXFLAGS) $(SOURCE) -o $(OUTPUT)
|
$(CXX) $(CXXFLAGS) $(SANITY_FLAGS) $(SOURCE) -o $(OUTPUT)
|
||||||
|
|
||||||
run:
|
run:
|
||||||
./$(OUTPUT)
|
./$(OUTPUT)
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ struct cpuInfo {
|
|||||||
/*** Threads per core(Intel HyperThreading) ***/
|
/*** Threads per core(Intel HyperThreading) ***/
|
||||||
int HT;
|
int HT;
|
||||||
/*** Max CPUIDs levels ***/
|
/*** Max CPUIDs levels ***/
|
||||||
int maxLevels;
|
unsigned maxLevels;
|
||||||
/*** Max CPUIDs extended levels ***/
|
/*** Max CPUIDs extended levels ***/
|
||||||
int maxExtendedLevels;
|
unsigned maxExtendedLevels;
|
||||||
};
|
};
|
||||||
|
|
||||||
void initializeCpuInfo(struct cpuInfo* cpu) {
|
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
|
//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);
|
assert(strlen(STRING_UNKNOWN)+1 <= size);
|
||||||
char* string = malloc(sizeof(char)*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) {
|
char* getString_MaxFrequency(struct frequency* freq) {
|
||||||
//Max 3 digits and 3 for '(M/G)Hz' plus 1 for '\0'
|
//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);
|
assert(strlen(STRING_UNKNOWN)+1 <= size);
|
||||||
char* string = malloc(sizeof(char)*size);
|
char* string = malloc(sizeof(char)*size);
|
||||||
if(freq->max == UNKNOWN)
|
if(freq->max == UNKNOWN)
|
||||||
|
|||||||
Reference in New Issue
Block a user