rbs 4.0.0.dev.1 → 4.0.0.dev.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: d0f208999624a32e97044b8427ec19fa233e21a530a6383efe4ea5b9333ab1ce
4
- data.tar.gz: d03954e5a4fa29a428085183a90a86b481849b0994e0d454cccca395412a31f0
3
+ metadata.gz: 0f04dce135a1eb82da13c36f9a8ac01710c75cc2d2943643508b94187f281529
4
+ data.tar.gz: e4ddb5b4dd310100eb75e07b0a88a1cd92a2787f262db440b33834fbdd595b95
5
5
  SHA512:
6
- metadata.gz: 56da6e8a6a9336ae251d766b85c0d8ab62b42a8df1f1c828cd8f0c0ce898ac639a024c5b819e2e6a85733fa1d140ca5b06fc61de62b36fdb21074d34710bb003
7
- data.tar.gz: de3ac4191be3ec60ab8bd25c4653cc2663effc2004c9d5e33d9fbb6eabace99fa883dfd5201d92c7f574d8730a74116867a853cb525343a639aeef6d0dd6d041
6
+ metadata.gz: 55dc93bbac5c8472d7241e999bfa879ee6fe2c4e8e518eebae130596fc650a9e512a6140fc52d62be3b11751a3fb6414c7cdd8aeed85423e65077862223435f9
7
+ data.tar.gz: c160219cfb46afc018c8f5a1e21d10d21ba517f5f13b74d3871add96713fefe3597865d0907fc59f229098f7e13d3de729026136ee1eb15e0055ce90abfc8b9c
@@ -106,3 +106,31 @@ jobs:
106
106
  - run: bundle exec rake test:valgrind
107
107
  env:
108
108
  RUBY_FREE_AT_EXIT: 1
109
+ C99_compile:
110
+ runs-on: macos-latest
111
+ strategy:
112
+ fail-fast: false
113
+ matrix:
114
+ ruby: ['3.4', head]
115
+ steps:
116
+ - uses: actions/checkout@v4
117
+ - name: Install dependencies
118
+ run: |
119
+ brew install ruby-build
120
+ - uses: ruby/setup-ruby@v1
121
+ with:
122
+ ruby-version: ${{ matrix.ruby }}
123
+ bundler: none
124
+ - name: Set working directory as safe
125
+ run: git config --global --add safe.directory $(pwd)
126
+ - name: Update rubygems & bundler
127
+ run: |
128
+ ruby -v
129
+ gem update --system
130
+ - name: clang version
131
+ run: clang --version
132
+ - name: bin/setup
133
+ run: |
134
+ bin/setup
135
+ - run: bundle exec rake clean compile_c99
136
+
data/Rakefile CHANGED
@@ -437,3 +437,11 @@ task :changelog do
437
437
  puts " (🤑 There is no *unreleased* pull request associated to the milestone.)"
438
438
  end
439
439
  end
440
+
441
+ desc "Compile extension without C23 extensions"
442
+ task :compile_c99 do
443
+ ENV["TEST_NO_C23"] = "true"
444
+ Rake::Task[:"compile"].invoke
445
+ ensure
446
+ ENV.delete("TEST_NO_C23")
447
+ end
@@ -1146,4 +1146,6 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan
1146
1146
  return ID2SYM(rb_intern3((const char *) constant->start, constant->length, ctx.encoding));
1147
1147
  }
1148
1148
  }
1149
+
1150
+ rb_raise(rb_eRuntimeError, "Unknown node type: %d", instance->type);
1149
1151
  }
@@ -8,8 +8,12 @@
8
8
  #ifndef RBS_EXTENSION_AST_TRANSLATION_H
9
9
  #define RBS_EXTENSION_AST_TRANSLATION_H
10
10
 
11
+ #include "compat.h"
12
+
13
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
11
14
  #include "ruby.h"
12
15
  #include "ruby/encoding.h"
16
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
13
17
 
14
18
  #include "rbs/ast.h"
15
19
  #include "rbs/location.h"
@@ -8,7 +8,11 @@
8
8
  #ifndef RBS__CONSTANTS_H
9
9
  #define RBS__CONSTANTS_H
10
10
 
11
+ #include "compat.h"
12
+
13
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
11
14
  #include "ruby.h"
15
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
12
16
 
13
17
  extern VALUE RBS;
14
18
 
@@ -0,0 +1,10 @@
1
+ #ifdef __clang__
2
+ #define SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN \
3
+ _Pragma("clang diagnostic push") \
4
+ _Pragma("clang diagnostic ignored \"-Wc2x-extensions\"")
5
+ #define SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END \
6
+ _Pragma("clang diagnostic pop")
7
+ #else
8
+ #define SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
9
+ #define SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
10
+ #endif
@@ -13,5 +13,9 @@ $srcs = Dir.glob("#{root_dir}/src/**/*.c") +
13
13
 
14
14
  append_cflags ['-std=gnu99', '-Wimplicit-fallthrough', '-Wunused-result']
15
15
  append_cflags ['-O0', '-g'] if ENV['DEBUG']
