Skip to content

Commit 6d8e0e2

Browse files
committed
Moved -Werror flag to CI only
The most useful part of -Werror is preventing code from being merged that has warnings. However it is annoying for users who may have different compilers with different warnings. Limiting -Werror to CI only covers the main concern about warnings without limiting users.
1 parent 88f678f commit 6d8e0e2

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

.travis.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1+
env:
2+
- CFLAGS=-Werror
3+
14
script:
25
# make sure example can at least compile
36
- sed -n '/``` c/,/```/{/```/d; p;}' README.md > test.c &&
4-
CFLAGS='
7+
make all size CFLAGS+="
58
-Duser_provided_block_device_read=NULL
69
-Duser_provided_block_device_prog=NULL
710
-Duser_provided_block_device_erase=NULL
811
-Duser_provided_block_device_sync=NULL
9-
-include stdio.h -Werror' make all size
12+
-include stdio.h"
1013

1114
# run tests
1215
- make test QUIET=1
1316

1417
# run tests with a few different configurations
15-
- CFLAGS="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1" make test QUIET=1
16-
- CFLAGS="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512" make test QUIET=1
17-
- CFLAGS="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048" make test QUIET=1
18+
- make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1"
19+
- make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512"
20+
- make test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048"
1821

1922
# self-host with littlefs-fuse for fuzz test
2023
- make -C littlefs-fuse

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ TEST := $(patsubst tests/%.sh,%,$(wildcard tests/test_*))
1414
SHELL = /bin/bash -o pipefail
1515

1616
ifdef DEBUG
17-
CFLAGS += -O0 -g3
17+
override CFLAGS += -O0 -g3
1818
else
19-
CFLAGS += -Os
19+
override CFLAGS += -Os
2020
endif
2121
ifdef WORD
22-
CFLAGS += -m$(WORD)
22+
override CFLAGS += -m$(WORD)
2323
endif
24-
CFLAGS += -I.
25-
CFLAGS += -std=c99 -Wall -pedantic
24+
override CFLAGS += -I.
25+
override CFLAGS += -std=c99 -Wall -pedantic
2626

2727

2828
all: $(TARGET)

tests/test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def generate(test):
3333
pass
3434

3535
def compile():
36-
os.environ['CFLAGS'] = os.environ.get('CFLAGS', '') + ' -Werror'
37-
subprocess.check_call(['make', '--no-print-directory', '-s'], env=os.environ)
36+
subprocess.check_call(['make', '--no-print-directory', '-s'])
3837

3938
def execute():
4039
subprocess.check_call(["./lfs"])

0 commit comments

Comments
 (0)