From 0baa541081e0ceaf2f8af283d40462654557ea16 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Sat, 5 Oct 2019 07:00:07 +0900 Subject: [PATCH 1/3] ext/json/parser/prereq.mk: Add a "automatically generated" header to parser.c. ruby/ruby@5717e55e9a7790c938afa694a9bf558c0e54bb83 ruby/ruby@70e3fda2eb45c841e5fb4574273d20f8df5455e5 --- Rakefile | 1 + ext/json/ext/parser/parser.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 7e307dcb5..2b688187b 100644 --- a/Rakefile +++ b/Rakefile @@ -331,6 +331,7 @@ else end src = File.read("parser.c").gsub(/[ \t]+$/, '') src.gsub!(/^static const int (JSON_.*=.*);$/, 'enum {\1};') + src[0, 0] = "/* This file is automatically generated from parser.rl by using ragel */" File.open("parser.c", "w") {|f| f.print src} end end diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index bc4ac46e0..0f98cf982 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1,4 +1,4 @@ - +/* This file is automatically generated from parser.rl by using ragel */ #line 1 "parser.rl" #include "../fbuffer/fbuffer.h" #include "parser.h" From 14fadad26a6e3a6ce5fa4e0286b2ce4336052177 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Thu, 14 May 2020 00:44:35 +0900 Subject: [PATCH 2/3] ext/json/parser/prereq.mk: remove type-limit warning if char is unsigned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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)`. ruby/ruby@8bd27c547c3260ce72dc5edbab248bb858c84cf2 --- Rakefile | 1 + ext/json/ext/parser/parser.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 2b688187b..0945a67c8 100644 --- a/Rakefile +++ b/Rakefile @@ -331,6 +331,7 @@ else end src = File.read("parser.c").gsub(/[ \t]+$/, '') src.gsub!(/^static const int (JSON_.*=.*);$/, 'enum {\1};') + src.gsub!(/0 <= \(\*p\) && \(\*p\) <= 31/, "0 <= (signed char)(*p) && (*p) <= 31") src[0, 0] = "/* This file is automatically generated from parser.rl by using ragel */" File.open("parser.c", "w") {|f| f.print src} end diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index 0f98cf982..e4a305663 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1563,7 +1563,7 @@ case 2: case 34: goto tr2; case 92: goto st3; } - if ( 0 <= (*p) && (*p) <= 31 ) + if ( 0 <= (signed char)(*p) && (*p) <= 31 ) goto st0; goto st2; tr2: @@ -1593,7 +1593,7 @@ case 8: case 3: if ( (*p) == 117 ) goto st4; - if ( 0 <= (*p) && (*p) <= 31 ) + if ( 0 <= (signed char)(*p) && (*p) <= 31 ) goto st0; goto st2; st4: From 9c29ce3ad51e0cce80302e63a438c2927c8d99b5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 25 Jun 2020 16:41:08 +0900 Subject: [PATCH 3/3] Removed nonsense `rubygems_version` in input gemspec files As it is ignored and set at building packages automatically, it is just nonsense to set in gemspec file for input. ruby/ruby@9a78e24f7d269c9688a0fa50c82751b5ec8d512a --- json.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/json.gemspec b/json.gemspec index a101aba9d..0c72e8242 100644 --- a/json.gemspec +++ b/json.gemspec @@ -131,7 +131,6 @@ Gem::Specification.new do |s| s.licenses = ["Ruby"] s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.md"] s.required_ruby_version = Gem::Requirement.new(">= 2.0") - s.rubygems_version = "3.0.2" s.summary = "JSON Implementation for Ruby" s.test_files = ["tests/test_helper.rb"]