16
+ if ENV["TEST_NO_C23"]
17
+ puts "Adding -Wc2x-extensions to CFLAGS"
18
+ $CFLAGS << " -Werror -Wc2x-extensions"
19
+ end
16
20
 
17
21
  create_makefile 'rbs_extension'
@@ -1,7 +1,12 @@
1
1
  #ifndef RBS_LOCATION_H
2
2
  #define RBS_LOCATION_H
3
3
 
4
+ #include "compat.h"
5
+
6
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
4
7
  #include "ruby.h"
8
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
9
+
5
10
  #include "rbs.h"
6
11
 
7
12
  /**
@@ -1,8 +1,11 @@
1
1
  #include <stdbool.h>
2
+ #include "compat.h"
2
3
 
4
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
3
5
  #include "ruby.h"
4
6
  #include "ruby/re.h"
5
7
  #include "ruby/encoding.h"
8
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
6
9
 
7
10
  #include "class_constants.h"
8
11
  #include "rbs.h"
@@ -1,8 +1,12 @@
1
1
  #ifndef RBS__RBS_STRING_BRIDGING_H
2
2
  #define RBS__RBS_STRING_BRIDGING_H
3
3
 
4
+ #include "compat.h"
5
+
6
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
4
7
  #include "ruby.h"
5
8
  #include "ruby/encoding.h"
9
+ SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
6
10
 
7
11
  #include "rbs/string.h"
8
12
 
data/include/rbs/lexer.h CHANGED
@@ -140,9 +140,9 @@ typedef struct {
140
140
  const rbs_encoding_t *encoding;
141
141
  } rbs_lexer_t;
142
142
 
143
- extern rbs_token_t NullToken;
144
- extern rbs_position_t NullPosition;
145
- extern rbs_range_t NULL_RANGE;
143
+ extern const rbs_token_t NullToken;
144
+ extern const rbs_position_t NullPosition;
145
+ extern const rbs_range_t NULL_RANGE;
146
146
 
147
147
  char *rbs_peek_token(rbs_lexer_t *lexer, rbs_token_t tok);
148
148
  int rbs_token_chars(rbs_token_t tok);
data/lib/rbs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- VERSION = "4.0.0.dev.1"
4
+ VERSION = "4.0.0.dev.2"
5
5
  end
data/src/lexstate.c CHANGED
@@ -92,9 +92,9 @@ static const char *RBS_TOKENTYPE_NAMES[] = {
92
92
  "tANNOTATION", /* Annotation */
93
93
  };
94
94
 
95
- rbs_token_t NullToken = { .type = NullType, .range = {} };
96
- rbs_position_t NullPosition = { -1, -1, -1, -1 };
97
- rbs_range_t NULL_RANGE = { { -1, -1, -1, -1 }, { -1, -1, -1, -1 } };
95
+ const rbs_position_t NullPosition = { -1, -1, -1, -1 };
96
+ const rbs_range_t NULL_RANGE = { { -1, -1, -1, -1 }, { -1, -1, -1, -1 } };
97
+ const rbs_token_t NullToken = { .type = NullType, .range = { {0}, {0} } };
98
98
 
99
99
  const char *rbs_token_type_str(enum RBSTokenType type) {
100
100
  return RBS_TOKENTYPE_NAMES[type];
data/src/parser.c CHANGED
@@ -3415,7 +3415,7 @@ rbs_parser_t *rbs_parser_new(rbs_string_t string, const rbs_encoding_t *encoding
3415
3415
  .vars = NULL,
3416
3416
  .last_comment = NULL,
3417
3417
 
3418
- .constant_pool = {},
3418
+ .constant_pool = {0},
3419
3419
  .allocator = allocator,
3420
3420
  .error = NULL,
3421
3421
  };
@@ -96,7 +96,7 @@ rbs_constant_pool_resize(rbs_constant_pool_t *pool) {
96
96
  }
97
97
 
98
98
  // This storage is initialized by `Init_rbs_extension()` in `main.c`.
99
- static rbs_constant_pool_t RBS_GLOBAL_CONSTANT_POOL_STORAGE = {};
99
+ static rbs_constant_pool_t RBS_GLOBAL_CONSTANT_POOL_STORAGE = {0};
100
100
  rbs_constant_pool_t *RBS_GLOBAL_CONSTANT_POOL = &RBS_GLOBAL_CONSTANT_POOL_STORAGE;
101
101
 
102
102
  /**
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.dev.1
4
+ version: 4.0.0.dev.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-05-02 00:00:00.000000000 Z
10
+ date: 2025-05-09 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: logger
@@ -160,6 +160,7 @@ files:
160
160
  - ext/rbs_extension/ast_translation.h
161
161
  - ext/rbs_extension/class_constants.c
162
162
  - ext/rbs_extension/class_constants.h
163
+ - ext/rbs_extension/compat.h
163
164
  - ext/rbs_extension/extconf.rb
164
165
  - ext/rbs_extension/legacy_location.c
165
166
  - ext/rbs_extension/legacy_location.h