Merge pull request #1019 from servusdei2018/patch-1
nit(programs/platform.h): replace Unicode character #1018
This commit is contained in:
commit
eb70459803
@ -231,6 +231,12 @@ matrix:
|
||||
- name: Compile OSS-Fuzz targets
|
||||
script:
|
||||
- ./ossfuzz/travisoss.sh
|
||||
|
||||
# Unicode lint
|
||||
# See https://github.com/lz4/lz4/issues/1018
|
||||
- name: Run Unicode lint
|
||||
script:
|
||||
- ./tests/unicode_lint.sh
|
||||
|
||||
allow_failures:
|
||||
- env: ALLOW_FAILURES=true
|
||||
|
@ -80,7 +80,7 @@ extern "C" {
|
||||
************************************************************** */
|
||||
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) /* UNIX-like OS */ \
|
||||
|| defined(__midipix__) || defined(__VMS))
|
||||
# if (defined(__APPLE__) && defined(__MACH__)) || defined(__SVR4) || defined(_AIX) || defined(__hpux) /* POSIX.1–2001 (SUSv3) conformant */ \
|
||||
# if (defined(__APPLE__) && defined(__MACH__)) || defined(__SVR4) || defined(_AIX) || defined(__hpux) /* POSIX.1-2001 (SUSv3) conformant */ \
|
||||
|| defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MidnightBSD__) /* BSD distros */ \
|
||||
|| defined(__HAIKU__)
|
||||
# define PLATFORM_POSIX_VERSION 200112L
|
||||
|
35
tests/unicode_lint.sh
Normal file
35
tests/unicode_lint.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# `unicode_lint.sh' determines whether source files under the ./lib/ and ./programs/ directories
|
||||
# contain Unicode characters, and fails if any do.
|
||||
#
|
||||
# See https://github.com/lz4/lz4/issues/1018
|
||||
|
||||
pass=true
|
||||
|
||||
# Scan ./lib/ for Unicode in source (*.c, *.h) files
|
||||
result=$(
|
||||
find ./lib/ -regex '.*\.\(c\|h\)$' -exec grep -P -n "[^\x00-\x7F]" {} \; -exec echo "{}: FAIL" \;
|
||||
)
|
||||
if [[ $result ]]; then
|
||||
echo "$result"
|
||||
pass=false
|
||||
fi
|
||||
|
||||
# Scan ./programs/ for Unicode in source (*.c, *.h) files
|
||||
result=$(
|
||||
find ./programs/ -regex '.*\.\(c\|h\)$' -exec grep -P -n "[^\x00-\x7F]" {} \; -exec echo "{}: FAIL" \;
|
||||
)
|
||||
if [[ $result ]]; then
|
||||
echo "$result"
|
||||
pass=false
|
||||
fi
|
||||
|
||||
if [ "$pass" = true ]; then
|
||||
echo "All tests successful."
|
||||
echo "Result: PASS"
|
||||
exit 0
|
||||
else
|
||||
echo "Result: FAIL"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user