prism 1.8.1 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc702a11a2b52196e74eee050fefa294ac3c2aef3dcd7d4ab2f347e075707286
4
- data.tar.gz: 32666fef05c64edc7a55ab517d6b582931f9b5b11ff22b5d9dfc5c7d00ee00b2
3
+ metadata.gz: 1c783657a881bf48ea7f582fd8460ce7230ffc142a67d6eab53f06c5878d2739
4
+ data.tar.gz: 761e009ead12f8984342f4aa44a8efb8e2c312b1b19527ba9e6399ba8a9990aa
5
5
  SHA512:
6
- metadata.gz: 2507880056ab51a2aafb14b6927a5d009ff8f3be4eb9917705a56ac59ac6c21c4a687f984652f2f4abe813e24f239077ee5aa0cd7308b6f3240fa864b1b06b28
7
- data.tar.gz: 921a61d5bd263f70975250aca097c6ed36b747762098b2bc90d113d88f8c8f802e931bf7c2f78c365bce9390190b53bc1c243c1dfa5d3ea2a9c89a12b45659fb
6
+ metadata.gz: 247eb5ba72e15a0bf3136a45582218c232cb300f34b33304bbc63dcfa2ab8fbd728192aff1f63de3b6d2bf23a18afb1711460e28f8e5ce1cc478f5af6e37b205
7
+ data.tar.gz: f0ee65d2c2ff74a3bc9fe0709177467fafdaf0a79aa0c43e8e5f82bfc17c855d3546aa6442d45de55dcea4fe06e567879e60d8a23448a151a1e9d539ccfbd1fd
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.8.2] - 2026-10-21
10
+
11
+ ### Changed
12
+
13
+ - Fix build errors with C23 qualifier-preserving `memchr`.
14
+ - Do not warn for ambiguous `/` when targeting Ruby 4.1.
15
+ - Fix array-bounds warnings with newer GCC.
16
+
9
17
  ## [1.8.1] - 2026-03-16
10
18
 
11
19
  ### Changed
@@ -740,7 +748,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
740
748
 
741
749
  - 🎉 Initial release! 🎉
742
750
 
743
- [unreleased]: https://github.com/ruby/prism/compare/v1.8.1...HEAD
751
+ [unreleased]: https://github.com/ruby/prism/compare/v1.8.2...HEAD
752
+ [1.8.2]: https://github.com/ruby/prism/compare/v1.8.1...v1.8.2
744
753
  [1.8.1]: https://github.com/ruby/prism/compare/v1.8.0...v1.8.1
745
754
  [1.8.0]: https://github.com/ruby/prism/compare/v1.7.0...v1.8.0
746
755
  [1.7.0]: https://github.com/ruby/prism/compare/v1.6.0...v1.7.0
@@ -1,7 +1,7 @@
1
1
  #ifndef PRISM_EXT_NODE_H
2
2
  #define PRISM_EXT_NODE_H
3
3
 
4
- #define EXPECTED_PRISM_VERSION "1.8.1"
4
+ #define EXPECTED_PRISM_VERSION "1.8.2"
5
5
 
6
6
  #include <ruby.h>
7
7
  #include <ruby/encoding.h>
@@ -257,4 +257,22 @@
257
257
  #define PRISM_FALLTHROUGH
258
258
  #endif
259
259
 
260
+ /**
261
+ * Tell the compiler that the given expression can be assumed to be true. Unlike
262
+ * assert, this emits no runtime check — it only feeds the optimizer's value
263
+ * range analysis so it can prune impossible paths. Use it to communicate an
264
+ * invariant the caller guarantees but that the compiler cannot otherwise prove.
265
+ */
266
+ #if defined(__clang__)
267
+ #define PRISM_ASSUME(expr_) __builtin_assume(expr_)
268
+ #elif defined(_MSC_VER)
269
+ #define PRISM_ASSUME(expr_) __assume(expr_)
270
+ #elif defined(__GNUC__) && (__GNUC__ >= 13)
271
+ #define PRISM_ASSUME(expr_) __attribute__((assume(expr_)))
272
+ #elif defined(__GNUC__)
273
+ #define PRISM_ASSUME(expr_) ((expr_) ? (void) 0 : __builtin_unreachable())
274
+ #else
275
+ #define PRISM_ASSUME(expr_) ((void) 0)
276
+ #endif
277
+
260
278
  #endif
