document compiler warnings

This commit is contained in:
NunoSempere 2023-12-09 18:59:53 +00:00
parent 9cda19cbb5
commit d9e2ca04c5
2 changed files with 8 additions and 3 deletions

View File

@ -284,7 +284,12 @@ In fact, squiggle.c does have a few functions for algebraic manipulations of sim
#### 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

View File

@ -22,9 +22,9 @@ MATH=-lm
DEPS=$(SQUIGGLE) $(MATH)
## Flags
# DEBUG=-fsanitize=address,undefined
# DEBUG=-fsanitize=address,undefined -fanalyzer
# DEBUG=-g
DEBUG=
# DEBUG=
WARN=-Wall -Wextra -Wdouble-promotion -Wconversion
STANDARD=-std=c99
OPTIMIZED=-O3 #-Ofast