diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-05-14 00:44:35 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2020-05-14 00:44:35 +0900 |
commit | 8bd27c547c3260ce72dc5edbab248bb858c84cf2 (patch) | |
tree | b3d7915f836fabb30ae5da563cd9df0e66ab213f /ext/json/parser/prereq.mk | |
parent | 87662134b5351bd750e50bc6e9ff2a6ffe9b1f68 (diff) |
ext/json/parser/prereq.mk: remove type-limit warning if char is unsigned
Ragel generates a code `0 <= (*p)` where `*p` is char.
As char is unsigned by default on arm and RISC-V, it is warned by gcc:
```
compiling parser.c
parser.c: In function ‘JSON_parse_string’:
parser.c:1566:2: warning: comparison is always true due to limited range of data type [-Wtype-limits]
if ( 0 <= (*p) && (*p) <= 31 )
^
parser.c:1596:2: warning: comparison is always true due to limited range of data type [-Wtype-limits]
if ( 0 <= (*p) && (*p) <= 31 )
^
```
This change removes the warning by substituting the condition with
`0 <= (signed char)(*p)`.
Diffstat (limited to 'ext/json/parser/prereq.mk')
-rw-r--r-- | ext/json/parser/prereq.mk | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/json/parser/prereq.mk b/ext/json/parser/prereq.mk index 37bacc3380..9111431ab8 100644 --- a/ext/json/parser/prereq.mk +++ b/ext/json/parser/prereq.mk @@ -6,6 +6,7 @@ RAGEL = ragel $(RAGEL) -G2 $< $(BASERUBY) -pli -e '$$_.sub!(/[ \t]+$$/, "")' \ -e '$$_.sub!(/^static const int (JSON_.*=.*);$$/, "enum {\\1};")' \ + -e '$$_.sub!(/0 <= \(\*p\) && \(\*p\) <= 31/, "0 <= (signed char)(*p) && (*p) <= 31")' \ -e '$$_ = "/* This file is automatically generated from parser.rl by using ragel */" + $$_ if $$. == 1' $@ parser.c: |