@@ -24,6 +24,6 @@
24
24
  * @return A pointer to the first occurrence of the character in the source
25
25
  * string, or NULL if no such character exists.
26
26
  */
27
- void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
27
+ const void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
28
28
 
29
29
  #endif
@@ -19,11 +19,11 @@
19
19
  /**
20
20
  * The patch version of the Prism library as an int.
21
21
  */
22
- #define PRISM_VERSION_PATCH 1
22
+ #define PRISM_VERSION_PATCH 2
23
23
 
24
24
  /**
25
25
  * The version of the Prism library as a constant string.
26
26
  */
27
- #define PRISM_VERSION "1.8.1"
27
+ #define PRISM_VERSION "1.8.2"
28
28
 
29
29
  #endif
@@ -25,7 +25,7 @@ module Prism
25
25
 
26
26
  # The patch version of prism that we are expecting to find in the serialized
27
27
  # strings.
28
- PATCH_VERSION = 1
28
+ PATCH_VERSION = 2
29
29
 
30
30
  # Deserialize the dumped output from a request to parse or parse_file.
31
31
  #
data/prism.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "prism"
5
- spec.version = "1.8.1"
5
+ spec.version = "1.8.2"
6
6
  spec.authors = ["Shopify"]
7
7
  spec.email = ["ruby@shopify.com"]
8
8
 
data/src/diagnostic.c CHANGED
@@ -761,6 +761,7 @@ pm_diagnostic_id_human(pm_diagnostic_id_t diag_id) {
761
761
  static inline const char *
762
762
  pm_diagnostic_message(pm_diagnostic_id_t diag_id) {
763
763
  assert(diag_id < PM_DIAGNOSTIC_ID_MAX);
764
+ PRISM_ASSUME(diag_id < PM_DIAGNOSTIC_ID_MAX);
764
765
 
765
766
  const char *message = diagnostic_messages[diag_id].message;
766
767
  assert(message);
@@ -771,6 +772,7 @@ pm_diagnostic_message(pm_diagnostic_id_t diag_id) {
771
772
  static inline uint8_t
772
773
  pm_diagnostic_level(pm_diagnostic_id_t diag_id) {
773
774
  assert(diag_id < PM_DIAGNOSTIC_ID_MAX);
775
+ PRISM_ASSUME(diag_id < PM_DIAGNOSTIC_ID_MAX);
774
776
 
775
777
  return (uint8_t) diagnostic_messages[diag_id].level;
776
778
  }
data/src/prism.c CHANGED
@@ -10774,7 +10774,10 @@ parser_lex(pm_parser_t *parser) {
10774
10774
  }
10775
10775
 
10776
10776
  if (lex_state_spcarg_p(parser, space_seen)) {
10777
- pm_parser_warn_token(parser, &parser->current, PM_WARN_AMBIGUOUS_SLASH);
10777
+ // https://bugs.ruby-lang.org/issues/21994
10778
+ if (parser->version <= PM_OPTIONS_VERSION_CRUBY_4_0) {
10779
+ pm_parser_warn_token(parser, &parser->current, PM_WARN_AMBIGUOUS_SLASH);
10780
+ }
10778
10781
  lex_mode_push_regexp(parser, '\0', '/');
10779
10782
  LEX(PM_TOKEN_REGEXP_BEGIN);
10780
10783
  }
data/src/util/pm_memchr.c CHANGED
@@ -7,7 +7,7 @@
7
7
  * we need to search for a character in a buffer that could be the trailing byte
8
8
  * of a multibyte character.
9
9
  */
10
- void *
10
+ const void *
11
11
  pm_memchr(const void *memory, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding) {
12
12
  if (encoding_changed && encoding->multibyte && character >= PRISM_MEMCHR_TRAILING_BYTE_MINIMUM) {
13
13
  const uint8_t *source = (const uint8_t *) memory;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prism
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify