Commit Graph

188 Commits

Author SHA1 Message Date
Yann Collet
596c747211 make UNAME externally definable
on top of providing a central definition place, which eases maintenance,
it might also help for #1021.

Also : updated doc
2021-08-16 16:43:17 -07:00
Takayuki Matsuoka
6443b85af4 Split c_standards into multiple Makefile targets
To support older compiler which doesn't have explicit dialect option
for C90 (gcc-4.4),  this change set split "c_standards" into multiple
part.

Original "make c_standards" still works as intended.  But this change
gives extra freedom of choice for external program  For example, CI
can choose test for standards which is supported by specimen compiler.

With this separation, we can also introduce C17 smoothly.
2021-05-30 17:10:19 +09:00
Takayuki Matsuoka
0d2570b7c5 Add CC propagation to 'make usan'
The following command doesn't work as intended

```
cd
git clone https://github.com/lz4/lz4.git
cd lz4
make usan MOREFLAGS='-Wcomma -Werror'
```

```
Cleaning completed
cc: error: unrecognized command line option ‘-Wcomma’; did you mean ‘-Wcomment’?
make[3]: *** [<builtin>: ../lib/lz4.o] Error 1
make[2]: *** [Makefile:65: lz4] Error 2
make[1]: *** [Makefile:133: test] Error 2
make: *** [Makefile:158: usan] Error 2
```

Because the following part of the `Makefile` doesn't propagate `CC`, `CFLAGS` and `LDFLAGS` to child `$(MAKE)` properly.

```
.PHONY: usan
usan: CC      = clang
usan: CFLAGS  = -O3 -g -fsanitize=undefined -fno-sanitize-recover=undefined -fsanitize-recover=pointer-overflow
usan: LDFLAGS = $(CFLAGS)
usan: clean
        $(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
```

We need explicit propagation for child process

```
-       $(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
+       CC=$(CC) CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) $(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
```

After that, `make usan` works and it shows expected runtime error.

```
$ make usan MOREFLAGS='-Wcomma -Werror'
Cleaning completed

../lib/lz4frame.c:907:25: runtime error: applying non-zero offset 65536 to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../lib/lz4frame.c:907:25 in
../lib/lz4frame.c:907:58: runtime error: applying zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../lib/lz4frame.c:907:58 in

...
```

Please note that `make usan` is working at travis-ci.  Because `.travis.yml` has the following [explicit `compiler:` setting](7a966c1511/.travis.yml (L66)).

```
    - name: (Trusty) USan test
      dist: trusty
      compiler: clang
      script:
        - make usan MOREFLAGS=-Wcomma -Werror
```
2021-05-27 21:02:34 +09:00
Yann Collet
7d8d1075e6 fixed incorrect propagation of default CFLAGS 2021-04-26 22:40:40 -07:00
Yann Collet
4b7a327068 fix strange printf formatting warning
so now, `%p` _requires_ a `void*` pointer ?
2020-12-01 08:05:19 -08:00
Yann Collet
16bad2caaf fix scanbuild test
seems to require explicit environment variables
2020-11-30 18:13:05 -08:00
Yann Collet
19564bce78 fix CFLAGS unexport issue 2020-11-30 17:42:36 -08:00
Yann Collet
e585a438c7 refactor Makefile
remove usage of include Makefile.inc in too Makefile
as it seems to somehow unexport CFLAGS ...
2020-11-30 16:06:50 -08:00
Yann Collet
a88c8fb438 make it possible to select SCANBUILD binary on command line 2020-10-01 23:27:02 -07:00
Yann Collet
03f006a7ea make scan-build accept assert() 2020-10-01 10:48:22 -07:00
Yann Collet
4f57219a22 fixed ubsan tests with dynamic library 2020-09-17 16:49:21 -07:00
Yann Collet
b223f11b21 ubsan: make pointer overflow recoverable
the way `base` is used must allow 2-complement address overflow.
`base` is effectively a virtual pointer, never dereferenced directly.
What matters is `base + index`.
This is the address that will be dereference and must be valid (it is properly validated).
2020-09-17 15:34:03 -07:00
Yann Collet
b4a64e0eac fix ubsan test
which now fails with a clear error as intended
(not just print a status and move on).
should be reproduced on travisCI
2020-09-17 10:29:31 -07:00
Nick Terrell
31d477db07 [build] Move CMake and Visual build systems to build/
Fixes #852.
2020-08-19 18:08:43 -07:00
Max Dymond
02b5b3c242
Move to using C rather than C++ for compilation 2019-06-28 23:48:33 +01:00
Max Dymond
a5cf079d4d
Add a fuzzing target that compiles in the oss-fuzz environment 2019-06-28 08:30:02 +01:00
Yann Collet
e2527ad725 updated tests
- only play listTest with `make test`, not `make all` which is limited to build
- update `clangtest`, so that it's possible to disable O3 optimization, for faster processing
2019-05-16 16:46:16 -07:00
JPeterMugaas
2acddd9918 Fix a test for mingw 2019-04-22 16:06:04 -04:00
JPeterMugaas
b48f823f90 Try to put some tests I made in ONE place. I also moved a test for "install" in one place to try to isolate it. 2019-04-22 15:48:48 -04:00
JPeterMugaas
773b66547f Initial commits from diff I submitted earlier 2019-04-22 13:48:59 -04:00
Yann Collet
c491df54ec created LZ4_initStreamHC()
- promoted LZ4_resetStreamHC_fast() to stable
- moved LZ4_resetStreamHC() to deprecated (but do not generate a warning yet)
- Updated doc, to highlight difference between init and reset
- switched all invocations of LZ4_resetStreamHC() onto LZ4_initStreamHC()
- misc: ensure `make all` also builds /tests
2019-04-04 17:05:11 -07:00
Vincent Torri
0360981f68 Allow installation of lz4 for Windows 10 with MSYS2 2019-03-03 22:06:38 +01:00
Vincent Torri
0314027051 Allow installation of lz4 for Windows (MSYS2 or when cross-compiling) 2018-11-20 21:08:23 +01:00
Yann Collet
5a10ed2f7b added cppcheck
as Makefile target and Travis CI test.

