forked from personal/squiggle.c
document compiler warnings
This commit is contained in:
parent
9cda19cbb5
commit
d9e2ca04c5
|
@ -284,7 +284,12 @@ In fact, squiggle.c does have a few functions for algebraic manipulations of sim
|
||||||
|
|
||||||
#### Harsh compilation
|
#### Harsh compilation
|
||||||
|
|
||||||
By default, I've enabled -Warn-all, -Warn-extra. However, these produce warnings for unused variables, some of which can sometimes be inocuous. For now, I'm suppressing these using a clever UNUSED macro. If you don't like that approach, you could add -Wno-unused-parameter to your makefile and remove the macro.
|
By default, I've enabled -Wall -Wextra -Wdouble-promotion -Wconversion. However, these produce some false positive warnings, which I've dealt with through:
|
||||||
|
|
||||||
|
- For conversion: Explit casts, particularly from int to size_t when calling malloc.
|
||||||
|
- For dealing with unused variables: Using an UNUSED macro. If you don't like that approach, you could add -Wno-unused-parameter to your makefile and remove the macro and its usage.
|
||||||
|
|
||||||
|
Some ressources on compiler flags: [1](https://nullprogram.com/blog/2023/04/29/), [2](https://news.ycombinator.com/item?id=7371806)
|
||||||
|
|
||||||
#### Results of running clang-tidy
|
#### Results of running clang-tidy
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@ MATH=-lm
|
||||||
DEPS=$(SQUIGGLE) $(MATH)
|
DEPS=$(SQUIGGLE) $(MATH)
|
||||||
|
|
||||||
## Flags
|
## Flags
|
||||||
# DEBUG=-fsanitize=address,undefined
|
# DEBUG=-fsanitize=address,undefined -fanalyzer
|
||||||
# DEBUG=-g
|
# DEBUG=-g
|
||||||
DEBUG=
|
# DEBUG=
|
||||||
WARN=-Wall -Wextra -Wdouble-promotion -Wconversion
|
WARN=-Wall -Wextra -Wdouble-promotion -Wconversion
|
||||||
STANDARD=-std=c99
|
STANDARD=-std=c99
|
||||||
OPTIMIZED=-O3 #-Ofast
|
OPTIMIZED=-O3 #-Ofast
|
||||||
|
|
Loading…
Reference in New Issue
Block a user