Skip to content

Commit 2645367

Browse files
committed
style: Added WARN_LEVEL doc to README.md
1 parent 02241ab commit 2645367

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ These variables control the behavior of the project and can be overridden direct
140140
| **USE_LTO** | Enable Link-Time Optimization | `true` |
141141
| **ANALYZE** | Enable static analysis flags | `false` |
142142
| **ARCH** | Target architecture (`-march=`) | `native` |
143+
| **WARN_LEVEL** | Warning strictness (minimal/normal/strict) | `strict` |
143144
| **LIBS** | Libraries to link (`-l`) | |
144145
| **LDFLAGS** | Library search paths (`-L`) | `-L./lib/` |
145146
| **SOURCE_DIRS** | Source directories | `src include` |
@@ -178,7 +179,61 @@ make release USE_LTO=false
178179
make -j8 release
179180
```
180181

181-
### Adding libraries manually on Makefile (example: GLFW + OpenGL)
182+
## 🔍 Compiler Warning Levels
183+
184+
Control compiler warning strictness with the **`WARN_LEVEL`** variable. Perfect for managing warnings in different project phases or integrating with CI/CD pipelines.
185+
186+
### Available Levels
187+
188+
| Level | Flags | Use Case |
189+
|-------|-------|----------|
190+
| **minimal** | Base warnings only (`-Wall -Wextra -pedantic-errors`) | Legacy code, third-party libraries |
191+
| **normal** | + Type conversion, logic, and safety checks | Standard development (recommended) |
192+
| **strict** | + Code quality warnings (`-Wshadow`, `-Wunused`, etc) | New projects, CI/CD pipelines (default) |
193+
194+
### Examples
195+
196+
```bash
197+
# Production: Strict + Optimization
198+
make release WARN_LEVEL=strict ARCH=native
199+
200+
# Cross-platform: Balanced with specific compiler
201+
make WARN_LEVEL=normal CXX=clang++ -j8
202+
```
203+
204+
### What Each Level Includes
205+
206+
**minimal:**
207+
```
208+
-Wall -Wextra -pedantic-errors
209+
```
210+
211+
**normal** (minimal +):
212+
```
213+
-Wconversion -Wsign-conversion -Wdouble-promotion
214+
-Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict
215+
-Wnull-dereference -Wformat=2 -Wunreachable-code
216+
```
217+
218+
**strict** (normal +):
219+
```
220+
-Wshadow -Wunused -Wunused-parameter
221+
```
222+
223+
### Warning Behavior by Build Type
224+
225+
- **Release builds**: Warnings become errors (`-Werror`) regardless of `WARN_LEVEL`
226+
- **Debug builds**: Warnings remain as warnings for easier iteration
227+
228+
```bash
229+
# Warnings as errors
230+
make release WARN_LEVEL=minimal
231+
232+
# Warnings only
233+
make debug WARN_LEVEL=strict
234+
```
235+
236+
### Adding Libraries manually on Makefile (example: GLFW + OpenGL)
182237

183238
Uncomment/add in the libraries section:
184239

0 commit comments

Comments
 (0)