Fixed last cppcheck warnings in tests and examples
2018-09-18 16:52:02 -07:00
Yann Collet
86023f01f2 avoid final trailing comma for enum lists
as detected in #485 by @JoachimSchneider.

Refactored the c_standards tests
so that these issues get automatically detected in CI tests.
2018-09-13 14:29:41 -07:00
Lucas Holt
3318d573ba Add support for MidnightBSD 2018-09-08 14:46:54 -04:00
W. Felix Handte
c746a27e91 Test Linking C-Compiled Library and C++-Compiled Tests 2018-05-21 22:29:20 -04:00
fbrosson
2149b1a8f6 Add Haiku as a validated target.
lz4 1.8.2 works fine on Haiku and passes all tests.
2018-05-17 16:52:53 +00:00
Yann Collet
7b3cd10579 reduced test time on circle-ci 2018-04-11 16:31:43 -07:00
Yann Collet
7b4c448571 added c90 test to c_standards
to catch `//` comments
2018-03-21 07:19:48 -07:00
Yann Collet
6d4e60e365 fix #481: ensure liblz4.a dependency for make all
`make all` will trigger several sub-directory makefiles.
several of them need `liblz4.a`.
When built with `-j#`, there are several concurrent liblz4.a built

Make liblz4.a a dependency, which is built once,
before moving to sub-directory Makefiles
2018-03-09 09:57:29 -08:00
Yann Collet
0ddd1ceb1d added target make check
according to GNU Makefile conventions,
the Makefile should feature a make check target
to self-test the generated program:
https://www.gnu.org/prep/standards/html_node/Standard-Targets.html .

this is much less thorough and less taxing than `make test`,
and can be run on any target in a reasonable timeframe (several seconds).
2018-02-26 14:09:46 -08:00
Yann Collet
886a485845 examples/Makefile : changed dependency order
static library *.a must come after source files *.c on linux
2018-01-31 23:17:52 -08:00
Yann Collet
5fd3ac7904 Merge branch 'dev' into frameCompress 2018-01-31 17:18:57 -08:00
Yann Collet
3b751a50c5 modified gpptest recipe 2018-01-31 17:15:02 -08:00
Yann Collet
87fb7a1d03 refactored frameCompress example
to better reflect LZ4F API usage.
2018-01-31 14:33:16 -08:00
Yann Collet
e8ee6e5965 nicer console message for make clean 2018-01-13 18:51:33 -08:00
Yann Collet
ce8393e8d7 build: minor : make lz4 doesn't compile liblz4 anymore
since it's not needed.
2017-11-06 15:20:08 -08:00
Yann Collet
01cdbfb5fe lz4c legacy commands are now enabled at runtime based on link/binary name "lz4c"
instead of selected at compilation time depending on a macro.
This design makes it possible to have a single binary which supports both modes.

An advantageous side effect is that when doing `make; make install`
no additional binary is created during `make install`
(it used to create `lz4c`, because `make` would only build `lz4`)
2017-08-14 16:56:05 -07:00
Yann Collet
aea7d521ae better respect GNU standard Makefile conventions
supports lowercase directory variables
add an "Installation" section in README.md
added an INSTALL file
2017-08-14 15:13:23 -07:00
Yann Collet
2012e4de9e fixed c_standards tests
and added entry "make list"
2017-05-10 14:51:09 -07:00
Yann Collet
b8575f2d2b updated Makefile
to automatically build manual files with
make all
2017-05-10 13:26:04 -07:00
Yann Collet
7e57c398c1 Merge pull request #316 from inikep/dev
Dev
2017-02-10 10:25:04 -08:00
Przemyslaw Skibinski
c139eb40b0 added OpenBSD NetBSD SunOS to list of supported make install OSes 2017-02-10 15:00:27 +01:00
Benedikt Heine
5e1a925bea update repolink in makefile 2017-02-10 14:55:54 +01:00
Yann Collet
04e5eaf9bc added DragonFly to list of supported make install OS 2017-02-09 03:19:15 -08:00
Przemyslaw Skibinski
489d1618c9 added "This Makefile is validated for" 2017-01-19 16:28:08 +01:00
Yann Collet
bc0839c5df minor fix for travis-install test 2016-12-21 15:00:43 +01:00
Yann Collet
385cb4f539 minor update Makefile 2016-12-21 13:18:02 +01:00
Yann Collet
913b98fd6f fix make concurrency build (#277) 2016-12-15 22:13:36 +01:00